Showing 105 of 107 total issues

Method pass_block has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def pass_block(arg_string)
      # Workaround for weird JRuby bug where rindex in this case can return nil
      # even when there's a match.
      arg_string.scan(/\| *(?:do|\{)/)
      block_index = $LAST_MATCH_INFO && $LAST_MATCH_INFO.offset(0)[0]
Severity: Minor
Found in lib/pry/command.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

Method check_for_command_collision has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_for_command_collision(command_match, arg_string)
      collision_type = target.eval("defined?(#{command_match})")
      collision_type ||= 'local-variable' if arg_string =~ %r{\A\s*[-+*/%&|^]*=}

      if collision_type
Severity: Minor
Found in lib/pry/command.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

Method parse_options has a Cognitive Complexity of 6 (exceeds 5 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 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

Method pp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def pp(object)
      return super unless object.is_a?(String)

      # Avoid calling Ruby 2.4+ String#pretty_print that prints multiline
      # Strings prettier
Severity: Minor
Found in lib/pry/color_printer.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

Method file_and_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def file_and_line
        file_name, line =
          if opts.present?(:current)
            FileAndLineLocator.from_binding(target)
          elsif opts.present?(:ex)
Severity: Minor
Found in lib/pry/commands/edit.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

Severity
Category
Status
Source
Language