abinoam/highline

View on GitHub
lib/highline.rb

Summary

Maintainability
D
1 day
Test Coverage

Class HighLine has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

class HighLine
  include BuiltinStyles
  include CustomErrors

  extend SingleForwardable
Severity: Minor
Found in lib/highline.rb - About 5 hrs to fix

    File highline.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "English"
    require "erb"
    require "optparse"
    require "stringio"
    require "abbrev"
    Severity: Minor
    Found in lib/highline.rb - About 3 hrs to fix

      Method get_line_raw_no_echo_mode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_line_raw_no_echo_mode(question)
          line = ""
      
          terminal.raw_no_echo_mode_exec do
            loop do
      Severity: Minor
      Found in lib/highline.rb - About 3 hrs 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 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
      Severity: Minor
      Found in lib/highline.rb - About 1 hr 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 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)
      Severity: Minor
      Found in lib/highline.rb - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status