Showing 105 of 107 total issues

Class Whereami has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Whereami < Pry::ClassCommand
      def initialize(*)
        super

        @method_code = nil
Severity: Minor
Found in lib/pry/commands/whereami.rb - About 2 hrs to fix

    Class CommandSet has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class CommandSet
        include Enumerable
        include Pry::Helpers::BaseHelpers
        attr_reader :helper_module
    
    
    Severity: Minor
    Found in lib/pry/command_set.rb - About 2 hrs to fix

      Method start has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.start(target = nil, options = {})
          return if Pry::Env['DISABLE_PRY']
          if Pry::Env['FAIL_PRY']
            raise 'You have FAIL_PRY set to true, which results in Pry calls failing'
          end
      Severity: Minor
      Found in lib/pry/pry_class.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 parse! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse!(items = ARGV, &block)
              if items.empty? && @callbacks[:empty]
                @callbacks[:empty].each { |cb| cb.call(self) }
                return items
              end
        Severity: Minor
        Found in lib/pry/slop.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 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 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 to_s has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def to_s
              heads  = options.reject(&:tail?)
              tails  = (options - heads)
              opts = (heads + tails).select(&:help).map(&:to_s)
              optstr = opts.each_with_index.map do |o, i|
        Severity: Minor
        Found in lib/pry/slop.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 eval has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def eval(*strs)
                reset_output
                result = nil
        
                strs.flatten.each do |str|
        Severity: Minor
        Found in lib/pry/testable/pry_tester.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 indentation_delta has 38 lines of code (exceeds 25 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 1 hr to fix

          Method process has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def process(spec)
                  unless spec
                    return output.puts(
                      "Please provide a class, module, or method name (e.g: ri Array#push)"
                    )
          Severity: Minor
          Found in lib/pry/commands/ri.rb - About 1 hr to fix

            Method execute_option has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def execute_option(option, argument, index, item = nil)
                  unless option
                    if config[:multiple_switches] && strict?
                      raise InvalidOptionError, "Unknown option -#{item}"
                    end
            Severity: Minor
            Found in lib/pry/slop.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 from_str has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def from_str(name, target = TOPLEVEL_BINDING, options = {})
                    if name.nil?
                      nil
                    elsif name.to_s =~ /(.+)\#(\S+)\Z/
                      context = Regexp.last_match(1)
            Severity: Minor
            Found in lib/pry/method.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 process has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def process
                    @history = find_history
            
                    @history = @history.between(opts[:show]) if opts.present?(:show)
            
            
            Severity: Minor
            Found in lib/pry/commands/hist.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 resolve has 32 lines of code (exceeds 25 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 1 hr to fix

              Method extract_option has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def extract_option(flag)
                    option = fetch_option(flag)
                    option ||= fetch_option(flag.downcase) if config[:ignore_case]
                    option ||= fetch_option(flag.gsub(/([^-])-/, '\1_'))
              
              
              Severity: Minor
              Found in lib/pry/slop.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 from_binding has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def from_binding(binding)
                      meth_name = binding.eval('::Kernel.__method__')
                      if [:__script__, nil].include?(meth_name)
                        nil
                      else
              Severity: Minor
              Found in lib/pry/method.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 ignored_modules has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def ignored_modules
                    # We could cache the result, but IRB is not loaded by default.
                    # And this is very fast anyway.
                    # By using this approach, we avoid Module#name calls, which are
                    # relatively slow when there are a lot of anonymous modules defined.
              Severity: Minor
              Found in lib/pry/input_completer.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 format has 30 lines of code (exceeds 25 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 1 hr to fix
                Severity
                Category
                Status
                Source
                Language