lib/pry/repl.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method repl has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def repl
      loop do
        case val = read
        when :control_c
          output.puts ""
Severity: Minor
Found in lib/pry/repl.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 handle_read_errors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def handle_read_errors
      should_retry = true
      exception_count = 0

      begin
Severity: Minor
Found in lib/pry/repl.rb - About 1 hr to fix

    Method read has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def read
          @indent.reset if pry.eval_string.empty?
          current_prompt = pry.select_prompt
          indentation = pry.config.auto_indent ? @indent.current_prefix : ''
    
    
    Severity: Minor
    Found in lib/pry/repl.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 read_line has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_line(current_prompt)
          handle_read_errors do
            if coolline_available?
              input.completion_proc = proc do |cool|
                completions = @pry.complete cool.completed_word
    Severity: Minor
    Found in lib/pry/repl.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 handle_read_errors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_read_errors
          should_retry = true
          exception_count = 0
    
          begin
    Severity: Minor
    Found in lib/pry/repl.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 calculate_overhang has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def calculate_overhang(current_prompt, original_val, indented_val)
          overhang = original_val.length - indented_val.length
    
          if readline_available? && Readline.respond_to?(:vi_editing_mode?)
            begin
    Severity: Minor
    Found in lib/pry/repl.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