inossidabile/heimdallr-resource

View on GitHub

Showing 5 of 5 total issues

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

      def load
        if @controller.instance_variable_defined? ivar_name
          resource = @controller.instance_variable_get(ivar_name)

          if @restricted && resource
Severity: Minor
Found in lib/heimdallr/resource_implementation.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 authorize_resource has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def authorize_resource(resource)
      return unless resource

      case @controller.params[:action]
      when 'new', 'create'
Severity: Minor
Found in lib/heimdallr/resource_implementation.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 action_type has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def action_type
        if @options[:parent]
          :parent_resource
        else
          case action = @params[:action].to_sym
Severity: Minor
Found in lib/heimdallr/resource_implementation.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 new_resource has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def new_resource(scope, parent_resource)
        attributes = @params[params_key_name] || {}

        if @options[:singleton] && parent_resource
          if scope.nil?
Severity: Minor
Found in lib/heimdallr/resource_implementation.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 resource_scope has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def resource_scope(parent_resource)
        if parent_resource
          if @options[:through_association]
            parent_resource.send @options[:through_association]
          elsif @options[:singleton]
Severity: Minor
Found in lib/heimdallr/resource_implementation.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