antulik/pagelet_rails

View on GitHub
lib/action_controller/caching/actions.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

        def around(controller)
          cache_layout = @cache_layout.respond_to?(:call) ? @cache_layout.call(controller) : @cache_layout

          path_options = if @cache_path.is_a?(Proc)
            controller.instance_exec(controller, &@cache_path)
Severity: Minor
Found in lib/action_controller/caching/actions.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 expire_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def expire_action(options = {})
        return unless cache_configured?

        if options.is_a?(Hash) && options[:action].is_a?(Array)
          options[:action].each { |action| expire_action(options.merge(action: action)) }
Severity: Minor
Found in lib/action_controller/caching/actions.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