Showing 273 of 362 total issues
Method mark_respond_to_js
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mark_respond_to_js
if params.delete(:id) # so find_page doesn't filter by :id
do_search if respond_to? :do_search, true
set_includes_for_columns if active_scaffold_config.actions.include? :list
@page = find_page(:pagination => active_scaffold_config.mark.mark_all_mode != :page)
- 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 clonePatternField
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
clonePatternField: function() {
var patternNodes = this.getPatternNodes(this.options.inplacePatternSelector);
if (patternNodes.editNode == null) {
alert('did not find any matching node for ' + this.options.editFieldSelector);
return;
- 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_jquery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def setup_jquery(file, original_js = nil, where: 'ujs')
original_js ||= File.binread(file)
if ActiveScaffold.js_framework == :jquery
unless original_js.include?('require jquery')
insert_into_file file, before: %r{//= require +.*#{where}['"]?\n} 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
Method configure_nested
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configure_nested
return unless nested?
register_constraints_with_action_columns(nested.constrained_fields)
return unless active_scaffold_config.actions.include? :list
active_scaffold_config.list.user.label = nested_label
- 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 where
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def where(opts, *rest)
if opts.present?
opts = opts.with_indifferent_access if opts.is_a? Hash
@conditions << (rest.empty? ? opts : [opts, *rest])
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 datepicker_format_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def datepicker_format_options(column, format)
return {} if format == :default
if column.form_ui == :date_picker
js_format = to_datepicker_format(I18n.translate!("date.formats.#{format}"))
js_format.nil? ? {} : {dateFormat: js_format}
- 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 cached_action_link_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cached_action_link_url(link, record)
@action_links_urls ||= {}
@action_links_urls[link.name_to_cache.to_s] || begin
url_options = cached_action_link_url_options(link, record)
if cache_action_link_url?(link, 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 []
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def [](action_name)
klass = self.class.config_class(action_name)
return unless klass
underscored_name = action_name.to_s.underscore.to_sym
- 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_numeric
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def condition_for_numeric(column, value)
if !value.is_a?(Hash)
['%<search_sql>s = ?', condition_value_for_numeric(column, value)]
elsif ActiveScaffold::Finder::NULL_COMPARATORS.include?(value[:opt])
condition_for_null_type(column, value[:opt])
- 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_or_create_for_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_or_create_for_params(params, parent_column, parent_record)
current = parent_record.send(parent_column.name)
klass = parent_column.association.klass(parent_record)
if params.key? klass.primary_key
record_from_current_or_find(klass, params[klass.primary_key], current)
- 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 form_hidden_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def form_hidden_field(column, record, scope)
options = active_scaffold_input_options(column, scope)
if column.association&.collection?
associated = record.send(column.name)
if associated.blank?
- 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 cache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.cache(kind, key = nil, &block)
unless key
key = kind
kind = :cache
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 sort_collection_by_column
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sort_collection_by_column(collection, column, order)
sorter = column.sort[:method]
collection = collection.sort_by do |record|
value = sorter.is_a?(Proc) ? record.instance_eval(&sorter) : record.instance_eval(sorter.to_s)
value = '' if value.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 active_scaffold_checkbox_option
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_checkbox_option(option, label_method, associated_ids, checkbox_options, li_options = {})
content_tag(:li, li_options) do
option_id = option.is_a?(Array) ? option[1] : option.id
label = option.is_a?(Array) ? option[0] : option.send(label_method)
check_box_tag(checkbox_options[:name], option_id, associated_ids.include?(option_id), checkbox_options) <<
- 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 reverse_match?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reverse_match?(assoc)
return assoc.name == as if as || assoc.polymorphic?
return false if assoc.class_name != inverse_klass&.name
if through?
- 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 association_klass_scoped
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def association_klass_scoped(association, klass, record)
if nested? && nested.through_association? && nested.child_association&.through_reflection == association
# only ActiveRecord associations
if nested.association.through_reflection.collection?
nested_parent_record.send(nested.association.through_reflection.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 _configure_sti
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _configure_sti
return if sti_children.nil?
column = model.inheritance_column
if sti_create_links
columns[column].form_ui ||= :hidden
- 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_radio_option
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_radio_option(option, selected, column, radio_options, ui_options: column.options)
if column.association
label_method = ui_options[:label_method] || :to_label
text = option.send(label_method)
value = option.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 columns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def columns
# we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?
unless defined? @columns
self.columns = @core.columns.collect { |c| c.name if @core.columns._inheritable.include?(c.name) && c.searchable? && c.association.nil? && c.text? }.compact
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 add
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add(column_name, direction = nil)
direction ||= 'ASC'
direction = direction.to_s.upcase
column = get_column(column_name)
raise ArgumentError, "Could not find column #{column_name}" if column.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"