Showing 34 of 52 total issues
Method add_and_format_element
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.add_and_format_element(dest, dest_key, origin, origin_key, format = :to_s)
Method set_ip
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_ip(host, nic, nic_compute_attributes, v6 = false)
ip = nic.send(ip_s(v6).to_sym)
if container?(host)
if dhcp?(nic_compute_attributes, v6)
ip = 'dhcp'
- 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 check_cidr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_cidr(nic_compute_attributes, v6, ip)
valid = Fog::Proxmox::IpHelper.send(cidr_prefix_method(v6), cidr_prefix(nic_compute_attributes, v6))
ipv = "IPv#{v6 ? '6' : '4'}"
max = v6 ? 128 : 32
checked = valid || ForemanFogProxmox::Value.empty?(ip)
- 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 find_vm_in_servers_by_vmid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_vm_in_servers_by_vmid(servers, vmid)
vm = servers.get(vmid) unless ForemanFogProxmox::Value.empty?(vmid)
pool_owner(vm) if vm
vm
rescue Fog::Errors::NotFound
- 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 compute_dhcps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compute_dhcps(interface_attributes_h)
interface_attributes_h[:dhcp] = interface_attributes_h[:ip] == 'dhcp' ? '1' : '0'
interface_attributes_h[:ip] = '' if interface_attributes_h[:dhcp] == '1'
interface_attributes_h[:dhcp6] = interface_attributes_h[:ip6] == 'dhcp' ? '1' : '0'
interface_attributes_h[:ip6] = '' if interface_attributes_h[:dhcp6] == '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 parse_server_cdrom
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_server_cdrom(args)
cdrom_media = args['cdrom'] if args.key?('cdrom')
cdrom_image = args['volid'] if args.key?('volid')
volid = cdrom_image.empty? ? cdrom_media : cdrom_image
return {} unless 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 to_semver
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.to_semver(version)
raise ArgumentError unless semver?(version)
version_a = version.scan(SEMVER_REGEX)
raise ArgumentError if version_a.empty?
- 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_compute_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def vm_compute_attributes(vm)
vm_attrs = {}
vm_attrs = vm_attrs.merge(vmid: vm.identity, node_id: vm.node_id, type: vm.type)
if vm.respond_to?(:config)
if vm.config.respond_to?(:disks)
- 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 cluster_nodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cluster_nodes(compute_resource)
nodes = compute_resource.nodes ? compute_resource.nodes.collect(&:node) : []
rescue ::Foreman::Exception => e
return [] if e.message == 'User token expired'
rescue StandardError => e
- 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 each
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each(collection_filters = {}, &block)
if block_given?
Kernel.loop do
break unless collection_filters[:marker]
- 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 add_or_delete_typed_interface
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_or_delete_typed_interface(interface_attributes, interfaces_to_delete, interfaces_to_add, type)
logger.debug("add_or_delete_typed_interface(#{type}): interface_attributes=#{interface_attributes}")
ForemanFogProxmox::HashCollection.remove_empty_values(interface_attributes)
if interface_attributes['compute_attributes']
ForemanFogProxmox::HashCollection.remove_empty_values(interface_attributes['compute_attributes'])
- 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 parse_cloudinit_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_cloudinit_config(args)
filenames = ["meta-data"]
config_data = ["instance-id: #{args[:name]}"]
user_data = args.delete(:user_data)
return args if user_data == ''
- 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 parsed_typed_volumes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parsed_typed_volumes(args, type, parsed_vm)
logger.debug("parsed_typed_volumes(#{type}): args=#{args}")
volumes_attributes = args['volumes_attributes']
unless ForemanFogProxmox::Value.empty?(args['config_attributes'])
volumes_attributes ||= args['config_attributes']['volumes_attributes']
- 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 parse_typed_volume
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_typed_volume(args, type)
logger.debug("parse_typed_volume(#{type}): args=#{args}")
disk = parse_hard_disk_volume(args) if volume_type?(args,
'hard_disk') || volume_type?(args, 'mp') || volume_type?(args, 'rootfs')
disk = parse_server_cloudinit(args) if volume_type?(args, 'cloud_init')
- 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"