Showing 276 of 365 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 stripe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
stripe: function(tbody_id) {
var even = false;
var rows = this.records_for(tbody_id);
for (var i = 0; i < rows.length; i++) {
var child = rows[i];
- 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_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.datetime_options(locale)
rails_time_format = I18n.translate! 'time.formats.picker', :locale => locale, :default => '%a, %d %b %Y %H:%M:%S'
datetime_picker_options = {
:ampm => false,
:hourText => I18n.translate!('datetime.prompts.hour', :locale => locale),
- 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 links_for_associations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def links_for_associations
return unless active_scaffold_config.actions.include?(:list) && active_scaffold_config.actions.include?(:nested)
active_scaffold_config.columns.each do |column|
next unless column.link.nil? && column.autolink?
# lazy load of action_link, cause it was really slowing down app in dev mode
- 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
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
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 respond_to_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def respond_to_action(action)
return unless !conditional_get_support? || view_stale?
respond_to do |type|
action_formats.each do |format|
type.send(format) do
- 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 replace
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Element.replace = function(element, html) {
element = $(element);
if (element.outerHTML) {
try {
element.outerHTML = html.stripScripts();
- 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
Function read_inplace_edit_heading_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
read_inplace_edit_heading_attributes: function(column_heading, options) {
if (column_heading.readAttribute('data-ie-cancel-text')) options.cancelText = column_heading.readAttribute('data-ie-cancel-text');
if (column_heading.readAttribute('data-ie-loading-text')) options.loadingText = column_heading.readAttribute('data-ie-loading-text');
if (column_heading.readAttribute('data-ie-saving-text')) options.savingText = column_heading.readAttribute('data-ie-saving-text');
if (column_heading.readAttribute('data-ie-save-text')) options.okText = column_heading.readAttribute('data-ie-save-text');
- 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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render(*args, &block)
if self.class.uses_active_scaffold? && params[:adapter] && @rendering_adapter.nil? && request.xhr?
@rendering_adapter = true # recursion control
# if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
opts = args.any? ? args.first : {}
- 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 do_search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def do_search
if search_params.is_a?(String) && search_params.present?
query = search_params.to_s.strip
columns = active_scaffold_config.search.columns.visible_columns
text_search = active_scaffold_config.search.text_search
- 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 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 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 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 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"
Further reading
Method replace_id_params_in_action_link_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_id_params_in_action_link_url(link, record, url)
url = record ? url.sub('--ID--', record.to_param.to_s) : url.clone
if link.column&.association&.singular?
child_id = record.send(link.column.association.name)&.to_param
if child_id.present?
- 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"