Showing 277 of 366 total issues
Method active_scaffold_new_record_subform
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_new_record_subform(column, record, html_options, ui_options: column.options, new_record_attributes: nil, locals: {}, skip_link: false)
klass =
if column.association.polymorphic? && column.association.belongs_to?
type = record.send(column.association.foreign_type)
column.association.klass(record) if type.present? && (ui_options[:add_new] == true || type.in?(ui_options[:add_new]))
- 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 find_page
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def find_page(options = {})
options.assert_valid_keys :sorting, :per_page, :page, :count_includes, :pagination, :select
options[:per_page] ||= 999_999_999
options[:page] ||= 1
- 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 default_select_columns
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def default_select_columns
if association.nil? && column
[field]
elsif association&.polymorphic?
[field, quoted_field(quoted_field_name(association.foreign_type))]
- 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 get_action_link_id
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_action_link_id(link, record = nil)
column = link.column
if column&.association && record
associated = record.send(column.association.name) unless column.association.collection?
id =
- 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_radio
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def active_scaffold_input_radio(column, html_options, ui_options: column.options)
record = html_options[:object]
html_options.merge!(ui_options[:html_options] || {})
options =
if column.association
Method column_numerical_constraints
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def column_numerical_constraints(column, options)
validators = column.active_record_class.validators.select do |v|
v.is_a?(ActiveModel::Validations::NumericalityValidator) &&
v.attributes.include?(column.name) &&
!v.options[:if] && !v.options[:unless]
Method condition_for_column
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def condition_for_column(column, value, text_search, session)
like_pattern = like_pattern(text_search)
value = value.with_indifferent_access if value.is_a? Hash
column_method = "condition_for_#{column.name}_column"
if respond_to?(column_method)
Method initialize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(name, active_record_class, delegated_association = nil) #:nodoc:
@name = name.to_sym
@active_record_class = active_record_class
@column = _columns_hash[name.to_s]
if @column.nil? && active_record? && active_record_class._default_attributes.key?(name.to_s)
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 look_for_parent_sti_controller
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def look_for_parent_sti_controller
klass = self.class.active_scaffold_config.model
loop do
klass = klass.superclass
controller = self.class.active_scaffold_controller_for(klass)
- 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 keeping_errors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def keeping_errors
old_errors = errors.dup if errors.present?
result = yield
old_errors&.each do |e|
if e.is_a?(String) || e.is_a?(Symbol)
- 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 update_column
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
update_column: function(element, url, send_form, source_id, val, additional_params) {
if (!element) element = $(source_id);
var as_form = element.up('form.as_form');
var params = null;
- 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 target_scope
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def target_scope
super.tap do |scope|
if klass < ActiveScaffold::Tableless
class << scope; include RelationExtension; end
assoc_conditions = scope.proxy_association&.send(:association_scope)&.conditions
- 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_field_search
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def do_field_search
filtered_columns = []
text_search = active_scaffold_config.field_search.text_search
columns = active_scaffold_config.field_search.columns
search_params.each do |key, value|
- 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_field_for_update_columns
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def render_field_for_update_columns
return if (@column = active_scaffold_config.columns[params.delete(:column)]).nil?
@source_id = params.delete(:source_id)
@columns = @column.update_columns || []
@scope = params.delete(:scope)
- 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_bitfields
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _setup_bitfields
return unless model.respond_to?(:bitfields) && model.bitfields.present?
model.bitfields.each do |column_name, options|
columns = options.keys.sort_by { |column| self.columns[column].weight }
%i[create update show subform].each do |action|
- 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 attributes_hash_is_empty?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def attributes_hash_is_empty?(hash, klass)
hash.all? do |key, value|
# convert any possible multi-parameter attributes like 'created_at(5i)' to simply 'created_at'
column_name = key.to_s.split('(', 2)[0]
- 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_value_for_numeric
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def condition_value_for_numeric(column, value)
return value if value.nil?
value = column.number_to_native(value) if column.options[:format] && column.search_ui != :number
case (column.search_ui || column.column_type)
when :integer then
- 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_for_datetime
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def condition_for_datetime(column, value, like_pattern = nil)
operator = ActiveScaffold::Finder::NUMERIC_COMPARATORS.include?(value['opt']) && value['opt'] != 'BETWEEN' ? value['opt'] : nil
from_value, to_value = datetime_from_to(column, value)
if column.search_sql.is_a? Proc
- 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_from_params
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_column_from_params(parent_record, column, attribute, avoid_changes = false)
value = column_value_from_param_value(parent_record, column, attribute, avoid_changes)
if column.association
if avoid_changes
parent_record.association(column.name).target = value
- 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"