lib/fog/vsphere/compute.rb
File compute.rb
has 694 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
Open
def self.data
@data ||= Hash.new do |hash, key|
hash[key] = {
servers: {
'5032c8a5-9c5e-ba7a-3804-832a03e16381' => {
Method props_to_attr_hash
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
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
Method props_to_attr_hash
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 connect
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def connect
# This is a state variable to allow digest validation of the SSL cert
bad_cert = false
loop do
begin
Method connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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"