Method deep_diff
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.deep_diff(*hashes)
diff = {}
case hashes.length
when 4
ltag, left, rtag, right = hashes
- 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 array_to_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def array_to_hash(array, summary = false)
item_hash = {}
array.each_index do |index|
item = array[index]
ikey = item.respond_to?(:key) && item.key ? item.key : index
- 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 key_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def key_name
unless defined?(@key_name)
@key_name = nil
self.class.attributes.each do |attribute|
if attribute.options[: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"