File model.rb
has 546 lines of code (exceeds 250 allowed). Consider refactoring. Open
module MotionModel
class PersistFileError < Exception; end
class RelationIsNilError < Exception; end
class AdapterNotFoundError < Exception; end
class RecordNotSaved < Exception; end
Method initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
raise AdapterNotFoundError.new("You must specify a persistence adapter.") unless self.respond_to? :adapter
@data ||= {}
before_initialize(options) if respond_to?(:before_initialize)
- 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 destroy
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def destroy(options = {})
call_hooks 'destroy' do
options = options.dup
options[:omit_model_identifiers] ||= {}
options[:omit_model_identifiers][model_identifier] = self
- 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_belongs_to_attr
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_belongs_to_attr(col, owner, options = {})
_col = column(col)
unless belongs_to_synced?(_col, owner)
_set_attr(_col.name, owner)
rebuild_relation(_col, owner, set_inverse: options[:set_inverse])
- 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 evaluate_default_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_default_value(column, value)
default = self.class.default(column)
case default
when NilClass
- 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"