Showing 722 of 1,271 total issues
Method default_pxe_render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def default_pxe_render(kind)
template_name = host.local_boot_template_name(kind)
# Safely return in case there's no template configured for the specified kind
return unless template_name.present?
template = ProvisioningTemplate.find_by_name(template_name)
- 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 setSSHWaitForResponse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def setSSHWaitForResponse
logger.info "Starting SSH provisioning script - waiting for #{provision_host} to respond"
if compute_resource.respond_to?(:key_pair) && compute_resource.key_pair.try(:secret)
credentials = { :key_data => [compute_resource.key_pair.secret] }
elsif vm.respond_to?(:password) && vm.password.present?
- 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 validate_ssh_provisioning
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_ssh_provisioning
return unless ssh_provision?
return if Rails.env.test?
status = true
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"
Further reading
Function getPageStats
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getPageStats = ({ total, page, perPage }) => {
// logic adapted from patternfly so that we can know the number of items per page
const lastPage = Math.ceil(total / perPage) ?? 0;
const firstIndex = total <= 0 ? 0 : (page - 1) * perPage + 1;
let lastIndex;
- 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 belongs_to
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def belongs_to(name, type, resolver: nil, foreign_key: nil, **kwargs)
if resolver
field name, type, resolver: resolver, **kwargs.except(:resolver, :foreign_key)
else
resolver_method = "resolve_#{name}".to_sym
- 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 encrypt_field
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def encrypt_field(str)
return str unless is_encryptable?(str)
begin
# add prefix to encrypted string
str_encrypted = "#{ENCRYPTION_PREFIX}#{encryptor.encrypt_and_sign(str)}"
- 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 connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def connect(options = {})
return unless connection_properties_valid?
update_public_key options
datacenters && test_https_required
- 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 new_vm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new_vm(attr = { })
test_connection
libvirt_connection_error unless errors.empty?
opts = vm_instance_defaults.merge(attr.to_h).deep_symbolize_keys
- 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 destroy_vm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def destroy_vm(uuid)
vm = find_vm_by_uuid(uuid)
floating_ips = vm.all_addresses
floating_ips.each do |address|
client.disassociate_address(uuid, address['ip']) rescue 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 attributes_to_import_from_facts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def attributes_to_import_from_facts
attrs = [:architecture]
if Setting[:update_hostgroup_from_facts]
attrs << :hostgroup
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 recreate_config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def recreate_config(only = nil)
result = {}
Nic::Managed.rebuild_methods_for(only).map do |method, pretty_name|
interfaces.map do |interface|
- 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_provides_ip?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compute_provides_ip?(field)
return false unless managed? && host_managed? && primary?
subnet_field = (field == :ip6) ? :subnet6 : :subnet
host.compute_provides?(field) || host.compute_provides?(:mac) && mac_based_ipam?(subnet_field)
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 client
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def client
return @client if @client
client = ::Fog::Compute.new(
:provider => "ovirt",
:ovirt_username => user,
- 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 uniq_interfaces_identifiers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def uniq_interfaces_identifiers
success = true
identifiers = []
relevant_interfaces = interfaces.select { |i| !i.marked_for_destruction? }
relevant_interfaces.each do |interface|
- 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 console
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def console(uuid)
vm = find_vm_by_uuid(uuid)
raise Foreman::Exception.new(N_("VM is not running!")) unless vm.ready?
password = random_password(console_password_length(vm.display[:type]))
# Listen address cannot be updated while the guest is running
- 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 client
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def client
tries ||= 3
key = "libvirt_connection_#{url}"
Thread.current[key] ||= begin
conn = ::Fog::Compute.new(:provider => "Libvirt", :libvirt_uri => url)
- 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_template
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_template(opts = {})
raise ::Foreman::Exception.new(N_("Must provide template kind")) unless opts[:kind]
raise ::Foreman::Exception.new(N_("Must provide an operating system")) unless opts[:operatingsystem_id]
# first filter valid templates to our OS and requested template kind.
- 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_permissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_permissions(permissions, options = {})
permissions = Array(permissions)
search = options.delete(:search)
collection = permission_records permissions
- 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 update_bonds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_bonds(iface, name, attributes)
bond_interfaces.each do |bond|
next unless bond.children_mac_addresses.include?(attributes['macaddress'])
next if bond.attached_devices_identifiers.include? name
update_bond bond, iface, name
- 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 update_public_key
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_public_key(options = {})
return unless public_key.blank? || options[:force]
client
rescue Foreman::FingerprintException => e
self.public_key = e.fingerprint if public_key.blank?
- 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"