rubocop-hq/rubocop

View on GitHub
lib/rubocop/cop/lint/void.rb

Summary

Maintainability
A
1 hr
Test Coverage
A
100%

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

        def check_var(node)
          return unless node.variable? || node.const_type?

          if node.const_type?
            template = node.special_keyword? ? VAR_MSG : CONST_MSG
Severity: Minor
Found in lib/rubocop/cop/lint/void.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 entirely_literal? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def entirely_literal?(node)
          case node.type
          when :array
            node.each_value.all? { |value| entirely_literal?(value) }
          when :hash
Severity: Minor
Found in lib/rubocop/cop/lint/void.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 check_nonmutating has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def check_nonmutating(node)
          return if !node.send_type? && !node.block_type? && !node.numblock_type?

          method_name = node.method_name
          return unless NONMUTATING_METHODS.include?(method_name)
Severity: Minor
Found in lib/rubocop/cop/lint/void.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

There are no issues that match your filters.

Category
Status