Class Base
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Base < ActiveHash::Base
extend ActiveModel::Callbacks
extend ActiveRepository::Finders
extend ActiveRepository::Writers
include ActiveModel::Validations
Method save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save(force=false)
execute_callbacks(before_save_methods)
result = true
if self.class == persistence_class
- 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 serialize!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def serialize!(attributes)
unless attributes.nil?
attributes.each do |key, value|
key = "id" if key == "_id"
self.send("#{key}=", (value.dup rescue value))
- 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 execute_callbacks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute_callbacks(callbacks)
Array(callbacks).each do |callback|
method = callback[:method]
options = callback[: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 set_timestamps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_timestamps
if self.errors.empty?
self.created_at = DateTime.now.utc if self.respond_to?(:created_at=) && self.created_at.nil?
self.updated_at = DateTime.now.utc if self.respond_to?(:updated_at=)
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"