lib/pry/pry_instance.rb

Summary

Maintainability
D
2 days
Test Coverage

Class Pry has 39 methods (exceeds 20 allowed). Consider refactoring.
Open

class Pry
  extend Pry::Forwardable

  attr_accessor :binding_stack
  attr_accessor :custom_completions
Severity: Minor
Found in lib/pry/pry_instance.rb - About 5 hrs to fix

    File pry_instance.rb has 358 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'method_source'
    
    ##
    # Pry is a powerful alternative to the standard IRB shell for Ruby. It
    # features syntax highlighting, a flexible plugin architecture, runtime
    Severity: Minor
    Found in lib/pry/pry_instance.rb - About 4 hrs to fix

      Method handle_line has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

        def handle_line(line, options)
          if line.nil?
            config.control_d_handler.call(self)
            return
          end
      Severity: Minor
      Found in lib/pry/pry_instance.rb - About 2 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 handle_line has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def handle_line(line, options)
          if line.nil?
            config.control_d_handler.call(self)
            return
          end
      Severity: Minor
      Found in lib/pry/pry_instance.rb - About 1 hr to fix

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

          def raise_up_common(force, *args)
            exception = if args == []
                          last_exception || RuntimeError.new
                        elsif args.length == 1 && args.first.is_a?(String)
                          RuntimeError.new(args.first)
        Severity: Minor
        Found in lib/pry/pry_instance.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 show_result has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def show_result(result)
            if last_result_is_exception?
              exception_handler.call(output, result, self)
            elsif should_print?
              print.call(output, result, self)
        Severity: Minor
        Found in lib/pry/pry_instance.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 select_prompt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def select_prompt
            object = current_binding.eval('self')
            nesting_level = binding_stack.size - 1
            pry_instance = self
        
        
        Severity: Minor
        Found in lib/pry/pry_instance.rb - About 35 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 process_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def process_command(val)
            val = val.lstrip if /^\s\S/ !~ val
            val = val.chomp
            result = commands.process_line(
              val,
        Severity: Minor
        Found in lib/pry/pry_instance.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