Showing 277 of 366 total issues
Method pagination_ajax_links
has 46 lines of code (exceeds 25 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?
Method get_column_value
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_column_value(record, column)
record = record.send(column.delegated_association.name) if column.delegated_association
if record
method, list_ui = get_column_method(record, column)
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
Function create_record_row
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
create_record_row: function(active_scaffold_id, html, options) {
tbody = $(active_scaffold_id).down('tbody.records');
var new_row = null;
- 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_parent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def setup_parent(record)
cfg = main_form_controller.active_scaffold_config
association = cfg.columns[subform_child_association]&.association&.reverse_association
return if association.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 authorized_for?
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def authorized_for?(options = {})
raise InvalidArgument if options[:crud_type].blank? && options[:action].blank?
if current_ability.present?
crud_type_result = options[:crud_type].nil? ? true : current_ability.can?(options[:crud_type], self)
action_result = options[:action].nil? ? true : current_ability.can?(options[:action].to_sym, self)
- 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 render_list_column
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def render_list_column(text, column, record)
if column.link && !skip_action_link?(column.link, record)
link = column.link
associated = record.send(column.association.name) if column.association
authorized = link.action.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 condition_from_association_constraint
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def condition_from_association_constraint(association, value)
# when the reverse association is a :belongs_to, the id for the associated object only exists as
# the primary_key on the other table. so for :has_one and :has_many (when the reverse is :belongs_to),
# we have to use the other model's primary_key.
#
- 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 initialize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name, active_record_class, delegated_association = nil) #:nodoc:
@name = name.to_sym
@active_record_class = active_record_class
@column = _columns_hash[name.to_s]
if @column.nil? && active_record? && active_record_class._default_attributes.key?(name.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
Method register_constraints_with_action_columns
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def register_constraints_with_action_columns(constrained_fields = nil)
constrained_fields ||= []
constrained_fields |= active_scaffold_constraints.flat_map { |k, v| columns_from_constraint(k, v) }.compact
exclude_actions = []
%i[list update].each do |action_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 conditions_from_constraints
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def conditions_from_constraints
hash_conditions = {}
conditions = [hash_conditions]
active_scaffold_constraints.each do |k, v|
column = active_scaffold_config.columns[k]
- 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_column_link
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def configure_column_link(link, record, associated, actions = nil)
actions ||= link.controller_actions || []
if column_empty?(associated) # if association is empty, we only can link to create form
if actions.include?(:new)
link.action = 'new'
- 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
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def active_scaffold(model_id = nil, &block)
extend Prefixes
# initialize bridges here
ActiveScaffold::Bridges.run_all
Function handleSubmitToServer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSubmitToServer: function(enteredText) {
var data = '';
if (typeof(enteredText) === 'string') {
data += this.settings.update_value + '=' + encodeURIComponent(enteredText) + '&';
} else {
Method active_scaffold_human_condition_select
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_human_condition_select(column, associated)
attribute = column.active_record_class.human_attribute_name(column.name)
associated = [associated].compact unless associated.is_a? Array
if column.association
method = column.options[:label_method] || :to_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 format_collection_association_value
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def format_collection_association_value(value, column, label_method, size)
associated_limit = column.associated_limit
if associated_limit.nil?
firsts = value.collect(&label_method)
safe_join firsts, association_join_text(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
Method render_parent_action
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def render_parent_action
if @parent_action.nil?
@parent_action = :row
if parent_sti_controller
parent_sti_config = parent_sti_controller.active_scaffold_config
- 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 visibles_and_hiddens
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def visibles_and_hiddens(search_config)
visibles = []
hiddens = []
search_config.columns.each_column do |column|
next unless column.search_sql
- 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_value_for_datetime
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def condition_value_for_datetime(column, value, conversion = :to_time)
return if value.nil? || value.blank?
if value.is_a? Hash
local_time_from_hash(value, conversion)
elsif value.respond_to?(:strftime)
- 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 each_column
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def each_column(options = {}, &proc)
columns = options[:core_columns] || action.core.columns
self.unauthorized_columns = []
options[:for] ||= columns.active_record_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 render_action_link
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def render_action_link(link, record = nil, options = {})
if link.action.nil? || link.column&.association&.polymorphic?
link = action_link_to_inline_form(link, record) if link.column&.association
options[:authorized] = false if link.action.nil? || link.controller.nil?
options.delete :link if link.crud_type == :create
- 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"