Showing 44 of 92 total issues
Method set_network
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def set_network(uplink_set, network_type, network_uris)
net_type = network_type == 'Ethernet' ? :EthernetNetwork : :FCNetwork
net_class = OneviewSDK.resource_named(net_type, login[:api_version], login[:hardware_variant])
network_uris.each do |network_uri|
# Added a block to handle network uris in an uplinkset
- 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 bulk_delete_check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def bulk_delete_check
if @data['networkUris']
list = []
@data['networkUris'].each do |item|
if item.to_s[0..6].include?('/rest/')
- 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 connections_parse
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def connections_parse
@data.each_key do |key|
next unless @data[key].is_a?(Hash)
next unless @data[key].include?('manageConnections')
@data[key].each do |conn, value|
- 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 bulk_delete_check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def bulk_delete_check
if @data['networkUris']
list = []
@data['networkUris'].each do |item|
if item.to_s[0..6].include?('/rest/')
- 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 bulk_delete_check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def bulk_delete_check
if @data['networkUris']
list = []
@data['networkUris'].each do |item|
if item.to_s[0..6].include?('/rest/')
- 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 helper_retrieve_vas
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def helper_retrieve_vas
server_name, volume_name = @data['name'].split(',').map(&:strip)
raise 'A server profile name has not been provided' unless server_name
raise 'A volume name has not been provided' unless volume_name
server_profile = OneviewSDK::ServerProfile.find_by(@client, name: server_name)
- 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 pd_uri_parser
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def pd_uri_parser
return unless @data['powerConnections']
@data['powerConnections'].each do |pc|
next if pc['connectionUri']
type = pc.delete('type')
- 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 uri_set
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def uri_set(tag, type)
network_uris = @data.delete(tag)
return unless network_uris
network_uris.each_with_index do |network_name, index|
next if network_name.to_s[0..6].include?('/rest/')
- 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 set_new_profile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_new_profile
server_profile = OneviewSDK::ServerProfile
# lets the SDK set a default name in case the user has not declared one
if @data['serverProfileName']
sp_name = @data.delete('serverProfileName')
- 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 data_parse
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def data_parse
@data['interconnectBayMappingCount'] = @data['interconnectBayMappingCount'].to_i if @data['interconnectBayMappingCount']
return unless @data['interconnectBayMappings']
@data['interconnectBayMappings'].each do |mapping_attr|
mapping_attr['interconnectBay'] = mapping_attr['interconnectBay'].to_i
- 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 get_without_ethernet
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_without_ethernet
Puppet.notice("\n\nNetwork Set Without Ethernet\n")
if @data.empty?
list = @resource_type.get_without_ethernet(@client)
raise('There is no Network Set without ethernet in the Oneview appliance.') if list.empty?
- 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 get_without_ethernet
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_without_ethernet
Puppet.notice("\n\nLogical Downlink Without Ethernet\n")
if @data.empty?
list = @resource_type.get_without_ethernet(@client)
raise('There is no Logical Downlink without ethernet in the Oneview appliance.') if list.empty?
- 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 load_resource
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_resource(type, id, ret_attribute: nil, base_module: OneviewSDK)
raise(ArgumentError, 'Must specify a resource type') unless type
return unless id
klass = base_module.resource_named(type, api_version, resource_variant)
data = id.is_a?(Hash) ? id : { name: id }
- 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
Consider simplifying this complex logical expression. Open
next if value.to_s[0..6].include?('/rest/') || !(key.to_s.include?('Uri') || key.to_s == 'uri' || key.to_s.end_with?('URI')) ||
value.nil? || %w(null nil).include?(value.to_s) || exception_to_be_treated_within_provider(key)
Method parse_uris_for_firmware_driver
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_uris_for_firmware_driver(key, value, extra = nil)
if value.is_a? Array
value.each_with_index do |array_value, array_key|
parse_uris_for_firmware_driver(key, array_value, array_key)
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_merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def hash_merge(base_hash, new_hash)
base_hash.each_key do |key|
# checks if the value is present in the new hash
next unless new_hash[key]
if base_hash[key].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
Method create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
current_resource = @resource_type.find_by(@client, unique_id).first
if current_resource
return true unless @data['new_name']
current_resource.update_name(@data['new_name'])
- 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 prepare_environment
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def prepare_environment
data = resource['data'] || {}
data.each do |key, value|
data[key] = nil if value == 'nil'
data[key] = false if value == 'false'
- 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 get_snapshot
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_snapshot
snapshot_parameters ||= @data.delete('snapshotParameters')
if snapshot_parameters
raise 'A snapshot Parameter "name" is required when the snapshotParameters is used for this operation' unless
snapshot_parameters['name']
- 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 create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
raise 'A "publicAttributes" or "sanPolicy" attribute is required to be set within data for this operation' unless
@data['publicAttributes'] || @data['sanPolicy']
public_attributes = @data.delete('publicAttributes')
san_policy = @data.delete('sanPolicy')
- 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"