Showing 108 of 108 total issues

Class Method has 50 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Method # rubocop:disable Metrics/ClassLength
    extend Helpers::BaseHelpers
    extend Forwardable

    include Helpers::BaseHelpers
Severity: Minor
Found in lib/pry/method.rb - About 7 hrs to fix

    Method call has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        def call(str, options = {})
          custom_completions = options[:custom_completions] || []
          # if there are multiple contexts e.g. cd 1/2/3
          # get new target for 1/2 and find candidates for 3
          path, input = build_path(str)
    Severity: Minor
    Found in lib/pry/input_completer.rb - About 6 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

    Class Command has 48 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Command
        extend Helpers::DocumentationHelpers
        extend CodeObject::Helpers
    
        include Pry::Helpers::BaseHelpers
    Severity: Minor
    Found in lib/pry/command.rb - About 6 hrs to fix

      Method call has 146 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def call(str, options = {})
            custom_completions = options[:custom_completions] || []
            # if there are multiple contexts e.g. cd 1/2/3
            # get new target for 1/2 and find candidates for 3
            path, input = build_path(str)
      Severity: Major
      Found in lib/pry/input_completer.rb - About 5 hrs to fix

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

        require 'method_source'
        require 'ostruct'
        
        ##
        # Pry is a powerful alternative to the standard IRB shell for Ruby. It
        Severity: Minor
        Found in lib/pry/pry_instance.rb - About 5 hrs to fix

          Class Pry has 40 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 method.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'method_source'
            
            class Pry
              class << self
                # If the given object is a `Pry::Method`, return it unaltered. If it's
            Severity: Minor
            Found in lib/pry/method.rb - About 5 hrs to fix

              Class Slop has 36 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Slop
                  require_relative 'slop/option'
                  require_relative 'slop/commands'
                  include Enumerable
                  VERSION = '3.4.0'.freeze
              Severity: Minor
              Found in lib/pry/slop.rb - About 4 hrs to fix

                Method process_item has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                    def process_item(items, index, &block)
                      return unless (item = items[index])
                
                      option, argument = extract_option(item) if item.start_with?('-')
                
                
                Severity: Minor
                Found in lib/pry/slop.rb - About 4 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

                Class WrappedModule has 33 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class WrappedModule
                    include Helpers::BaseHelpers
                    include CodeObject::Helpers
                
                    attr_reader :wrapped
                Severity: Minor
                Found in lib/pry/wrapped_module.rb - About 4 hrs to fix

                  File slop.rb has 336 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  class Pry
                    # rubocop:disable Metrics/ClassLength
                    class Slop
                      require_relative 'slop/option'
                      require_relative 'slop/commands'
                  Severity: Minor
                  Found in lib/pry/slop.rb - About 4 hrs to fix

                    File command.rb has 316 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'delegate'
                    require 'shellwords'
                    
                    class Pry
                      # The super-class of all commands, new commands should be created by calling
                    Severity: Minor
                    Found in lib/pry/command.rb - About 3 hrs to fix

                      Class Code has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class Code
                          class << self
                            include MethodSource::CodeHelpers
                      
                            # Instantiate a `Code` object containing code loaded from a file or
                      Severity: Minor
                      Found in lib/pry/code.rb - About 3 hrs to fix

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

                            def indentation_delta(tokens)
                              # We need to keep track of whether we've seen a "for" on this line because
                              # if the line ends with "do" then that "do" should be discounted (i.e. we're
                              # only opening one level not two) To do this robustly we want to keep track
                              # of the indent level at which we saw the for, so we can differentiate
                        Severity: Minor
                        Found in lib/pry/indent.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 format has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def format(mod, constants)
                                  constants.sort_by(&:downcase).map do |name|
                                    if Object.respond_to?(:deprecate_constant) &&
                                       DEPRECATED_CONSTANTS.include?(name) &&
                                       !show_deprecated_constants?
                        Severity: Minor
                        Found in lib/pry/commands/ls/constants.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

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

                        class Pry
                          LOCAL_RC_FILE = "./.pryrc".freeze
                        
                          # @return [Boolean] true if this Ruby supports safe levels and tainting,
                          #  to guard against using deprecated or unsupported features
                        Severity: Minor
                        Found in lib/pry/pry_class.rb - About 3 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

                          Class Edit has 23 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class Edit < Pry::ClassCommand
                                match 'edit'
                                group 'Editing'
                                description 'Invoke the default editor on a file.'
                          
                          
                          Severity: Minor
                          Found in lib/pry/commands/edit.rb - About 2 hrs to fix

                            Method resolve has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def resolve
                                  scanner = StringScanner.new(@path_string.strip)
                                  stack   = @current_stack.dup
                            
                                  loop do
                            Severity: Minor
                            Found in lib/pry/object_path.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 initialize has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def initialize
                                  merge!(
                                    input: MemoizedValue.new { lazy_readline },
                                    output: $stdout.tap { |out| out.sync = true },
                                    commands: Pry::Commands,
                            Severity: Major
                            Found in lib/pry/config.rb - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language