Showing 94 of 130 total issues
Method vm_reconfig_cdrom
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def vm_reconfig_cdrom(options = {})
raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
if options.key?('iso')
raise ArgumentError, 'datastore is a required parameter' unless options.key? 'datastore'
backing = {
- 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 traverse_raw_resource_pools
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def traverse_raw_resource_pools(pools, rp)
if rp
if rp.respond_to? :resourcePool
traverse_raw_resource_pools(pools, rp.resourcePool)
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
Avoid deeply nested control flow statements. Open
custom_spec['nicSettingMap'] = [] unless custom_spec.key?('nicSettingMap')
Method list_virtual_machines
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_virtual_machines(options = {})
if options['instance_uuid']
server = data[:servers][options['instance_uuid']]
server.nil? ? [] : [server]
elsif options['mo_ref']
- 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 deeply nested control flow statements. Open
custom_spec['nicSettingMap'][0]['adapter']['dnsServerList'] = custom_spec['ipsettings']['dnsServerList'] if custom_spec['ipsettings'].key?('dnsServerList')
Method initialize_scsi_controllers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize_scsi_controllers
if attributes[:scsi_controllers].is_a?(Array) && !attributes[:scsi_controllers].empty?
attributes[:scsi_controllers].map! do |controller|
controller.is_a?(Hash) ? Fog::Vsphere::Compute::SCSIController.new(controller) : controller
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 vm_take_snapshot
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def vm_take_snapshot(options = {})
raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
raise ArgumentError, 'name is a required parameter' unless options.key? 'name'
defaults = {
description: '',
- 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 deeply nested control flow statements. Open
raise ArgumentError, 'identification->domainAdminPassword is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification'].key?('domainAdmin')
Method vm_execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def vm_execute(options = {})
raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
raise ArgumentError, 'command is a required parameter' unless options.key? 'command'
raise ArgumentError, 'user is a required parameter' unless options.key? 'user'
raise ArgumentError, 'password is a required parameter' unless options.key? 'password'
- 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 deeply nested control flow statements. Open
if custom_spec['ipsettings'].key?('ip') && !custom_spec['ipsettings'].key?('subnetMask')
raise ArgumentError, 'subnetMask is required for static ip'
end
Avoid deeply nested control flow statements. Open
raise ArgumentError, 'licenseFilePrintData->autoMode is required when using Sysprep identity and licenseFilePrintData' unless identity['Sysprep']['licenseFilePrintData'].key?('autoMode')
Avoid deeply nested control flow statements. Open
custom_spec['nicSettingMap'][0]['adapter'] = {} unless custom_spec['nicSettingMap'][0].key?('adapter')
Avoid deeply nested control flow statements. Open
if identity['Sysprep']['licenseFilePrintData'].key?('autoUsers')
custom_licenseFilePrintData.autoUsers = identity['Sysprep']['licenseFilePrintData']['autoUsers'] if identity['Sysprep']['licenseFilePrintData']['autoMode'] == 'PerServer'
end
Method list_compute_resources
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_compute_resources(filters = {})
datacenter_name = filters[:datacenter]
# default to show all compute_resources
only_active = filters[:effective] || false
compute_resources = raw_compute_resources datacenter_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
Consider simplifying this complex logical expression. Open
if options.is_a? Fog::Vsphere::Compute::Interface
options
else
raise ArgumentError, "Either key or name is a required parameter. options: #{options}" unless options.key?(:key) || options.key?(:mac) || options.key?(:name)
Method host_start_maintenance
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def host_start_maintenance(name, cluster_name, datacenter_name, timeout = 0, evacuate_powered_off_vms = false)
Method connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def connect
# This is a state variable to allow digest validation of the SSL cert
bad_cert = false
loop do
begin
- 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_controller
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_controller(controller = nil, index = 0)
device_options = {}
options = if controller
controller_default_options.merge(controller.attributes)
else
- 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 list_datastores
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def list_datastores(filters = {})
datacenter_name = filters[:datacenter]
cluster_name = filters.fetch(:cluster, nil)
# default to show all datastores
only_active = filters[:accessible] || 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 class_from_string
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.class_from_string(name, default_path = '')
const = default_path.empty? ? name.to_s : "#{default_path}::#{name}"
klass = const.split('::').inject(Object) { |m, c| m.const_get(c) }
return klass unless klass == Object
rescue NameError
- 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"