Showing 1,256 of 1,256 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 filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def filter(opts = {})
result = if opts[:selected]
items.select { |pagelet| pagelet.locked || opts[:selected].include?(pagelet.key.to_s) }
else
items.select do |pagelet|
- 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 inherited_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def inherited_attributes(hostgroup, facet_attributes)
_, facet_config = Facets.find_facet_by_class(self, :host)
return facet_attributes unless facet_config.has_hostgroup_configuration? && hostgroup
hostgroup.inherited_facet_attributes(facet_config).merge(facet_attributes || {}) do |key, left, right|
- 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_puppet_ca_proxy_is_required?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_puppet_ca_proxy_is_required?
return true if puppet_ca_proxy_id.present? || puppet_proxy_id.blank?
if puppet_proxy.has_feature?('Puppet CA')
self.puppet_ca_proxy ||= puppet_proxy
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 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 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
Method queue_compute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def queue_compute
return log_orchestration_errors unless compute? && errors.empty?
# Create a new VM if it doesn't already exist or update an existing vm
update_or_create = vm_exists?
- 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 queue_tftp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def queue_tftp
return log_orchestration_errors unless (tftp? || tftp6?) && no_errors
# Jumpstart builds require only minimal tftp services. They do require a tftp object to query for the boot_server.
return true if host.jumpstart?
new_record? ? queue_tftp_create : queue_tftp_update
- 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 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 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"
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 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 realm_field
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def realm_field(f, can_override = false, override = false)
# Don't show this if we have no Realms, otherwise always include blank
# so the user can choose not to use a Realm on this host
return unless @host.managed
realms = accessible_resource(f.object, :realm)
- 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 parse_args
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_args(args)
args = args.deep_symbolize_keys
# convert rails nested_attributes into a plain, symbolized hash
[:interfaces, :volumes].each do |collection|
- 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 format
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def format
if (format = ReportTemplateFormat.find(@params['format']))
format
else
Rails.logger.debug "Report format #{@params['format']} not found" if @params['format'].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 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
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"