bbatsov/rubocop

View on GitHub

Showing 669 of 669 total issues

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

        def on_if(node)
          return if node.elsif_conditional?
          return unless offense?(node)

          message = message(node)
Severity: Minor
Found in lib/rubocop/cop/style/redundant_condition.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 autocorrect_numblock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def autocorrect_numblock(corrector, node)
          corrector.replace(node.send_node.loc.selector, 'each_with_object')

          # We don't remove the return value to avoid a clobbering error.
          node.body.each_descendant do |var|
Severity: Minor
Found in lib/rubocop/cop/style/each_with_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 register_offense has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def register_offense(annotation)
          range = annotation_range(annotation)
          message = if annotation.note
                      requires_colon? ? MSG_COLON_STYLE : MSG_SPACE_STYLE
                    else
Severity: Minor
Found in lib/rubocop/cop/style/comment_annotation.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 on_send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_send(node)
          return if (parent = node.parent) && (parent.block_type? || parent.numblock_type?)
          return unless (receiver, argument, method_name = bad_intersection_check?(node))

          message = message(receiver.source, argument.source, method_name)
Severity: Minor
Found in lib/rubocop/cop/style/array_intersect.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 on_block has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_block(node)
          return unless each_block_with_push?(node)

          dest_var = find_dest_var(node)
          return unless (asgn = find_closest_assignment(node, dest_var))
Severity: Minor
Found in lib/rubocop/cop/style/map_into_array.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 positional_rest_arg_same has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def positional_rest_arg_same(def_arg, super_arg)
          return false unless def_arg.restarg_type?
          # anonymous forwarding
          return true if def_arg.name.nil? && super_arg.forwarded_restarg_type?
          return false unless super_arg.splat_type?
Severity: Minor
Found in lib/rubocop/cop/style/super_arguments.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_control_op has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def process_control_op(node)
          cond = node.condition

          control_op_condition(cond) do |first_child, rest_children|
            return if require_parentheses?(node, first_child)
Severity: Minor
Found in lib/rubocop/cop/style/parentheses_around_condition.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 end_of_method_definition? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def end_of_method_definition?(node)
          return false unless (def_node = find_def_node_from_ascendant(node))

          conditional_node = find_conditional_node_from_ascendant(node)
          last_child = find_last_child(def_node.send_type? ? def_node : def_node.body)
Severity: Minor
Found in lib/rubocop/cop/style/double_negation.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 on_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_hash(node)
          return if node.children.first&.kwsplat_type?
          return unless (array = containing_array(node))
          return unless last_array_item?(array, node) && explicit_array?(array)

Severity: Minor
Found in lib/rubocop/cop/style/hash_as_last_array_item.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_blocks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def get_blocks(node, &block)
          case node.type
          when :block, :numblock
            yield node
          when :send
Severity: Minor
Found in lib/rubocop/cop/style/block_delimiters.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 keyword_rest_arg_same? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def keyword_rest_arg_same?(def_arg, super_arg)
          return false unless def_arg.kwrestarg_type?
          # anonymous forwarding
          return true if def_arg.name.nil? && super_arg.forwarded_kwrestarg_type?
          return false unless super_arg.kwsplat_type?
Severity: Minor
Found in lib/rubocop/cop/style/super_arguments.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 on_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_class(class_node)
          @macros_to_rewrite[class_node] = Set.new

          find_macros(class_node.body).each_value do |macros|
            bisected = find_bisection(macros)
Severity: Minor
Found in lib/rubocop/cop/style/bisected_attr_accessor.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 on_begin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_begin(node)
          return if cop_config['AllowAsExpressionSeparator']
          return unless node.source.include?(';')

          exprs = node.children
Severity: Minor
Found in lib/rubocop/cop/style/semicolon.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 on_new_investigation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_new_investigation
          str_ranges = nil

          processed_source.lines.each.with_index(1) do |line, lineno|
            next unless (range = find_offense(line, lineno))
Severity: Minor
Found in lib/rubocop/cop/layout/indentation_style.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 method_receiver_excluded? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def method_receiver_excluded?(node)
          node_receiver = node.receiver&.source&.gsub(/\s+/, '')
          node_method = String(node.method_name)

          allowed_methods.any? do |config|
Severity: Minor
Found in lib/rubocop/cop/metrics/block_length.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 inspect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def inspect(node, block_argument_node, condition_node, return_value_node, range)
          return unless returns_block_argument?(block_argument_node, return_value_node)
          return if condition_node.parent.elsif?

          method = truthy_branch?(return_value_node) ? 'select' : 'reject'
Severity: Minor
Found in lib/rubocop/cop/style/map_compact_with_conditional_block.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 on_regexp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_regexp(node)
          message = if slash_literal?(node)
                      MSG_USE_PERCENT_R unless allowed_slash_literal?(node)
                    else
                      MSG_USE_SLASHES unless allowed_percent_r_literal?(node)
Severity: Minor
Found in lib/rubocop/cop/style/regexp_literal.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 on_send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def on_send(node) # rubocop:disable Metrics/CyclomaticComplexity
          return unless node.bare_access_modifier? &&
                        !(node.parent&.block_type? || node.parent&.numblock_type?)
          return if expected_empty_lines?(node)

Severity: Minor
Found in lib/rubocop/cop/layout/empty_lines_around_access_modifier.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(severity, location, message, cop_name, # rubocop:disable Metrics/ParameterLists
                     status = :uncorrected, corrector = nil)
Severity: Minor
Found in lib/rubocop/cop/offense.rb - About 45 mins to fix

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

            def invertible?(node)
              case node.type
              when :begin
                invertible?(node.children.first)
              when :send
    Severity: Minor
    Found in lib/rubocop/cop/style/invertible_unless_condition.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