Class Model
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class BazaModels::Model
AutoAutoloader.autoload_sub_classes(self, __FILE__)
include BelongsToRelations
include Delegation
File model.rb
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "string-cases"
class BazaModels::Model
AutoAutoloader.autoload_sub_classes(self, __FILE__)
Method real_attributes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def real_attributes(attributes)
new_attributes = {}
attributes.each do |attribute_name, attribute_value|
belongs_to_relations = self.class.instance_variable_get(:@belongs_to_relations)
- 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 fire_callbacks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def fire_callbacks(name)
return if !@@callbacks[name] || !@@callbacks[name][self.class.name]
@@callbacks[name][self.class.name].each do |callback_data|
if callback_data[:block]
- 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 inspect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def inspect
data_str = ""
@data.each do |key, value|
if @changes.key?(key)
value_to_use = @changes.fetch(key)
- 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 init_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.init_model(args = {})
return if @model_initialized && !args[:force]
@table = db.tables[table_name]
- 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"