Showing 14 of 60 total issues
Class Server
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < Fog::Compute::Server
identity :vmid
attribute :type
attribute :node_id
attribute :config
Method list_servers
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_servers(_options = {})
if options[:type] == 'qemu'
[
{
'vmid' => '100',
Method flatten
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.flatten(disk)
id = disk[:id]
value = ''
if disk[:volid]
value += disk[:volid]
- 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 request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def request(params)
retried = false
begin
authenticate! if expired?
request_options = params.merge(path: "#{@path}/#{params[:path]}",
- 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 start_console
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def start_console(options = {})
unless ready?
raise ::Fog::Proxmox::Errors::ServiceError,
'Unable to start console because server not running.'
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 start_console
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_console(options = {})
unless ready?
raise ::Fog::Proxmox::Errors::ServiceError,
'Unable to start console because server not running.'
end
Method request
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(params)
retried = false
begin
authenticate! if expired?
request_options = params.merge(path: "#{@path}/#{params[:path]}",
Method extract_storage_volid_size
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_storage_volid_size(disk_value)
# volid definition: <VOLUME_ID>:=<STORAGE_ID>:<storage type dependent volume name>
values_a = disk_value.scan(%r{^(([\w-]+):{0,1}([\w/.-]+))})
no_cdrom = !disk_value.match(CDROM_REGEXP)
creation = disk_value.split(',')[0].match(/^(([\w-]+):{1}(\d+))$/)
- 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 setup
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setup(options)
if options.respond_to?(:config_service?) && options.config_service?
configure(options)
return
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 flatten
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.flatten(cpu_h)
return '' unless cpu_h['cpu_type']
cpu_type = "cputype=#{cpu_h['cpu_type']}"
num_flags = 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
Method flatten
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.flatten(nic_hash)
if nic_hash[:hwaddr].nil?
nic_id = nic_hash[nic_name(nic_hash).to_sym]
nic_value = set_mac(nic_id, nic_hash)
options = nic_hash.reject do |key, _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 missing_credentials
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def missing_credentials(options)
missing_credentials = []
missing_credentials << :proxmox_userid unless options[:proxmox_userid]
missing_credentials << :proxmox_tokenid unless options[:proxmox_tokenid]
missing_credentials << :proxmox_token unless options[:proxmox_token]
- 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_mac
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.set_mac(nic_id, nic_hash)
mac_keys = %i[macaddr hwaddr]
nic_value = ''
if (nic_hash.keys & mac_keys).empty?
nic_value = nic_name(nic_hash) + '=' + nic_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
Method flag_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.flag_value(cpu, flag_key)
flag_value = '0'
raw_values = extract_flags(cpu).split(';').select { |flag| ['+' + flag_key, '-' + flag_key].include?(flag) }
unless raw_values.empty?
flag_value = if raw_values[0].start_with?('+')
- 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"