actionview/lib/action_view/render_parser/prism_render_parser.rb

Summary

Maintainability
C
1 day
Test Coverage

Method render_calls has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

      def render_calls
        queue = [Prism.parse(@code).value]
        templates = []

        while (node = queue.shift)
Severity: Minor
Found in actionview/lib/action_view/render_parser/prism_render_parser.rb - About 4 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_call_options has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        def render_call_options(node)
          # We are only looking for calls to render or render_to_string.
          name = node.name.to_sym
          return if name != :render && name != :render_to_string

Severity: Minor
Found in actionview/lib/action_view/render_parser/prism_render_parser.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 render_call_options has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def render_call_options(node)
          # We are only looking for calls to render or render_to_string.
          name = node.name.to_sym
          return if name != :render && name != :render_to_string

Severity: Minor
Found in actionview/lib/action_view/render_parser/prism_render_parser.rb - About 1 hr to fix

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

            def render_call_template(node)
              object_template = false
              template =
                if node.is_a?(Prism::StringNode)
                  path = node.unescaped
    Severity: Minor
    Found in actionview/lib/action_view/render_parser/prism_render_parser.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

    Avoid too many return statements within this method.
    Open

              return if (keys - ALL_KNOWN_KEYS).any?
    Severity: Major
    Found in actionview/lib/action_view/render_parser/prism_render_parser.rb - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status