Showing 276 of 365 total issues
File search_column_helpers.rb
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveScaffold
module Helpers
# Helpers that assist with the rendering of a Form Column
module SearchColumnHelpers
# This method decides which input to use for the given column.
Method active_scaffold_render_input
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_render_input(column, options)
record = options[:object]
# first, check if the dev has created an override for this specific field
if (method = override_form_field(column))
- 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
Class Tableless
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
class AssociationScope < ActiveRecord::Associations::AssociationScope
INSTANCE = create
def self.scope(association, connection)
INSTANCE.scope association, connection
Class Core
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Core < ActiveScaffold::Config::Base
include ActiveScaffold::OrmChecks
# global level configuration
# --------------------------
Method active_scaffold
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold(model_id = nil, &block)
extend Prefixes
# initialize bridges here
ActiveScaffold::Bridges.run_all
- 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 pagination_ajax_links
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def pagination_ajax_links(current_page, url_options, options, inner_window, outer_window)
start_number = current_page.number - inner_window
end_number = current_page.number + inner_window
start_number = 1 if start_number <= 0
if current_page.pager.infinite?
- 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
Class Sorting
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Sorting
include Enumerable
include ActiveScaffold::OrmChecks
attr_accessor :constraint_columns
Method action_link_html_options
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def action_link_html_options(link, record, options)
link_id = get_action_link_id(link, record)
html_options = link.html_options.merge(:class => [link.html_options[:class], link.action.to_s].compact.join(' '))
html_options[:link] = action_link_text(link, record, 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
Function in_place_editor_field_clicked
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
in_place_editor_field_clicked: function(span) {
// test editor is open
if (typeof(span.data('editInPlace')) === 'undefined') {
var options = {show_buttons: true,
hover_class: 'hover',
Method active_scaffold_search_for
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_search_for(column, options = nil)
options ||= active_scaffold_search_options(column)
search_columns = active_scaffold_config.field_search.columns.visible_columns_names
options = update_columns_options(column, nil, options, form_columns: search_columns, url_params: {form_action: :field_search})
record = options[:object]
- 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 display_action_link
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def display_action_link(link, content, record, options)
if content
html_classes = hover_via_click? ? 'hover_click ' : ''
if (options[:level]).zero?
html_classes << 'action_group'
- 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 link_for_association
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def link_for_association(column, options = {})
return if (controller = active_scaffold_controller_for_column(column, options)).nil?
options.reverse_merge! :position => :after, :type => :member, :column => column,
:controller => (controller == :polymorph ? controller : "/#{controller.controller_path}")
options[: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 clause
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def clause(grouped_columns = 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
Class ActionLink
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class ActionLink
NO_OPTIONS = {}.freeze
# provides a quick way to set any property of the object from a hash
def initialize(action, options = {})
Method display_action_links
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def display_action_links(action_links, record, options, &block)
options[:level_0_tag] ||= nil
options[:options_level_0_tag] ||= nil
options[:level] ||= 0
options[:first_action] = true
- 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 authorized_for?
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def authorized_for?(options = {})
raise ArgumentError, "unknown crud type #{options[:crud_type]}" if options[:crud_type] && !%i[create read update delete].include?(options[:crud_type])
not_authorized_reason = ActiveRecordPermissions.not_authorized_reason
# collect other possibly-related methods that actually exist
- 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 create
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: function(options) {
/*
options - object to store initialization parameters
options.blankURL - string to override the default location of blank.html. Must end in "?"
Method active_scaffold_search_select
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_search_select(column, html_options, options = {}, ui_options: column.options)
record = html_options.delete(:object)
associated = html_options.delete :value
if column.association
associated = associated.is_a?(Array) ? associated.map(&:to_i) : associated.to_i unless associated.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_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
Method condition_for_range
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def condition_for_range(column, value, like_pattern = nil)
if !value.is_a?(Hash)
if column.text?
value = column.active_record? ? column.active_record_class.sanitize_sql_like(value) : value
["%<search_sql>s #{ActiveScaffold::Finder.like_operator} ?", like_pattern.sub('?', 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"