actionpack/lib/action_controller/metal/strong_parameters.rb

Summary

Maintainability
F
3 days
Test Coverage

Class Parameters has 76 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Parameters
    include ActiveSupport::DeepMergeable

    cattr_accessor :permit_all_parameters, instance_accessor: false, default: false

Severity: Major
Found in actionpack/lib/action_controller/metal/strong_parameters.rb - About 1 day to fix

    File strong_parameters.rb has 556 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "active_support/core_ext/hash/indifferent_access"
    require "active_support/core_ext/array/wrap"
    require "active_support/core_ext/string/filters"
    require "active_support/core_ext/object/to_query"
    require "active_support/deep_mergeable"
    Severity: Major
    Found in actionpack/lib/action_controller/metal/strong_parameters.rb - About 1 day to fix

      Method hash_filter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

            def hash_filter(params, filter)
              filter = filter.with_indifferent_access
      
              # Slicing filters out non-declared keys.
              slice(*filter.keys).each do |key, value|
      Severity: Minor
      Found in actionpack/lib/action_controller/metal/strong_parameters.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 permitted_scalar_filter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def permitted_scalar_filter(params, permitted_key)
              permitted_key = permitted_key.to_s
      
              if has_key?(permitted_key) && permitted_scalar?(self[permitted_key])
                params[permitted_key] = self[permitted_key]
      Severity: Minor
      Found in actionpack/lib/action_controller/metal/strong_parameters.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 convert_parameters_to_hashes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def convert_parameters_to_hashes(value, using, &block)
              case value
              when Array
                value.map { |v| convert_parameters_to_hashes(v, using) }
              when Hash
      Severity: Minor
      Found in actionpack/lib/action_controller/metal/strong_parameters.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

      Method _deep_transform_keys_in_object! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def _deep_transform_keys_in_object!(object, &block)
              case object
              when Hash
                object.keys.each do |key|
                  value = object.delete(key)
      Severity: Minor
      Found in actionpack/lib/action_controller/metal/strong_parameters.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

      Method _deep_transform_keys_in_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def _deep_transform_keys_in_object(object, &block)
              case object
              when Hash
                object.each_with_object(self.class.new) do |(key, value), result|
                  result[yield(key)] = _deep_transform_keys_in_object(value, &block)
      Severity: Minor
      Found in actionpack/lib/action_controller/metal/strong_parameters.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