Showing 246 of 296 total issues
Method as_marked=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def as_marked=(value)
if [true, 'true', 1, '1', 'T', 't'].include?(value.respond_to?(:downcase) ? value.downcase : value)
marked_records[id.to_s] = true unless as_marked
else
marked_records.delete(id.to_s)
- 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
Avoid deeply nested control flow statements. Open
if reverse&.singular? && !reverse.belongs_to? && options[:allow_autosave]
record.send(k).send(:"#{reverse.name}=", record)
end
Method add_association_columns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_association_columns(association, *columns)
column = self[association]
raise ArgumentError, "unknown column #{association}" if column.nil?
raise ArgumentError, "column #{association} is not an association" if column.association.nil?
raise ArgumentError, "column #{association} is not singular association" unless 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"
Further reading
Method setup_association_info
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_association_info
assoc = active_record_class.reflect_on_association(name)
@association =
if assoc
if active_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 cache_association_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cache_association_options(association, conditions, klass, cache = true)
if active_scaffold_config.cache_association_options && cache
@_associations_cache ||= Hash.new { |h, k| h[k] = {} }
key = [association.name, association.inverse_klass.name, klass.respond_to?(:cache_key) ? klass.cache_key : klass.name].join('/')
@_associations_cache[key][conditions] ||= yield
- 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_tabs_for
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def active_scaffold_tabs_for(column, record, subsection_id, tab_options, used_tabs)
Method find_template
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_template(name, prefixes = [], partial = false, keys = [], options = {}) # rubocop:disable Metrics, Style
Method active_scaffold_tabbed_by
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def active_scaffold_tabbed_by(column, record, scope, subsection_id, &block)
Method assign_tabbed_by
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def assign_tabbed_by(record, parent_column, tabbed_by, value, value_type)
Method pagination_ajax_links
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def pagination_ajax_links(current_page, url_options, options, inner_window, outer_window)
Method active_scaffold_file_with_content
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def active_scaffold_file_with_content(column, content, options, remove_file_prefix, controls_class)
Method form_attribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def form_attribute(column, record, scope = nil, only_value = false, col_class = nil)
Method active_scaffold_record_select
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def active_scaffold_record_select(record, column, options, value, multiple, ui_options: column.options)
Method usa_state_select
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def usa_state_select(object, method, priority_states = nil, options = {}, html_options = {})
Method active_scaffold_input_for_tabbed
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def active_scaffold_input_for_tabbed(column, record, subsection_id, tab_options, used_tabs)
Method active_scaffold_checkbox_option
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def active_scaffold_checkbox_option(option, label_method, associated_ids, checkbox_options, li_options = {})
Method render_column
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_column(column, record, renders_as, scope = nil, only_value: false, col_class: nil, **subform_locals)
Method update_column_association
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_column_association(parent_record, column, attribute, value, avoid_changes = false)
Method build_active_scaffold_search_range_ui
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_active_scaffold_search_range_ui(operators, from, to = nil, name:, id:, opt_value: nil)
opt_value ||= operators[0][1]
html = select_tag("#{name}[opt]", options_for_select(operators, opt_value),
id: "#{id}_opt", class: 'as_search_range_option')
if to
- 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?
- 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"