Showing 6 of 6 total issues
Method process_persistence
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def process_persistence
persisted = true
begin
persisted_file_content = load_from_file(where_to_persist)
r_objects = ActiveSupport::JSON.decode(persisted_file_content)
- 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 has_many
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def has_many(*args)
relation_name = args.shift.to_s
options = args.empty? ? {} : args.shift
class_name = options.fetch(:class, relation_name.downcase.singularize).capitalize
Method process_persistence
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_persistence
persisted = true
begin
persisted_file_content = load_from_file(where_to_persist)
r_objects = ActiveSupport::JSON.decode(persisted_file_content)
Method belongs_to
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def belongs_to(*args)
relation_name = args.shift.to_s
options = args.empty? ? {} : args.shift
class_name = options.fetch(:class, relation_name).capitalize
Method process_has_many
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_has_many(reflection,value)
persist = instance_method(:run_relation_persistence)
action = lambda do |relation_name,relation_class,value|
ids = value.split(Jason::has_many_separator)
ids.each do |id|
- 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 attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def attribute(*args)
attribute_name,attribute_type = args[0], args[1]
unless DATA_TYPES.keys.include?("#{attribute_type}".to_sym)
raise Errors::NotSupportedDataTypeError.new("This Kind of type is not supported or missing!")
- 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"