activescaffold/active_scaffold

View on GitHub
lib/active_scaffold/helpers/controller_helpers.rb

Summary

Maintainability
B
5 hrs
Test Coverage
D
60%

Method params_for has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def params_for(options = {})
        unless @params_for
          @params_for = {}
          params.except(*BLACKLIST_PARAMS).each do |key, value|
            @params_for[key.to_sym] = copy_param(value)
Severity: Minor
Found in lib/active_scaffold/helpers/controller_helpers.rb - About 2 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_parent_action has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def render_parent_action
        if @parent_action.nil?
          @parent_action = :row
          if parent_sti_controller
            parent_sti_config = parent_sti_controller.active_scaffold_config
Severity: Minor
Found in lib/active_scaffold/helpers/controller_helpers.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 build_associated has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def build_associated(association, parent_record)
        if association.through? && association.through_reflection.collection?
          # build full chain, only check create_associated on initial parent_record
          parent_record = build_associated(association.class.new(association.through_reflection), parent_record)
          source_assoc = association.class.new(association.source_reflection)
Severity: Minor
Found in lib/active_scaffold/helpers/controller_helpers.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 main_path_to_return has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def main_path_to_return
        if params[:return_to]
          params[:return_to]
        else
          exclude_parameters = %i[utf8 associated_id]
Severity: Minor
Found in lib/active_scaffold/helpers/controller_helpers.rb - About 55 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