Showing 276 of 365 total issues
Function update_column
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
update_column: function(element, url, send_form, source_id, val, additional_params) {
Method with_unsaved_associated
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def with_unsaved_associated
associations_for_update.map do |assoc|
association_proxy = association(assoc.name)
if association_proxy.target.present?
records = association_proxy.target
- 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_embedded
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def render_embedded(options)
require 'digest/md5'
remote_controller = options[:active_scaffold]
# It is important that the EID hash remains short as to not contribute
- 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 setFieldFromAjax
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
setFieldFromAjax: function(url, options) {
var ipe = this;
$(ipe._controls.editor).remove();
new Ajax.Request(url, {
method: 'get',
- 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 responds_to_parent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def responds_to_parent(&block)
yield
return unless performed?
# Either pull out a redirect or the request body
- 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_column
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_column(column, record, renders_as, scope = nil, only_value = false, col_class = nil) # rubocop:disable Metrics/ParameterLists
Method add_to_javascript_manifest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_to_javascript_manifest
file = 'app/assets/javascripts/application.js'
unless File.exist?(file)
if Rails.version >= '6.0'
create_javascript_manifest file
- 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 do_add_existing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def do_add_existing
parent_record = nested_parent_record(:update)
@record = active_scaffold_config.model.find(params[:associated_id])
if parent_record && @record
self.successful = false unless parent_record.send(nested.association.name) << @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 format_number_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def format_number_value(value, options = {})
if value
value =
case options[:format]
when :size
- 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 do_update_column
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def do_update_column
# delete from params so update :table won't break urls, also they shouldn't be used in sort links too
value = params.delete(:value)
column = params.delete(:column)
params.delete(:original_html)
- 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 create_respond_to_html
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_respond_to_html
if successful?
flash[:info] = as_(:created_model, :model => ERB::Util.h(@record.to_label))
if (action = active_scaffold_config.create.action_after_create)
redirect_to params_for(:action => action, :id => @record.to_param)
- 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_datetime_field
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_search_datetime_field(column, options, current_search, name, ui_options: column.options)
options = ui_options.merge(options)
type = "#{'date' unless options[:discard_date]}#{'time' unless options[:discard_time]}"
field_name = "#{options[:name]}[#{name}]"
if options[:use_select]
- 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 history_state
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def history_state
if active_scaffold_config.store_user_settings
state = {page: @page&.number}
state[:search] = search_params if respond_to?(:search_params) && search_params.present?
if active_scaffold_config.list.user.user_sorting?
- 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 update_column
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
update_column: function(element, url, send_form, source_id, val, additional_params) {
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(model_id)
super
return unless ActiveScaffold::Bridges::DatePicker.default_ui
date_picker_fields = _columns.collect { |c| {:name => c.name.to_sym, :type => c.type} if %i[date datetime].include?(c.type) }.compact
- 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 record_for_update_column
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def record_for_update_column
@record = find_if_allowed(params[:id], :read)
raise ActiveScaffold::ActionNotAllowed unless @record.authorized_for?(:crud_type => :update, :column => @column.name)
if @column.delegated_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
Avoid deeply nested control flow statements. Open
options[:size] ||= options[:maxlength].to_i > 30 ? 30 : options[:maxlength]
Method find_duplicate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_duplicate(link)
links = []
@set.each do |item|
if item.is_a?(ActiveScaffold::DataStructures::ActionLinks)
collected = item.find_duplicate(link)
- 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 readonly_through_association?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def readonly_through_association?(columns)
return false unless through_association?
return true if association.through_reflection.options[:through] # create not possible, too many levels
return true if association.source_reflection.options[:through] # create not possible, too many levels
return false if create_through_singular? # create allowed, AS has code for this
- 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 current_form_columns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def current_form_columns(record, scope, subform_controller = nil)
if scope
subform_controller.active_scaffold_config.subform.columns.visible_columns_names
elsif %i[new create edit update render_field].include? action_name.to_sym
# disable update_columns for inplace_edit (GET render_field)
- 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"