Class ArrayModel
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class ArrayModel < ReactiveArray
include ModelWrapper
include Models::Helpers::Base
include StateManager
include Models::Helpers::ArrayModel
File array_model.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'volt/reactive/reactive_array'
require 'volt/models/model_wrapper'
require 'volt/models/helpers/base'
require 'volt/models/state_manager'
require 'volt/models/helpers/array_model'
Method proxy_with_load
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.proxy_with_load(*method_names)
imethods = instance_methods(false)
method_names.each do |method_name|
# Sometimes we want to alias a method_missing method, so we use super
# instead to call it, if its not defined locally.
- 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 create_new_model
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_new_model(model, from_method)
if model.is_a?(Model)
if model.buffer?
fail "The #{from_method} does not take a buffer. Call .save! on buffer's to persist them."
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 create_new_model
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_new_model(model, from_method)
if model.is_a?(Model)
if model.buffer?
fail "The #{from_method} does not take a buffer. Call .save! on buffer's to persist them."
end
Method proxy_with_load
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.proxy_with_load(*method_names)
imethods = instance_methods(false)
method_names.each do |method_name|
# Sometimes we want to alias a method_missing method, so we use super
# instead to call it, if its not defined locally.
Method delete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete(val)
# Check to make sure the models are allowed to be deleted
if !val.is_a?(Model)
# Not a model, return as a Promise
super(val).then
- 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"