Showing 284 of 371 total issues
Method active_scaffold_input_radio
has a Cognitive Complexity of 19 (exceeds 5 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
- 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 18 (exceeds 5 allowed). Consider refactoring. Open
get: function(element) {
if (typeof(element) == 'string') element = '#' + element;
var element = jQuery(element);
if (element.length > 0) {
element.data(); // $ 1.4.2 workaround
- 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_options_find
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def association_options_find(association, conditions = nil, klass = nil, record = nil)
if klass.nil? && association.polymorphic?
class_name = record.send(association.foreign_type) if association.belongs_to?
return [] if class_name.blank?
klass = class_name.constantize
- 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 process_action_link_action
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def process_action_link_action(render_action = :action_update, crud_type_or_security_options = nil)
if request.get? || request.head?
# someone has disabled javascript, we have to show confirmation form first
@record = find_if_allowed(params[:id], :read) if params[:id]
respond_to_action(:action_confirmation)
- 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 params_for
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def params_for(options = {})
unless @params_for
@params_for = {}
params.except(*BLACKLIST_PARAMS).each do |key, value|
@params_for[key.to_sym] = copy_param(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 active_scaffold_controller_for
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.active_scaffold_controller_for(klass, controller_namespace = '::')
error_message = []
class_names = [klass.to_s, klass.to_s.demodulize].map { |k| k.underscore.pluralize }.map { |k| [k, k.singularize] }.flatten
[controller_namespace, ''].each do |namespace|
class_names.each do |controller_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 active_scaffold_render_subform_column
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_render_subform_column(column, scope, crud_type, readonly, add_class = false, record = nil) # rubocop:disable Metrics/ParameterLists
if add_class
col_class = []
col_class << 'required' if column.required?(action_for_validation?(record))
col_class << column.css_class unless column.css_class.nil? || column.css_class.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 clause
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def clause(grouped_columns_calculations = nil)
return nil if sorts_by_method? || default_sorting?
# unless the sorting is by method, create the sql string
order = []
- 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
File core.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveScaffold::Config
# to fix the ckeditor bridge problem inherit from full class name
class Core < ActiveScaffold::Config::Base
include ActiveScaffold::OrmChecks
# global level configuration
File list.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveScaffold::Actions
module List
def self.included(base)
base.before_action :list_authorized_filter, :only => :index
base.helper_method :list_columns, :count_on_association_class?
dhtmlHistory
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
window.dhtmlHistory = {
/*Public: User-agent booleans*/
isIE: false,
isOpera: false,
Function update_column
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
update_column: function(element, url, send_form, source_id, val, additional_params) {
if (!element) element = jQuery('#' + source_id);
var as_form = element.closest('form.as_form');
var params = null;
Method update_columns_options
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_columns_options(column, scope, options, force = false, form_columns: nil, url_params: {})
record = options[:object]
subform_controller = controller.class.active_scaffold_controller_for(record.class) if scope
if @main_columns && (scope.nil? || subform_controller == controller.class)
form_columns ||= @main_columns.visible_columns_names
- 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_column
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def condition_for_column(column, value, text_search = :full)
like_pattern = like_pattern(text_search)
value = value.with_indifferent_access if value.is_a? Hash
if respond_to?("condition_for_#{column.name}_column")
return send("condition_for_#{column.name}_column", column, value, like_pattern)
- 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_attribute
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def form_attribute(column, record, scope = nil, only_value = false, col_class = nil)
column_options = active_scaffold_input_options(column, scope, :object => record)
collapsible_id = column_options.delete :collapsible_id
attributes = field_attributes(column, record)
attributes[:class] = "#{attributes[:class]} #{col_class}" if col_class.present?
- 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 format_for_datetime
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def format_for_datetime(column, value)
parts = Date._parse(value)
if ActiveScaffold.js_framework == :jquery
format = I18n.translate "time.formats.#{column.options[:format] || :picker}", :default => ''
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 active_scaffold_error_messages_for
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def active_scaffold_error_messages_for(*params)
options = params.extract_options!.symbolize_keys
options.reverse_merge!(:container_tag => :div, :list_type => :ul)
objects = Array.wrap(options.delete(:object) || params).map do |object|
Method columns_reader
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.columns_reader(name, options, &block)
var = "@#{name}"
define_method name do
unless instance_variable_defined?(var) # lazy evaluation
action, columns = options[:copy] if options[:copy]
- 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 action_link_url_options
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def action_link_url_options(link, record)
url_options = {:action => link.action}
url_options[:id] = '--ID--' unless record.nil?
url_options[:controller] = link.controller.to_s if link.controller
url_options.merge! link.parameters if link.parameters
- 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 sorting
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def sorting
if @_sorting.nil?
# we want to store as little as possible in the session, but we want to return a Sorting data structure. so we recreate it each page load based on session data.
self['sort'] = [@params['sort'], @params['sort_direction']] if @params['sort'] && @params['sort_direction']
self['sort'] = nil if @params['sort_direction'] == 'reset'
- 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"