actionview/lib/action_view/renderer/abstract_renderer.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method local_variable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def local_variable(path)
          if as = @options[:as]
            raise_invalid_option_as(as) unless /\A[a-z_]\w*\z/.match?(as.to_s)
            as.to_sym
          else
Severity: Minor
Found in actionview/lib/action_view/renderer/abstract_renderer.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 merge_prefix_into_object_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def merge_prefix_into_object_path(prefix, object_path)
          if prefix.include?(?/) && object_path.include?(?/)
            prefixes = []
            prefix_array = File.dirname(prefix).split("/")
            object_path_array = object_path.split("/")[0..-3] # skip model dir & partial
Severity: Minor
Found in actionview/lib/action_view/renderer/abstract_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 partial_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def partial_path(object, view)
          object = object.to_model if object.respond_to?(:to_model)

          path = if object.respond_to?(:to_partial_path)
            object.to_partial_path
Severity: Minor
Found in actionview/lib/action_view/renderer/abstract_renderer.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