Method fields_for
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fields_for(association, record_object = nil, options = {}, &block)
#Inherit the native parameters adjustment
options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options?
return super(association, record_object, options, &block) unless options.delete(:dynamic)
- 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 remove_fields_link
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def remove_fields_link(label, options = {})
anchor_options = {}.tap do |mem|
if @options.has_key?(:dynamic_fields_id)
mem[:remove] = @options[:dynamic_fields_id]
mem['remove-id'] = @object.id if @object.try(:persisted?)
- 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 dynamic_fields_data_options
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def dynamic_fields_data_options(anchor_options)
return nil if anchor_options.nil?
anchor_options.inject({data: {}}) do |mem, (key, value)|
mem[:data][:"dynamic-fields-#{key}"] = value.html_safe? ? value : value.html_safe
- 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"