Showing 93 of 128 total issues
Method vm_clone
has a Cognitive Complexity of 418 (exceeds 5 allowed). Consider refactoring. Open
def vm_clone(options = {})
# Option handling
options = vm_clone_check_options(options)
# Options['template_path']<~String>
- 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_clone
has 376 lines of code (exceeds 25 allowed). Consider refactoring. Open
def vm_clone(options = {})
# Option handling
options = vm_clone_check_options(options)
# Options['template_path']<~String>
File compute.rb
has 694 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'digest/sha2'
# rubocop:disable Lint/RescueWithoutErrorClass
# rubocop:disable Metrics/ModuleLength
module Fog
module Vsphere
Method data
has 266 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.data
@data ||= Hash.new do |hash, key|
hash[key] = {
servers: {
'5032c8a5-9c5e-ba7a-3804-832a03e16381' => {
File vm_clone.rb
has 558 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Fog
module Vsphere
class Compute
module Shared
private
Class Server
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < Fog::Compute::Server
extend Fog::Deprecation
deprecate(:ipaddress, :public_ip_address)
deprecate(:scsi_controller, :scsi_controllers)
Method props_to_attr_hash
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def props_to_attr_hash(vm_mob_ref, props)
# NOTE: Object.tap is in 1.8.7 and later.
# Here we create the hash object that this method returns, but first we need
# to add a few more attributes that require additional calls to the vSphere
# API. The hypervisor name and mac_addresses attributes may not be available
- 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
File create_vm.rb
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Fog
module Vsphere
class Compute
class Real
def create_vm(attributes = {})
Method vm_clone_check_options
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def vm_clone_check_options(options)
default_options = {
'force' => false,
'linked_clone' => false,
'nic_type' => 'VirtualE1000'
- 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
File server.rb
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fog/compute/models/server'
module Fog
module Vsphere
class Compute
Method props_to_attr_hash
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def props_to_attr_hash(vm_mob_ref, props)
# NOTE: Object.tap is in 1.8.7 and later.
# Here we create the hash object that this method returns, but first we need
# to add a few more attributes that require additional calls to the vSphere
# API. The hypervisor name and mac_addresses attributes may not be available
Method cloudinit_to_customspec
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def cloudinit_to_customspec(user_data)
raise ArgumentError, "user_data can't be nil" if user_data.nil?
custom_spec = { 'customization_spec' => {} }
user_data = YAML.safe_load(user_data)
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Specification.html
- 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_raw_interface
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_raw_interface(vm_id, options = {})
raise ArgumentError, 'instance id is a required parameter' unless vm_id
if options.is_a? Fog::Vsphere::Compute::Interface
options
- 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 cloudinit_to_customspec
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def cloudinit_to_customspec(user_data)
raise ArgumentError, "user_data can't be nil" if user_data.nil?
custom_spec = { 'customization_spec' => {} }
user_data = YAML.safe_load(user_data)
custom_spec['encryptionKey'] = user_data['encryptionKey'] if user_data.key?('encryptionKey')
- 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_networks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def list_networks(filters = {})
datacenter_name = filters[:datacenter]
cluster_name = filters.fetch(:cluster, nil)
# default to show all networks
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 create_vm
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_vm(attributes = {})
# build up vm configuration
cluster = get_raw_cluster(attributes[:cluster], attributes[:datacenter])
raise Fog::Vsphere::Compute::NotFound, "Cluster #{attributes[:cluster]} Doesn't Exist in the DC!" unless cluster
- 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_relocate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def vm_relocate(options = {})
raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
# Find the VM Object
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
- 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_compute_resources
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_compute_resources(_filters = {})
[
{
id: 'domain-s7',
name: 'fake-host',
Method create_vm
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_vm(attributes = {})
# build up vm configuration
cluster = get_raw_cluster(attributes[:cluster], attributes[:datacenter])
raise Fog::Vsphere::Compute::NotFound, "Cluster #{attributes[:cluster]} Doesn't Exist in the DC!" unless cluster
Method list_networks
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_networks(filters = {})
datacenter_name = filters[:datacenter]
cluster_name = filters.fetch(:cluster, nil)
# default to show all networks
only_active = filters[:accessible] || false