nevir/rubocop-rspec

View on GitHub

Showing 18 of 26 total issues

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

        def on_send(node) # rubocop:disable Metrics/MethodLength
          expect_literal(node) do |actual, send_node, matcher, expected|
            next if SKIPPED_MATCHERS.include?(matcher)

            add_offense(actual) do |corrector|
Severity: Minor
Found in lib/rubocop/cop/rspec/expect_actual.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 find_duplicates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def find_duplicates(node)
          setup_expressions = Set.new
          node.each_child_node(:block) do |child|
            next unless common_setup?(child)

Severity: Minor
Found in lib/rubocop/cop/rspec/overwriting_setup.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 check_explicit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def check_explicit(node) # rubocop:disable Metrics/MethodLength
          predicate_matcher_block?(node) do |actual, matcher|
            add_offense(node, message: message_explicit(matcher)) do |corrector|
              to_node = node.send_node
              corrector_explicit(corrector, to_node, actual, matcher, to_node)
Severity: Minor
Found in lib/rubocop/cop/rspec/predicate_matcher.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 check_let_declarations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def check_let_declarations(node)
          first_example = find_first_example(node)
          return unless first_example

          correct = !example_group_with_include_examples?(node)
Severity: Minor
Found in lib/rubocop/cop/rspec/let_before_examples.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 corrector_explicit has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def corrector_explicit(corrector, to_node, actual, matcher, block_child)
Severity: Minor
Found in lib/rubocop/cop/rspec/predicate_matcher.rb - About 35 mins to fix

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

            def on_send(node)
              return if node.chained? || node.each_ancestor(:def, :defs).any?
    
              focus_metadata(node) do |focus|
                add_offense(focus) do |corrector|
    Severity: Minor
    Found in lib/rubocop/cop/rspec/focus.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 on_top_level_group has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_top_level_group(node)
              ivar_usage(node) do |ivar, name|
                next if valid_usage?(ivar)
                next if assignment_only? && !ivar_assigned?(node, name)
    
    
    Severity: Minor
    Found in lib/rubocop/cop/rspec/instance_variable.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_expect_to has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def find_expect_to(node)
              node.each_ancestor.find do |ancestor|
                break if ancestor.block_type?
                next unless ancestor.send_type?
    
    
    Severity: Minor
    Found in lib/rubocop/cop/rspec/unspecified_exception.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 on_send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_send(node)
              return unless inside_example_group?(node)
    
              variable_definition?(node) do |variable|
                return if variable.dstr_type? || variable.dsym_type?
    Severity: Minor
    Found in lib/rubocop/cop/rspec/variable_name.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 on_send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_send(node)
              return if node.parent.block_type? || node.arguments.empty?
              return unless replaceable_arguments?(node)
    
              method_name = node.method_name.to_s
    Severity: Minor
    Found in lib/rubocop/cop/rspec/redundant_predicate_matcher.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 on_send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_send(node)
              return unless inside_example_group?(node)
    
              variable_definition?(node) do |variable|
                next unless style_offense?(variable)
    Severity: Minor
    Found in lib/rubocop/cop/rspec/variable_definition.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 on_block has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
              return if node.each_ancestor(:def, :defs).any?
              return if node.each_ancestor(:block).any? { |block| example?(block) }
    
              example_group_body(node) do |body|
    Severity: Minor
    Found in lib/rubocop/cop/rspec/empty_example_group.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 parent_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def parent_node(node)
              node_or_block = node.block_node || node
              return unless (parent = node_or_block.parent)
    
              parent.begin_type? && parent.parent ? parent.parent : parent
    Severity: Minor
    Found in lib/rubocop/cop/rspec/pending_without_reason.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 on_send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_send(node)
              unverified_double(node) do |name, *_args|
                return if name.nil? && cop_config['IgnoreNameless']
                return if symbol?(name) && cop_config['IgnoreSymbolicNames']
    
    
    Severity: Minor
    Found in lib/rubocop/cop/rspec/verified_doubles.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 on_block has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
              return unless example?(node)
    
              null_double(node) do |var, receiver|
                have_received_usage(node) do |expected|
    Severity: Minor
    Found in lib/rubocop/cop/rspec/instance_spy.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_hooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def check_hooks(node)
              first_example = find_first_example(node)
              return unless first_example
    
              first_example.right_siblings.each do |sibling|
    Severity: Minor
    Found in lib/rubocop/cop/rspec/hooks_before_examples.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 on_top_level_example_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_top_level_example_group(node)
              return unless top_level_groups.one?
    
              example_group_arguments(node) do |send_node, class_name, arguments|
                next if !class_name.const_type? || ignore_metadata?(arguments)
    Severity: Minor
    Found in lib/rubocop/cop/rspec/spec_file_path_format.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 offensive? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def offensive?(body)
              return true unless body
              return false if conditionals_with_examples?(body)
    
              if body.if_type? || body.case_type?
    Severity: Minor
    Found in lib/rubocop/cop/rspec/empty_example_group.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