Method remove_blanks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def remove_blanks(hash)
hash.each do |k, v|
hash.delete k if !v || v == '' || v.is_a?(Proc)
if v.is_a? Hash
remove_blanks v
- 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 deep_sort
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def deep_sort(object)
if object.is_a?(Hash)
res = {}
object.each { |k, v| res[k] = deep_sort(v) }
Hash[res.sort { |a, b| a[0].to_s <=> b[0].to_s }]
- 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 deep_stringify_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deep_stringify_keys(hash)
hash.reduce({}) do |result, (key, value)|
value = deep_stringify_keys(value) if value.is_a? Hash
result[(key.to_s rescue key) || key] = value
result
- 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"