HewlettPackard/oneview-sdk-ruby

View on GitHub
lib/oneview-sdk/resource/api200/storage_system.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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
Severity: Minor
Found in lib/oneview-sdk/resource/api200/storage_system.rb - About 1 hr to fix

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
Severity: Minor
Found in lib/oneview-sdk/resource/api200/storage_system.rb - About 1 hr to fix

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
Severity: Minor
Found in lib/oneview-sdk/resource/api200/storage_system.rb - About 1 hr to fix

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

There are no issues that match your filters.

Category
Status