yujinakayama/transpec

View on GitHub
lib/transpec/util.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method const_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def const_name(node)
      return nil if node.nil? || !node.const_type?

      const_names = []
      const_node = node
Severity: Minor
Found in lib/transpec/util.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 each_forward_chained_node has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def each_forward_chained_node(origin_node, mode = nil)
      return to_enum(__method__, origin_node, mode) unless block_given?

      yield origin_node if mode == :include_origin

Severity: Minor
Found in lib/transpec/util.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 each_backward_chained_node has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def each_backward_chained_node(origin_node, mode = nil)
      return to_enum(__method__, origin_node, mode) unless block_given?

      yield origin_node if mode == :include_origin

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

    def chainable_source(node)
      fail "Invalid argument #{node}" unless node.send_type?

      map = node.loc
      source = map.expression.source
Severity: Minor
Found in lib/transpec/util.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 proc_literal? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def proc_literal?(node)
      return false unless node.block_type?

      send_node = node.children.first
      receiver_node, method_name, = *send_node
Severity: Minor
Found in lib/transpec/util.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 block_node_taken_by_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def block_node_taken_by_method(node)
      parent_node = node.parent
      return nil unless parent_node
      return nil unless parent_node.block_type?
      return nil unless parent_node.children.first.equal?(node)
Severity: Minor
Found in lib/transpec/util.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