Method like?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def like?(other)
if other.is_a? Hash
other_copy = Marshal.load(Marshal.dump(other))
else
other_copy = other.dup
- 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 retrieve!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def retrieve!
ip_hostname = self['credentials'][:ip_hostname] || self['credentials']['ip_hostname'] rescue nil
if ip_hostname
results = self.class.find_by(@client, credentials: { ip_hostname: ip_hostname })
if results.size == 1
- 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 exists?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def exists?
ip_hostname = self['credentials'][:ip_hostname] || self['credentials']['ip_hostname'] rescue nil
return true if ip_hostname && self.class.find_by(@client, credentials: { ip_hostname: ip_hostname }).size == 1
super
rescue IncompleteResource => e
- 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"