Showing 105 of 107 total issues

Method process_item has 30 lines of code (exceeds 25 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 1 hr to fix

    Method start has 30 lines of code (exceeds 25 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 1 hr to fix

      Method parse_options has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def parse_options(args = ARGV)
              unless options
                raise NoOptionsError,
                      "No command line options defined! Use Pry::CLI.add_options to " \
                      "add command line options."
      Severity: Minor
      Found in lib/pry/cli.rb - About 1 hr to fix

        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 search_hash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def search_hash(search, hash)
                  matching = {}
          
                  hash.each_pair do |key, value|
                    next unless key.is_a?(String)
          Severity: Minor
          Found in lib/pry/commands/help.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 blocking_flag_for_editor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def blocking_flag_for_editor(blocking)
                case editor_name
                when /^emacsclient/
                  '--no-wait' unless blocking
                when /^[gm]vim/
          Severity: Minor
          Found in lib/pry/editor.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 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 control_d_handler= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def control_d_handler=(value)
                proxy_proc =
                  if value.arity == 2
                    Pry::Warning.warn(
                      "control_d_handler's arity of 2 parameters was deprecated " \
          Severity: Minor
          Found in lib/pry/config.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 track_module_nesting has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def track_module_nesting(token, kind)
                if kind == :keyword && %w[class module].include?(token)
                  @module_nesting << [token, nil]
                  @awaiting_class = true
                elsif @awaiting_class
          Severity: Minor
          Found in lib/pry/indent.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 tokenize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def tokenize(val)
                val = interpolate_string(val) if command_options[:interpolate]
          
                self.class.command_regex =~ val
          
          
          Severity: Minor
          Found in lib/pry/command.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 parse! has 26 lines of code (exceeds 25 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

            Method from_binding has 26 lines of code (exceeds 25 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

              Method recurse_namespace has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                    def recurse_namespace(klass, done = {}, &block)
                      return if !klass.is_a?(Module) || done[klass]
              
                      done[klass] = true
              
              
              Severity: Minor
              Found in lib/pry/commands/find_method.rb - About 55 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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                    def process
                      state.old_stack ||= []
              
                      if arg_string.strip == "-"
                        unless state.old_stack.empty?
              Severity: Minor
              Found in lib/pry/commands/cd.rb - About 55 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 normal_method? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      def normal_method?(method, binding)
                        if method && method.source_file && method.source_range
                          if binding.respond_to?(:source_location)
                            binding_file, binding_line = binding.source_location
                          else
              Severity: Minor
              Found in lib/pry/method/weird_method_locator.rb - About 55 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def process
                      meth = method_object
                      aliases = meth.aliases
              
                      output.puts(unindent(<<-OUTPUT))
              Severity: Minor
              Found in lib/pry/commands/stat.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 signature has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def signature
                    if respond_to?(:parameters)
                      args = parameters.inject([]) do |args_array, (arg_type, name)|
                        name ||= (arg_type == :block ? 'block' : "arg#{args_array.size + 1}")
                        args_array.push(
              Severity: Minor
              Found in lib/pry/method.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def initialize(slop, short, long, description, config = {}, &block)
              Severity: Minor
              Found in lib/pry/slop/option.rb - About 45 mins to fix

                Method view_clip has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.view_clip(obj, options = {})
                    max = options.fetch :max_length, 60
                    id = options.fetch :id, false
                    if obj.is_a?(Module) && obj.name.to_s != "" && obj.name.to_s.length <= max
                      obj.name.to_s
                Severity: Minor
                Found in lib/pry/pry_class.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 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

                Severity
                Category
                Status
                Source
                Language