Class PermittedParams
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
class PermittedParams
# This class intends to provide a method for all params hashes coming from the
# client and that are used for mass assignment.
#
# A method should look like the following:
Method permitted_attributes
has 190 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.permitted_attributes
@whitelisted_params ||= begin
params = {
attribute_help_text: %i(
type
File permitted_params.rb
has 469 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'permitted_params/allowed_settings'
class PermittedParams
# This class intends to provide a method for all params hashes coming from the
# client and that are used for mass assignment.
Method custom_field_values
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def custom_field_values(key, required: true)
# a hash of arbitrary values is not supported by strong params
# thus we do it by hand
object = required ? params.require(key) : params.fetch(key, {})
values = object[:custom_field_values] || ActionController::Parameters.new
- Read upRead up
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 enumerations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def enumerations
acceptable_params = %i[active is_default move_to name reassign_to_i
parent_id custom_field_values reassign_to_id]
whitelist = ActionController::Parameters.new
- Read upRead up
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 user_create_as_admin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def user_create_as_admin(external_authentication,
change_password_allowed,
additional_params = [])
additional_params << :auth_source_id unless external_authentication
- Read upRead up
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"