lib/highline/menu.rb
Class Menu
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
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
File menu.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require "highline/question"
require "highline/menu/item"
class HighLine
#
Method value_for_selected_item
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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"
Further reading
Method init_help
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def init_help
return if @items.include?(:help)
topics = @help.keys.sort
help_help =
- 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"