Method update_save
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_save(attributes: params[:record], no_record_param_update: false)
active_scaffold_config.model.transaction do
unless no_record_param_update
@record = update_record_from_params(@record, active_scaffold_config.update.columns, attributes)
end
- 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 update_save
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_save(attributes: params[:record], no_record_param_update: false)
active_scaffold_config.model.transaction do
unless no_record_param_update
@record = update_record_from_params(@record, active_scaffold_config.update.columns, attributes)
end
Method record_for_update_column
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def record_for_update_column
@record = find_if_allowed(params[:id], :read)
return unless @record.authorized_for?(:crud_type => :update, :column => @column.name)
if @column.delegated_association
- 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 do_update_column
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def do_update_column
# delete from params so update :table won't break urls, also they shouldn't be used in sort links too
value = params.delete(:value)
column = params.delete(:column)
params.delete(:original_html)
- 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 update_respond_to_js
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_respond_to_js
if successful?
record_to_refresh_on_update if !render_parent? && active_scaffold_config.actions.include?(:list)
flash.now[:info] = as_(:updated_model, :model => ERB::Util.h((@updated_record || @record).to_label)) if active_scaffold_config.update.persistent
end
- 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 value_for_update_column
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def value_for_update_column(param_value, column, record)
unless param_value
param_value = ActiveScaffold::Core.column_type_cast column.default_for_empty_value, column.column
param_value = false if param_value == true
end
- 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"