Method menu_for
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def menu_for(parent, abstract_model = nil, object = nil, only_icon = false)
actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) && a.show_in_menu }
actions.collect do |action|
wording = wording_for(:menu, action)
li_class = ['nav-item', 'icon', "#{action.key}_#{parent}_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 navigation
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def navigation(parent_groups, nodes, level = 0)
nodes.collect do |node|
abstract_model = node.abstract_model
model_param = abstract_model.to_param
url = rails_admin.url_for(action: :index, controller: 'rails_admin/main', model_name: model_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 breadcrumb
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def breadcrumb(action = @action, _acc = [])
begin
(parent_actions ||= []) << action
end while action.breadcrumb_parent && (action = action(*action.breadcrumb_parent)) # rubocop:disable Lint/Loop
- 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 edit_user_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def edit_user_link
return nil unless _current_user.try(:email).present?
return nil unless (abstract_model = RailsAdmin.config(_current_user.class).abstract_model)
edit_action = action(:edit, abstract_model, _current_user)
- 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 wording_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wording_for(label, action = @action, abstract_model = @abstract_model, object = @object)
model_config = abstract_model.try(:config)
object = nil unless abstract_model && object.is_a?(abstract_model.model)
action = RailsAdmin::Config::Actions.find(action.to_sym) if action.is_a?(Symbol) || action.is_a?(String)
- 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"