Showing 30 of 30 total issues
Method attach_reloader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def attach_reloader
Rails.application.config.after_initialize do |app|
unload_active_admin = -> { ActiveAdmin.application.unload! }
if app.config.reload_classes_only_on_change
- 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_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def format_action(action, subject)
# https://github.com/varvet/pundit/blob/master/lib/generators/pundit/install/templates/application_policy.rb
case action
when Auth::READ then subject.is_a?(Class) ? :index? : :show?
when Auth::DESTROY then subject.is_a?(Class) ? :destroy_all? : :destroy?
- 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 permit_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def permit_params(*args, &block)
param_key = config.param_key.to_sym
controller do
define_method :permitted_params 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 default_input_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def default_input_type(method, options = {})
if /_(eq|cont|start|end)\z/.match?(method)
:string
elsif klass._ransackers.key?(method.to_s)
klass._ransackers[method.to_s].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 id_column
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def id_column
raise "#{resource_class.name} has no primary_key!" unless resource_class.primary_key
column(resource_class.human_attribute_name(resource_class.primary_key), sortable: resource_class.primary_key) do |resource|
if controller.action_methods.include?("show")
link_to resource.id, resource_path(resource)
- 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 auto_url_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def auto_url_for(resource)
config = active_admin_resource_for(resource.class)
return unless config
if config.controller.action_methods.include?("show") &&
- 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_current_menu_item
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_current_menu_item
@current_menu_item = if current_menu && active_admin_config.belongs_to? && parent?
parent_item = active_admin_config.belongs_to_config.target.menu_item
if current_menu.include? parent_item
parent_item
- 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 unload_resources!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unload_resources!
resources.each do |resource|
parent = (module_name || "Object").constantize
name = resource.controller_name.split("::").last
parent.send(:remove_const, name) if parent.const_defined?(name, 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 restrict_download_format_access!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def restrict_download_format_access!
unless request.format.html?
presenter = active_admin_config.get_page_presenter(:index)
download_formats = (presenter || {}).fetch(:download_links, active_admin_config.namespace.download_links)
unless build_download_formats(download_formats).include?(request.format.symbol)
- 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 humanize_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def humanize_name(name, resource, humanize_name_option)
if humanize_name_option
name.is_a?(Symbol) && resource ? resource.resource_class.human_attribute_name(name) : name.to_s.humanize
else
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"