Method want?
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def want?(vm, range, groups)
if vm.nil?
@log.warn('Obtained nil vm from vm pool.')
return false
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 load_vm_pool
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def load_vm_pool
@log.debug("Loading vm pool from id: #{start_vm_id}.")
from = @start_vm_id
how_many = @batch_size
to = from + how_many - 1
- 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 vms
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def vms(range, groups)
vms = []
# load specific batch
vm_pool = load_vm_pool
return nil if vm_pool.count == 0
- 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 if groups[:exclude] && groups[:exclude].include?(vm['GNAME'])
Method mapping
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mapping(pool_class, xpath)
@log.debug("Generating mapping for class: #{pool_class} and xpath: '#{xpath}'.")
pool = pool_class.new(@client)
# call info_all method instead of info on pools that support it
if pool.respond_to? 'info_all'
- 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 initialize_client
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize_client
secret = Settings['xml_rpc'] ? Settings.xml_rpc['secret'] : nil
endpoint = Settings['xml_rpc'] ? Settings.xml_rpc['endpoint'] : nil
fail ArgumentError, "#{endpoint} is not a valid URL." if endpoint && !uri?(endpoint)
- 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 benchmark_map
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def benchmark_map
map = Hash.new({})
host_pool = OpenNebula::HostPool.new(@client)
rc = host_pool.info
check_retval(rc, Errors::ResourceRetrievalError)
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(compatibility, log = nil)
@log = log ? log : Logger.new(STDOUT)
@compatibility = compatibility
@batch_size = Settings.output['num_of_vms_per_file'] ? Settings.output['num_of_vms_per_file'] : 500
- 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"