Showing 105 of 107 total issues

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

    def default_lookup
      # we skip instance methods as we want those to fall through to
      # method_or_class_lookup()
      if safe_to_evaluate?(str) && !looks_like_an_instance_method?(str)
        obj = target.eval(str)
Severity: Minor
Found in lib/pry/code_object.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 history_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def history_file
      if defined?(@history_file)
        @history_file
      else
        unless File.exist?(history_file_path)
Severity: Minor
Found in lib/pry/history.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 __binding__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def __binding__
    # If you ever feel like changing this method, be careful about variables
    # that you use. They shouldn't be inserted into the binding that will
    # eventually be returned.

Severity: Minor
Found in lib/pry/core_extensions.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 available? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.available?
        if @system_pager.nil?
          @system_pager =
            begin
              pager_executable = default_pager.split(' ').first
Severity: Minor
Found in lib/pry/pager.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 process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def process
        code_object = Pry::CodeObject.lookup(obj_name, pry_instance, super: opts[:super])
        raise CommandError, no_definition_message unless code_object

        @original_code_object = code_object
Severity: Minor
Found in lib/pry/commands/show_info.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 process_yardoc_tag has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def process_yardoc_tag(comment, tag)
        in_tag_block = nil
        comment.lines.map do |v|
          if in_tag_block && v !~ /^\S/
            Pry::Helpers::Text.strip_color Pry::Helpers::Text.strip_color(v)
Severity: Minor
Found in lib/pry/helpers/documentation_helpers.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 check_for_juxtaposed_replay has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def check_for_juxtaposed_replay(replay_sequence)
        if replay_sequence =~ /\Ahist(?:ory)?\b/
          # Create *fresh* instance of Options for parsing of "hist" command.
          slop_instance = slop
          slop_instance.parse(replay_sequence.split(' ')[1..-1])
Severity: Minor
Found in lib/pry/commands/hist.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 handle_read_errors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_read_errors
      should_retry = true
      exception_count = 0

      begin
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

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

    def print_to_output(output, color = false)
      @lines.each do |loc|
        loc = loc.dup
        loc.colorize(@code_type)              if color
        loc.add_line_number(max_lineno_width, color) if @with_line_numbers
Severity: Minor
Found in lib/pry/code.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 get_method_or_raise has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def get_method_or_raise(method_name, context, opts = {})
        method = Pry::Method.from_str(method_name, context, opts)
        if !method && method_name
          raise Pry::MethodNotFound, "method '#{method_name}' could not be found."
        end
Severity: Minor
Found in lib/pry/helpers/command_helpers.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 rows_to_s has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def rows_to_s(style = :color_on)
        widths = columns.map { |e| _max_width(e) }
        @rows_without_colors.map do |r|
          padded = []
          r.each_with_index do |e, i|
Severity: Minor
Found in lib/pry/helpers/table.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 subclass has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def subclass(match, description, options, helpers, &block)
Severity: Minor
Found in lib/pry/command.rb - About 35 mins to fix

    Method source_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def source_file
          if source_location.nil?
            if source_type == :c
              info = pry_doc_info
              info.file if info
    Severity: Minor
    Found in lib/pry/method.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 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 empty_lookup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def empty_lookup
          return nil if str && !str.empty?
    
          obj = if internal_binding?(target)
                  mod = target_self.is_a?(Module) ? target_self : target_self.class
    Severity: Minor
    Found in lib/pry/code_object.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 indent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def indent(input)
          output = ''
          prefix = indent_level
    
          input.lines.each do |line|
    Severity: Minor
    Found in lib/pry/indent.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(slop, short, long, description, config = {}, &block)
            @slop = slop
            @short = short
            @long = long
            @description = description
    Severity: Minor
    Found in lib/pry/slop/option.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 value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def value
            value = @value.nil? ? config[:default] : @value
    
            return value if [true, false, nil].include?(value) && config[:as].to_s != 'count'
    
    
    Severity: Minor
    Found in lib/pry/slop/option.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 write has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def write(str)
            if invoked_pager?
              write_to_pager str
            else
              @tracker.record str
    Severity: Minor
    Found in lib/pry/pager.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 find_method_in_superclass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def find_method_in_superclass
            guess = method
            return guess if skip_superclass_search?
    
            while guess
    Severity: Minor
    Found in lib/pry/method/weird_method_locator.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

    Severity
    Category
    Status
    Source
    Language