Method included
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
base.class_eval do
include ErrorHandling
include TransitionActions
Method eager_load_polymorphs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def eager_load_polymorphs(list, includes)
polymorphs = {}
logger.debug "eager_load_polymorphs for list length: #{list.length}"
- 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 exception_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def exception_action(exception)
@exception_catched = true
if Rails.env == 'production'
notify_airbrake(exception)
- 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 resource_exists?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resource_exists?(name)
if eval("@#{name}.nil?") || (eval("@#{name}.class.name") != name.classify && eval("@#{name}.class.superclass.name") != name.classify) || eval("@#{name}.id.nil?")
return false
else
return 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 set_i18n_locale_from_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_i18n_locale_from_params
if params[:locale]
if I18n.available_locales.include?(params[:locale].to_sym)
I18n.locale = params[:locale]
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"