Showing 374 of 374 total issues
Method active_scaffold_column_boolean
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_column_boolean(record, column, ui_options: column.options)
value = record.send(column.name)
if value.nil? && ui_options[:include_blank]
value = ui_options[:include_blank]
value.is_a?(Symbol) ? as_(value) : 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 should_respond_to_parent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.should_respond_to_parent(description = nil, &block)
should "respond to parent #{description}" do
script = block ? instance_eval(&block) : /.*/
script = script.is_a?(Regexp) ? script.source : Regexp.quote(script)
script = script.gsub('\n', '\\\\\\n')
- 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 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 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 insert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
insert: function(content) {
this.close_previous_adapter();
if (this.position == 'replace') {
this.position = 'after';
- 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_record_column_type_cast
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.active_record_column_type_cast(value, column_or_type)
return Time.zone.at(value.to_i) if value =~ /\A\d+\z/ && %i[time datetime].include?(column_or_type.type)
cast_type = column_or_type.is_a?(ActiveRecord::ConnectionAdapters::Column) ? ActiveRecord::Type.lookup(column_or_type.type) : column_or_type
cast_type ? cast_type.cast(value) : value
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
Function render_form_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render_form_field: function(source, content, options) {
var source = $(source);
var element = source.up('.association-record'), selector = '';
if (typeof(element) === 'undefined') {
element = source.up('ol.form');
- 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 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 active_scaffold_search_multi_select
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_search_multi_select(column, options, ui_options: column.options)
record = options.delete(:object)
associated = options.delete :value
associated = [associated].compact unless associated.is_a? Array
- 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_text_editor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_input_text_editor(column, options, ui_options: column.options)
options[:class] = "#{options[:class]} mceEditor #{ui_options[:class]}".strip
settings = tinymce_configuration(ui_options[:tinymce_config] || :default).options
.reject { |k, _v| k == 'selector' }
- 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 except
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def except(*skips)
super.tap do |new_relation|
unless new_relation.is_a?(RelationExtension)
class << new_relation; include RelationExtension; end
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 override_helper
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def override_helper(column, suffix)
ActiveScaffold::Registry.cache suffix, column.cache_key do
method_with_class = override_helper_name(column, suffix, true)
if respond_to?(method_with_class)
method_with_class
- 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 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"
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 columns_accessor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.columns_accessor(*names, &block)
options = names.extract_options!
self.columns_collections = ((columns_collections || []) + names).uniq
names.each do |name|
columns_writer 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 estimate_weight
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def estimate_weight
if association&.singular?
400
elsif association&.collection?
500
- 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_color
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_input_color(column, options, ui_options: column.options)
html = []
options = active_scaffold_input_text_options(options)
if column.null?
no_color = options[:object].send(column.name).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"