Method apply_constraints_to_record
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def apply_constraints_to_record(record, options = {})
options[:allow_autosave] = false if options[:allow_autosave].nil?
constraints = options[:constraints] || active_scaffold_constraints
config = record.is_a?(active_scaffold_config.model) ? active_scaffold_config : active_scaffold_config_for(record.class)
- 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 conditions_from_constraints
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def conditions_from_constraints
hash_conditions = {}
conditions = [hash_conditions]
active_scaffold_constraints.each do |k, v|
column = active_scaffold_config.columns[k]
- 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 register_constraints_with_action_columns
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def register_constraints_with_action_columns(constrained_fields = nil)
constrained_fields ||= []
constrained_fields |= active_scaffold_constraints.select { |k, v| register_constraint?(k, v) }.keys.collect(&:to_sym)
exclude_actions = []
%i[list update].each do |action_name|
- 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 condition_from_association_constraint
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def condition_from_association_constraint(association, value)
# when the reverse association is a :belongs_to, the id for the associated object only exists as
# the primary_key on the other table. so for :has_one and :has_many (when the reverse is :belongs_to),
# we have to use the other model's primary_key.
#
- 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 register_constraint?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def register_constraint?(column_name, value)
if params_hash?(value)
false
elsif value.is_a?(Array)
column = active_scaffold_config.columns[column_name]
- 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"