Showing 4 of 4 total issues
Method _handle_setup_errors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _handle_setup_errors(primary_flag_attribute, configuration)
if !primary_flag_attribute.is_a?(Symbol)
raise SetAsPrimary::Error, "wrong argument type (expected Symbol)"
end
- 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 index_on
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def index_on
if owner_key.present?
klass = table_name.classify.constantize
owner_association = klass.reflect_on_association(owner_key.to_sym)
- 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_as_primary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_as_primary(primary_flag_attribute = :primary, options = {})
if primary_flag_attribute.is_a?(Hash)
options = primary_flag_attribute; primary_flag_attribute = :primary
end
- 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 force_primary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def force_primary
scope = _klass
scope = scope.where(_scope_options) if _scope_options.present?
count = scope.count
- 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"