whoward/cadenza

View on GitHub
lib/cadenza/source_renderer.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def state=(new_state)
      # if trying to transition to a new state raise an exception
      raise IllegalStateError, new_state unless VALID_STATES.include?(new_state)

      # no special transition for the same state
Severity: Minor
Found in lib/cadenza/source_renderer.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 render_filtered_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def render_filtered_value(node, context, blocks)
      state == :var unless state == :tag

      render(node.value, context, blocks)

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

    def render_operation(node, context, blocks)
      self.state = :var unless state == :tag

      # calculate the operator precedence of the left, right and parent node
      node_precedence  = calculate_precedence(node)
Severity: Minor
Found in lib/cadenza/source_renderer.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

There are no issues that match your filters.

Category
Status