Class Expander
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Expander
HELP_CHOICE = {
key: "h",
name: "print help",
value: :help
Method validate_choices
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_choices
errors = []
keys = []
@choices.each do |choice|
if choice.key.nil?
- 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 keypress
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def keypress(event)
if DELETE_KEYS.include?(event.key.name)
@input.chop! unless @input.empty?
elsif event.value =~ /^[^\e\n\r]/
@input += event.value
- 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 load_auto_hint
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_auto_hint
if @hint.nil? && collapsed?
if @selected
@hint = @selected.name
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"
Further reading
Method refresh
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def refresh(lines)
if (@hint && (!@selected || @done)) || (@auto_hint && collapsed?)
@hint = nil
@prompt.clear_lines(lines, :down) +
@prompt.cursor.prev_line
- 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 keyenter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def keyenter(_)
if @input.nil? || @input.empty?
@input = @choices[@default - 1].key
@default_key = true
end
- 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"