Showing 32 of 34 total issues
Class HighLine
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
class HighLine
include BuiltinStyles
include CustomErrors
extend SingleForwardable
Method get_line_raw_no_echo_mode
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def get_line_raw_no_echo_mode(question)
line = ""
terminal.raw_no_echo_mode_exec do
loop do
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Class ListRenderer
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class ListRenderer
# Items list
# @return [Array]
attr_reader :items
File highline.rb
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "English"
require "erb"
require "optparse"
require "stringio"
require "highline/terminal"
Class Menu
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Menu < Question
# Pass +false+ to _color_ to turn off HighLine::Menu's
# index coloring.
# Pass a color and the Menu's indices will be colored.
class << self
Class Question
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Question
include CustomErrors
#
# If _template_or_question_ is already a Question object just return it.
Class Style
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Style
# Index the given style.
# Uses @code_index (Hash) as repository.
# @param style [Style]
# @return [Style] the given style
File question.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "English"
require "optparse"
require "date"
require "pathname"
require "highline/question/answer_converter"
Method define_style_support_methods
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.define_style_support_methods(base)
base.class_eval do
undef :color if method_defined? :color
undef :foreground if method_defined? :foreground
def color(*args)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File menu.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "highline/question"
require "highline/menu/item"
class HighLine
#
Method define_style_support_methods
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.define_style_support_methods(base)
base.class_eval do
undef :color if method_defined? :color
undef :foreground if method_defined? :foreground
def color(*args)
Method find_or_create_style
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.find_or_create_style(arg)
if arg.is_a?(Style)
Style.list[arg.name] || Style.index(arg)
elsif arg.is_a?(::String) && arg =~ /^\e\[/ # arg is a code
styles = Style.code_index[arg]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ask_once
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def ask_once
# If in readline mode, let reline take care of the prompt
question.show_question(@highline) unless question.readline
begin
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method choose
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def choose(*items, &details)
menu = Menu.new(&details)
menu.choices(*items) unless items.empty?
# Set auto-completion
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ask_once
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ask_once
# If in readline mode, let reline take care of the prompt
question.show_question(@highline) unless question.readline
begin
Method terminal_size
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def terminal_size
begin
require "io/console"
winsize = begin
IO.console.winsize.reverse
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(input = $stdin, output = $stdout,
wrap_at = nil, page_at = nil,
indent_size = 3, indent_level = 0)
Method wrap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.wrap(text, wrap_at)
return text unless wrap_at
wrap_at = Integer(wrap_at)
wrapped = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create_bright_variant
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_bright_variant(variant_name)
raise "Cannot create a #{name} variant of a style list (#{inspect})" if
@list
new_name = ("#{variant_name}_" + @name.to_s).to_sym
new_rgb =
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method value_for_selected_item
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def value_for_selected_item(item, details)
if item.action
result = if @shell
item.action.call(item.name, details)
else
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"