Showing 1,254 of 1,254 total issues
Method puppet_actions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def puppet_actions
return [] unless Foreman::Plugin.installed?('foreman_puppet')
return [] unless authorized_for(:controller => :hosts, :action => :edit)
return [] unless SmartProxy.unscoped.authorized.with_features("Puppet CA").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 add_domain_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_domain_params(param)
return if host.domain.blank?
param["domainname"] = host.domain.name unless host.domain.nil? || host.domain.name.nil?
param["foreman_domain_description"] = host.domain.fullname unless host.domain.nil? || host.domain.fullname.nil?
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 inherited_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def inherited_attributes
inherited_attrs = %w{domain_id operatingsystem_id architecture_id compute_resource_id}
inherited_attrs << "subnet_id" unless compute_provides?(:ip)
inherited_attrs << "subnet6_id" unless compute_provides?(:ip6)
inherited_attrs.concat(%w{medium_id ptable_id pxe_loader}) unless image_build?
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def client
@client ||= ::Fog::Compute.new(
:provider => "vsphere",
:vsphere_username => user,
:vsphere_password => password,
- 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 build_inputs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_inputs(template, input_values)
inputs = {}.with_indifferent_access
return inputs if template.nil?
# process values from params (including empty hash)
- 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_by_to_label
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_by_to_label(str)
os = find_by_description(str.to_s)
return os if os
a = str.split(" ")
b = a[1].split('.') if a[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 refresh
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def refresh
old_features = @smart_proxy.feature_details
if @smart_proxy.refresh.blank? && @smart_proxy.save
msg = (@smart_proxy.reload.feature_details == old_features) ? _("No changes found when refreshing features from %s.") : _("Successfully refreshed features from %s.")
process_success :object => @smart_proxy, :success_msg => msg % @smart_proxy.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 import_host
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.import_host(hostname, certname = nil)
raise(::Foreman::Exception.new("Invalid Hostname, must be a String")) unless hostname.is_a?(String)
# downcase everything
hostname.try(:downcase!)
- 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 search_by_admin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.search_by_admin(key, operator, value)
value = value == 'true'
value = !value if operator == '<>'
conditions = [table_name, Usergroup.table_name].map do |base|
"(#{base}.admin = ?" + (value ? ')' : " OR #{base}.admin IS NULL)")
- 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 expire_logs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def expire_logs
from = (params[:from].to_i rescue 0) || 0
if from >= 0
logger.debug "Expired smart-proxy logs, new timestamp is #{from}"
@smart_proxy.expired_logs = from.to_s
- 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 permitted_actions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def permitted_actions(template)
actions = [
display_link_if_authorized(_('Clone'), template_hash_for_member(template, 'clone_template')),
display_link_if_authorized(_('Export'), template_hash_for_member(template, 'export'), { :data => { :no_turbolink => 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 allowed_to?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def allowed_to?(action)
return false if disabled?
return true if admin?
if action.is_a?(Hash) || action.is_a?(ActionController::Parameters)
action = Foreman::AccessControl.normalize_path_hash(action)
- 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_permissions_for_changing_login
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_permissions_for_changing_login
if login_changed? && !new_record?
if !internal?
errors.add :login, _("It is not possible to change external users login")
elsif !(User.current.can?(:edit_users, self) || (id == User.current.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 alert_header
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def alert_header(text, html_class = nil)
case html_class
when /alert-success/
icon = icon_text("ok", "", :kind => "pficon")
text ||= _("Notice")
- 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_defaults
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_defaults
self.port ||= DEFAULT_PORTS[:ldap]
self.attr_login ||= 'uid'
self.attr_firstname ||= 'givenName'
self.attr_lastname ||= 'sn'
- 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 taxonomy_conditions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.taxonomy_conditions
conditions = {}
if Organization.current.nil? && User.current.present? && !User.current.admin?
conditions[:organization_id] = User.current.organization_and_child_ids
else
- 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_lookup_value_fqdn_matchers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_lookup_value_fqdn_matchers
return unless primary?
return unless saved_change_to_fqdn?
return unless host.present?
LookupValue.where(:match => "fqdn=#{fqdn_before_last_save}").
- 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_subnet_from_facts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_subnet_from_facts(iface, keep_subnet)
return if Setting[:update_subnets_from_facts] == 'none' || keep_subnet
return if Setting[:update_subnets_from_facts] == 'provision' && !iface.provision
iface.subnet = Subnet.subnet_for(iface.ip) if iface.ip_changed? && !iface.matches_subnet?(:ip, :subnet)
iface.subnet6 = Subnet.subnet_for(iface.ip6) if iface.ip6_changed? && !iface.matches_subnet?(:ip6, :subnet6)
- 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 process_parameter_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_parameter_attributes
model_params = params[parameter_method_mapping]
return unless model_params
parameter_params = model_params["#{parameter_class_mapping}_parameters_attributes"]
return unless parameter_params
- 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 global_registration_vars
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def global_registration_vars
permitted = Foreman::Plugin.all
.map(&:allowed_registration_vars)
.flatten.compact.uniq
- 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"