Showing 273 of 362 total issues
Method cache_association
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cache_association(association, column, size)
associated_limit = column.associated_limit
# we are not using eager loading, cache firsts records in order not to query the database for whole association in a future
if associated_limit.nil?
logger.warn "ActiveScaffold: Enable eager loading for #{column.name} association to reduce SQL queries"
- 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
Function changeTitle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
changeTitle: function(historyData) {
var winTitle = (historyData && historyData.newTitle
/*Plug the new title into the pattern*/
? this.baseTitle.replace('@@@', historyData.newTitle)
/*Otherwise, if there is no new title, use the original document title. This is useful when some
- 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
Function create_associated_record_form
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
create_associated_record_form: function(element, content, options) {
var element = $(element);
if (options.singular == false) {
if (!(options.id && $(options.id))) {
element.insert(content);
- 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 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 update_view_paths
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_view_paths
last_view_path =
if @lookup_context # rails 6
File.expand_path(File.dirname(File.dirname(@lookup_context.last_template.short_identifier.to_s)), Rails.root)
else
- 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 each
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def each(options = {}, &block)
super(options) do |item|
item = __wrap__(item) || item unless item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
if options[:include_set]
yield item, __getobj__.instance_variable_get(:@set)
- 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 active_scaffold_human_condition_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_human_condition_for(column)
return if (value = field_search_params[column.name.to_s]).nil?
search_ui = column.search_ui
search_ui ||= column.column_type if column.column
if override_human_condition_column?(column)
- 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 parent_sti_controller
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parent_sti_controller
return unless params[:parent_sti]
unless defined? @parent_sti_controller
controller = look_for_parent_sti_controller
@parent_sti_controller = controller.controller_path == params[:parent_sti] ? controller : false
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(action, options = {})
# set defaults
@action = action
@label = action
@confirm = false
- 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 as_marked=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def as_marked=(value)
value = [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)
if value == true
marked_records[id.to_s] = true unless as_marked
else
- 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"
Further reading
Method each
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def each(options = {}, &block)
method = options[:reverse] ? :reverse_each : :each
@set.sort_by(&:weight).send(method) do |item|
if item.is_a?(ActiveScaffold::DataStructures::ActionLinks) && !options[:groups]
item.each(options, &block)
- 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 datetime_from_to_for_trend
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def datetime_from_to_for_trend(column, value)
case value['opt']
when 'PAST'
trend_number = [value['number'].to_i, 1].max
now = datetime_now
- 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 set_sorting_from_order_clause
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_sorting_from_order_clause(order_clause, model_table_name = nil)
clear
order_clause.to_s.split(',').each do |criterion|
if criterion.present?
order_parts = extract_order_parts(criterion)
- 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 active_scaffold_add_existing_input
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_add_existing_input(options)
record = options.delete(:object)
if !ActiveScaffold.js_framework.nil? && controller.respond_to?(:record_select_config, true)
remote_controller = active_scaffold_controller_for(record_select_config.model).controller_path
options[:controller] = remote_controller
- 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 show_blank_record?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show_blank_record?(associated)
return false unless @show_blank_record
return false unless association.klass.authorized_for?(:crud_type => :create) && !association.readonly?
association.collection? || (association.singular? && associated.blank?)
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 []
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def [](val)
links = []
@set.each do |item|
if item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
collected = item[val]
- 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_column_association
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_column_association(parent_record, column, attribute, value)
if belongs_to_counter_cache_hack?(column.association, attribute)
parent_record.send "#{column.association.foreign_key}=", value&.id
parent_record.association(column.name).target = value
elsif column.association.collection? && column.association.through_singular?
- 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 setup_constrained_fields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def setup_constrained_fields
@constrained_fields = [] if association.belongs_to? || association.through?
@constrained_fields ||= Array(association.foreign_key).map(&:to_sym)
return unless child_association && child_association != 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 active_scaffold_input_singular_association
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_input_singular_association(column, html_options, options = {}, ui_options: column.options)
record = html_options.delete(:object)
associated = record.send(column.association.name)
select_options = sorted_association_options_find(column.association, nil, record)
- 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"