File action_link_helpers.rb
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveScaffold
module Helpers
# All extra helpers that should be included in the View.
# Also a dumping ground for uncategorized helpers.
module ActionLinkHelpers
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, 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
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 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 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 query_string_for_action_links
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def query_string_for_action_links(link)
if defined?(@query_string) && link.parameters.none? { |k, _| @query_string_params.include? k }
return [@query_string, @non_nested_query_string]
end
keep = 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 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 get_action_link_id
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_action_link_id(link, record = nil)
column = link.column
if column&.association && record
associated = record.send(column.association.name) unless column.association.collection?
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 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"
Further reading
Method action_link_html_options
has 33 lines of code (exceeds 25 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, options)
Method query_string_for_action_links
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query_string_for_action_links(link)
if defined?(@query_string) && link.parameters.none? { |k, _| @query_string_params.include? k }
return [@query_string, @non_nested_query_string]
end
keep = true
Method add_query_string_to_cached_url
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_query_string_to_cached_url(link, url)
query_string, non_nested_query_string = query_string_for_action_links(link)
nested_params = (!link.nested_link? && non_nested_query_string)
if query_string || nested_params
url << (url.include?('?') ? '&' : '?')
- 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 replace_id_params_in_action_link_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_id_params_in_action_link_url(link, record, url)
url = record ? url.sub('--ID--', record.to_param.to_s) : url.clone
if link.column&.association&.singular?
child_id = record.send(link.column.association.name)&.to_param
if child_id.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 cached_action_link_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cached_action_link_url(link, record)
@action_links_urls ||= {}
@action_links_urls[link.name_to_cache.to_s] || begin
url_options = cached_action_link_url_options(link, record)
if cache_action_link_url?(link, 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"