Freshly/material

View on GitHub

Showing 2 of 2 total issues

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

      def item_class
        return item_enforcement if item_enforcement.is_a?(Class)

        item_class = superclass.__send__(:item_enforcement) if superclass.respond_to?(:item_enforcement, true)
        return item_class if item_class.present?
Severity: Minor
Found in lib/material/concerns/collection.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 register_path_component has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def register_path_component(key, route_key_method)
        register_component(route_key_method) { try(:model_name)&.public_send(route_key_method) }
        register_component(key) do
          route_key = public_send(route_key_method)
          "#{route_key}_path".to_sym if route_key.present?
Severity: Minor
Found in lib/material/concerns/site.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

Severity
Category
Status
Source
Language