Method recursive_like?
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def recursive_like?(other, data = @data)
raise "Can't compare with object type: #{other.class}! Must respond_to :each" unless other.respond_to?(:each)
other.each do |key, val|
return false unless data && data.respond_to?(:[])
if val.is_a?(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
Class Resource
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Resource
BASE_URI = '/rest'.freeze
UNIQUE_IDENTIFIERS = %w[name uri].freeze # Ordered list of unique attributes to search by
DEFAULT_REQUEST_HEADER = {}.freeze
Method from_file
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.from_file(client, file_path)
resource = OneviewSDK::Config.load(file_path)
klass = self
if klass == OneviewSDK::Resource && resource['type'] # Use correct resource class by parsing type
klass = OneviewSDK # Secondary/temp class/module reference
- 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 build_query
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.build_query(query_options)
return '' if !query_options || query_options.empty?
query_path = '?'
query_options.each do |k, v|
words = k.to_s.split('_')
- 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 find_with_pagination
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.find_with_pagination(client, uri, header = self::DEFAULT_REQUEST_HEADER)
all = []
loop do
response = client.rest_get(uri, header)
body = client.response_handler(response)
- 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_merge!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def deep_merge!(other_data, target_data = @data)
raise 'Both arguments should be a object Hash' unless other_data.is_a?(Hash) && target_data.is_a?(Hash)
other_data.each do |key, value|
value_target = target_data[key.to_s]
if value_target.is_a?(Hash) && value.is_a?(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
Avoid too many return
statements within this method. Open
return false
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(client, params = {}, api_ver = nil)
raise InvalidClient, 'Must specify a valid client'\
unless client.is_a?(OneviewSDK::Client) || client.is_a?(OneviewSDK::ImageStreamer::Client)
@client = client
@logger = @client.logger
- 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"