Method array_diff
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def self.array_diff(value_1, value_2, options)
ensure_class(value_1, Array)
ensure_class(value_2, Array)
return nil if value_1 == value_2
- 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_diff
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.array_diff(value_1, value_2, options)
ensure_class(value_1, Array)
ensure_class(value_2, Array)
return nil if value_1 == value_2
Method array_non_unique_diff
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.array_non_unique_diff(value_1, value_2)
value_2_elements_by_count = value_2.reduce({}) do |hash, element|
updated_element_hash = hash.key?(element) ? { element => hash[element] + 1 } : { element => 1 }
hash.merge(updated_element_hash)
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 hash_diff
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.hash_diff(value_1, value_2, options)
ensure_class(value_1, Hash)
ensure_class(value_2, Hash)
return nil if value_1 == value_2
- 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 clean_hash!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.clean_hash!(hash, key)
hash.delete(key)
hash.each do |_, value|
case value
when Hash
- 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 diff
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.diff(value_1, value_2, options = {})
options[:key_1] ||= 'value_1'
options[:key_2] ||= 'value_2'
options[:id_key] ||= nil
- 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"