Showing 276 of 365 total issues
Method render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def render(options = {}, locals = {}, &block)
case options
when Hash
in_rendering_context(options) do |_|
# previously set view paths and lookup context are lost here
- 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 sti_nested_build_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def sti_nested_build_options(klass)
config = active_scaffold_config_for(klass)
return unless config
column = klass.inheritance_column
return unless column && config._columns_hash[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 include_habtm_actions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def include_habtm_actions
if nested&.habtm?
# Production mode is ok with adding a link everytime the scaffold is nested - we are not ok with that.
unless active_scaffold_config.action_links['new_existing']
active_scaffold_config.action_links.add('new_existing', :label => :add_existing, :type => :collection, :security_method => :add_existing_authorized?)
- 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_association_with_parent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_association_with_parent(record, check_match = false)
return unless create_association_with_parent?(check_match)
if nested.child_association&.singular?
record.send("#{nested.child_association.name}=", nested_parent_record)
elsif nested.create_through_singular?
- 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 call
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def call(mapper, options = {})
options = @defaults.merge(options)
actions = get_actions(ACTIVE_SCAFFOLD_CORE_ROUTING, options)
mapper.collection 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 method_missing
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(name, *args, &block)
CowProxy.debug { "method missing #{name} in #{__getobj__.name}" }
return super if name.match?(/[!?]$/)
subgroup =
if _instance_variable_defined?("@#{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 main_path_to_return
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def main_path_to_return
if params[:return_to]
params[:return_to]
else
exclude_parameters = %i[utf8 associated_id]
- 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 inplace_edit_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def inplace_edit_data(column)
data = {}
data[:ie_url] = url_for(params_for(:action => 'update_column', :column => column.name, :id => '__id__'))
data[:ie_cancel_text] = column.options[:cancel_text] || as_(:cancel)
data[:ie_loading_text] = column.options[:loading_text] || as_(:loading)
- 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_ancestry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_input_ancestry(column, options, ui_options: column.options)
record = options[:object]
select_options = []
select_control_options = {:selected => record.parent_id}
select_control_options[:include_blank] = as_(:_select_) if record.parent_id.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 name_to_cache
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def name_to_cache
return @name_to_cache if defined? @name_to_cache
[
controller || 'self',
type,
- 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 number_to_native
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def number_to_native(value)
return value if value.blank? || !value.is_a?(String)
native = '.' # native ruby separator
format = {:separator => '', :delimiter => ''}.merge! I18n.t('number.format', :default => {})
specific =
- 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_search_sql
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize_search_sql
self.search_sql =
unless virtual?
if association.nil?
field.to_s unless tableless?
- 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_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_input_options(column, scope = nil, options = {})
name = scope ? "record#{scope}[#{column.name}]" : "record[#{column.name}]"
record = options[:object]
# Add some HTML5 attributes for in-browser validation and better user experience
- 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_file_with_content
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_file_with_content(column, content, options, remove_file_prefix, controls_class)
required = options.delete(:required)
case ActiveScaffold.js_framework
when :jquery
js_remove_file_code = "jQuery(this).prev().val('true'); jQuery(this).parent().hide().next().show()#{".find('input').attr('required', 'required')" if required}; return false;"
- 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 type_casted_tokens
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def type_casted_tokens(tokens, columns, like_pattern)
tokens.map do |value|
columns.each_with_object({}) do |column, column_tokens|
column_tokens[column.name] =
if column.text?
- 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 column_link_authorized?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def column_link_authorized?(link, column, record, associated)
if column.association
associated_for_authorized =
if column.association.collection? || associated.nil?
column.association.klass
- 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 set_link
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_link(action, options = {})
if action.is_a?(ActiveScaffold::DataStructures::ActionLink) || (action.is_a? Proc)
@link = action
else
options[:label] ||= 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_date_picker_field
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold_search_date_picker_field(column, options, current_search, name, ui_options: column.options)
value =
if current_search.is_a? Hash
controller.class.condition_value_for_datetime(column, current_search[name], column.search_ui == :date_picker ? :to_date : :to_time)
else
- 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 nested_chain_with_association
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def nested_chain_with_association
if nested.association.collection?
nested_parent_record.send(nested.association.name)
elsif nested.association.through? # has_one :through
active_scaffold_config.model.where(active_scaffold_config.model.primary_key => nested_parent_record.send(nested.association.name)&.id)
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def active_scaffold_render_subform_column(column, scope, crud_type, readonly, add_class = false, record = nil) # rubocop:disable Metrics/ParameterLists