Showing 276 of 365 total issues
Method active_scaffold_search_calendar_date_select_field
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_search_calendar_date_select_field(column, options, current_search, name, ui_options: column.options)
value =
if current_search.is_a? Hash
controller.class.condition_value_for_datetime(column, current_search[name], column.column_type == :date ? :to_date : :to_time)
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 get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
get: function(element) {
var element = $(element);
if (typeof(element.retrieve('action_link')) === 'undefined' && !element.hasClassName('as_adapter')) {
var parent = element.up('.actions');
if (typeof(parent) === 'undefined') {
- 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_record_select
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_record_select(record, column, options, value, multiple, ui_options: column.options)
unless column.association
raise ArgumentError, "record_select can only work against associations (and #{column.name} is not). "\
'A common mistake is to specify the foreign key field (like :user_id), instead of the association (:user).'
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_create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def do_create(options = {})
attributes = options[:attributes] || params[:record]
active_scaffold_config.model.transaction do
@record = new_model
# before assign params, to set foreign_type of constraints in polymorphic association with multiple 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
Function setup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
setup: function(options) {
/*
options - object to store initialization parameters - passed in from dhtmlHistory or directly into historyStorage
options.debugMode - boolean that causes hidden form fields to be shown for development purposes.
- 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_defaults_for_column
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def setup_defaults_for_column
if active_record_class.respond_to?(:defined_enums) && active_record_class.defined_enums[name.to_s]
@form_ui = :select
@options = {:options => active_record_class.send(name.to_s.pluralize).keys.map(&:to_sym)}
elsif column_number?
- 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 in_subform?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def in_subform?(column, parent_record, parent_column)
return true unless column.association
if column.association.reverse.nil?
# Polymorphic associations can't appear because they *might* be the reverse 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 add_query_string_to_cached_url
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_query_string_to_cached_url(link, url)
query_string, non_nested_query_string = query_string_for_action_links(link)
nested_params = (!link.nested_link? && non_nested_query_string)
if query_string || nested_params
url << (url.include?('?') ? '&' : '?')
- 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 subgroup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def subgroup(name, label = nil)
group = self if name == self.name
group ||= @set.find do |item|
name == item.name if item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
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 columns_from_constraint
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def columns_from_constraint(column_name, value)
return if params_hash?(value)
if value.is_a?(Array)
column = active_scaffold_config.columns[column_name]
if column&.association&.polymorphic?
- 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 add_link
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_link(attribute, options = {})
column = @core.columns[attribute.to_sym]
raise ArgumentError, "unknown column #{attribute}" if column.nil?
raise ArgumentError, "column #{attribute} is not an association" if column.association.nil?
- 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_record_from_params
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_record_from_params(parent_record, columns, attributes, avoid_changes = false)
crud_type = parent_record.new_record? ? :create : :update
return parent_record unless parent_record.authorized_for?(:crud_type => crud_type)
multi_parameter_attrs = multi_parameter_attributes(attributes)
- 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 handleSaveEditor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSaveEditor: function(anEvent) {
if (false === this.triggerDelegateCall('shouldCloseEditInPlace', true, anEvent))
return;
var editor = this.dom.find('[name]:input:not(:button,[name=""])').not('input:checkbox:not(:checked)').not('input:radio:not(:checked)');
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 active_scaffold_new_record_subform
has 26 lines of code (exceeds 25 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]))
Method updated_record_with_form
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def updated_record_with_form(columns, attributes, scope)
if attributes && scope
attributes = scope.delete('[').split(']').inject(attributes) { |h, idx| h[idx] }
id = attributes[:id]
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 grouped_sorting
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def grouped_sorting(group_sql)
return unless search_group_column && active_scaffold_config.list.user.sorting
group_sort = search_group_function ? group_sql : search_group_column.sort[:sql] if search_group_column.sortable?
grouped_columns = grouped_columns_calculations.merge(search_group_column.name => group_sort)
sorting = active_scaffold_config.list.user.sorting.clause(grouped_columns)
- 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 date_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.date_options(locale)
date_picker_options = {
:closeText => as_(:close),
:prevText => as_(:previous),
:nextText => as_(:next),
- 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 column_heading_value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def column_heading_value(column, sorting, sort_direction)
if column.name == :as_marked
mark_column_heading
elsif column.sortable?
options = {:id => nil, :class => 'as_sort',
- 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 updated_record_with_column
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def updated_record_with_column(column, value, scope)
record = params[:id] ? copy_attributes(find_if_allowed(params[:id], :read)) : new_model
apply_constraints_to_record(record) unless scope || params[:id]
create_association_with_parent record, true if nested?
if @form_action == :field_search && value.is_a?(Array) && column.association&.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"