Showing 255 of 2,705 total issues
Avoid deeply nested control flow statements. Open
Open
if wait >= 30
MU.log "User #{user} has been created in LDAP, but local system can't see it. Are PAM/LDAP configured correctly?", MU::ERR
return false
end
Avoid deeply nested control flow statements. Open
Open
if public
# Make sure we have a public IP address to register. Use the private one if we don't
server.cloud_desc.public_ip_address ? server.cloud_desc.public_ip_address : server.cloud_desc.private_ip_address
else
# If we specifically requested to register the private IP lets use that
Avoid deeply nested control flow statements. Open
Open
ok = false if !insertKitten(siblingvpc, "vpcs", overwrite: overwrite)
Avoid deeply nested control flow statements. Open
Open
if File.exist?(example_path)
example = "#\n# Examples:\n#\n"
# XXX these variables are all parameters from the BoKs in
# modules/tests. A really clever implementation would read
# and parse them to get default values, perhaps, instead of
Avoid deeply nested control flow statements. Open
Open
if mu_acct
attr[:userAccountControl] = (attr[:userAccountControl].to_i & AD_PW_ATTRS['pwdNeverExpires']).to_s
end
Method create
has a Cognitive Complexity of 78 (exceeds 75 allowed). Consider refactoring. Open
Open
def create
# RDS is picky, we can't just use our regular node names for things
# like the default schema or username. And it varies from engine to
# engine.
basename = @config["name"].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
Avoid deeply nested control flow statements. Open
Open
if public
{ "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PublicDnsName"] }
else
{ "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PrivateDnsName"] }
end
Avoid deeply nested control flow statements. Open
Open
hashcfg.delete("id") if hashcfg["name"]
Avoid deeply nested control flow statements. Open
Open
if policy['target_tracking_configuration']["preferred_target_group"] and
lb["targetgroups"][policy['target_tracking_configuration']["preferred_target_group"]]
lb["arn"].split(/:/)[5].sub(/^loadbalancer\//, "")+"/"+lb["targetgroups"][policy['target_tracking_configuration']["preferred_target_group"]].split(/:/)[5]
else
if policy['target_tracking_configuration']["preferred_target_group"]
Avoid deeply nested control flow statements. Open
Open
MU.log "No base image for platform #{platform} in cloud #{cloud} region #{region} found", MU::WARN if !quiet
Avoid deeply nested control flow statements. Open
Open
if sib_by_name.size == 1
@vpc = sib_by_name.values.first
MU.log "Single VPC match for #{self}", loglevel, details: @vpc.to_s
else
# XXX ok but this is the wrong place for this really the config parser needs to sort this out somehow
Avoid deeply nested control flow statements. Open
Open
my_cidr = nil if my_cidr.to_s.match(/^10\.255\./)
Avoid deeply nested control flow statements. Open
Open
server.cloud_desc.public_dns_name.empty? ? server.cloud_desc.private_dns_name : server.cloud_desc.public_dns_name
Avoid deeply nested control flow statements. Open
Open
if disable
attr[:userAccountControl] = (attr[:userAccountControl].to_i & AD_PW_ATTRS['disable']).to_s
end
Avoid deeply nested control flow statements. Open
Open
raise MuError, "Couldn't find #{dnsrec['mu_type']} #{dnsrec["target"]}" if found.nil? || found.empty?
Avoid deeply nested control flow statements. Open
Open
rescue StandardError => e
MU.log "Failed to fetch #{cryptfile} from Cloud Storage bucket #{MU.adminBucketName}", MU::ERR, details: e.inspect
%x{/bin/dd if=/dev/urandom of=#{temp_dev} bs=1M count=1 > /dev/null 2>&1}
raise e
Avoid deeply nested control flow statements. Open
Open
if ![:removed].include?(tier[:action])
myreport["slack"] += ". New #{tier[:field] ? "`"+tier[:field]+"`" : :value}: \*#{tier[:value]}\*"
else
myreport["slack"] += " (was \*#{tier[:value]}\*)"
end
Avoid deeply nested control flow statements. Open
Open
elsif cfg.id
littermate = deploy.findLitterMate(type: cfg.type, cloud_id: cfg.id, habitat: cfg.habitat)
if littermate and littermate.config['name']
hashcfg['name'] = littermate.config['name']
hashcfg.delete("id") if hashcfg["name"]
Avoid deeply nested control flow statements. Open
Open
unless policy['type']
MU.log "You must specify a 'type' when 'policy_type' is set to 'StepScaling'", MU::ERR
ok = false
end
Avoid deeply nested control flow statements. Open
Open
elsif dnsrec["type"] == "A"
if public
{ "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PublicIp"] }
else
{ "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PrivateIp"] }