JEG2/highline

View on GitHub
lib/highline/menu.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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
Severity: Minor
Found in lib/highline/menu.rb - About 3 hrs to fix

    File menu.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "highline/question"
    require "highline/menu/item"
    
    class HighLine
      #
    Severity: Minor
    Found in lib/highline/menu.rb - About 2 hrs to fix

      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
      Severity: Minor
      Found in lib/highline/menu.rb - About 45 mins to fix

      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

          def init_help
            return if @items.include?(:help)
      
            topics    = @help.keys.sort
            help_help =
      Severity: Minor
      Found in lib/highline/menu.rb - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status