Showing 255 of 2,705 total issues
Avoid deeply nested control flow statements. Open
Open
if @dependencies.has_key?(dnsrec['mu_type']) && dnsrec['deploy_id'].nil?
@dependencies[dnsrec['mu_type']][dnsrec['target']].deploydata['endpoint']
elsif dnsrec['deploy_id']
found = MU::MommaCat.findStray("AWS", "database", deploy_id: dnsrec["deploy_id"], mu_name: dnsrec["target"], region: @region)
raise MuError, "Couldn't find #{dnsrec['mu_type']} #{dnsrec["target"]}" if found.nil? || found.empty?
Avoid deeply nested control flow statements. Open
Open
if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'.size] >= type['min_devcies']
spare_device = node['glusterfs']['server']['devices'].pop
raid_with_spare(node['glusterfs']['server']['raid_dev'], node['glusterfs']['server']['raid_level'], node['glusterfs']['server']['devices'].size, node['glusterfs']['server']['devices'].join(" "), spare_device)
end
Avoid deeply nested control flow statements. Open
Open
if resp
MU.log "Deleting organization role #{resp.name}"
if !noop
MU::Cloud::Google.iam(credentials: credentials).delete_organization_role(id)
end
Avoid deeply nested control flow statements. Open
Open
rescue Aws::EFS::Errors::BadRequest => e
MU.log "Mount target #{mp.mount_target_id} already deleted", MU::NOTICE if e.to_s.start_with?("invalid mount target ID")
Avoid deeply nested control flow statements. Open
Open
if re.search(regex, results[ip]) or results[ip] == dom:
print("Blocking IP "+ip+". Request from '"+results[ip]+"' matched blacklist entry. LB log was: "+key)
addIPToWAFBlacklist(ip)
return True
Avoid deeply nested control flow statements. Open
Open
if acct_num.to_s == name.to_s
@@acct_to_profile_map[name.to_s] = cfg
return name_only ? name.to_s : cfg
end
Method toKitten
has a Cognitive Complexity of 78 (exceeds 75 allowed). Consider refactoring. Open
Open
def toKitten(**_args)
bok = {
"cloud" => "Google",
"project" => @config['project'],
- 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
next if e.message.match(/notFound/)
Avoid deeply nested control flow statements. Open
Open
rescue ::Google::Apis::ClientError => e
#MU.log e.message, MU::ERR, details: id
#next
next if e.message.match(/notFound/)
raise e
Avoid deeply nested control flow statements. Open
Open
"arn:"+(MU::Cloud::AWS.isGovCloud?(@region) ? "aws-us-gov" : "aws")+":iam::aws:policy/"+policy
Avoid deeply nested control flow statements. Open
Open
if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'].size >= type['min_devcies']
raid_no_spare(node['glusterfs']['server']['raid_dev'], node['glusterfs']['server']['raid_level'], node['glusterfs']['server']['devices'].size, node['glusterfs']['server']['devices'].join(" "))
end
Avoid deeply nested control flow statements. Open
Open
if name.nil?
# Aws.config = {
# access_key_id: data['access_key'],
# secret_access_key: data['access_secret'],
# region: cred_cfg['region']
Avoid deeply nested control flow statements. Open
Open
if args[:types].include?(shortclass) and
!(entity_type == "serviceAccount" and
MU::Cloud::Google::User.cannedServiceAcctName?(entity))
MU.log "Role #{@cloud_id}: Skipping #{shortclass} binding for #{entity}; we are adopting that type and will set bindings from that resource", MU::DEBUG
next
Avoid deeply nested control flow statements. Open
Open
raise e if !e.message.match(/(?:forbidden|notFound): /)
Avoid deeply nested control flow statements. Open
Open
public = dnsrec["target_type"] == "private" ? false : true
Avoid deeply nested control flow statements. Open
Open
if tg_name = @deploy.getResourceName(tg_cfg["name"], max_length: 32, disallowed_chars: /[^A-Za-z0-9-]/)
tg_name = tg_cfg['name']
break
end
Avoid deeply nested control flow statements. Open
Open
id.sub!(/:([^:]+)$/, ":"+'\1'+target["path"]) if target["path"]
Avoid deeply nested control flow statements. Open
Open
if policy["step_adjustments"].nil? || policy["step_adjustments"].empty?
MU.log "You must specify 'step_adjustments' when 'policy_type' is set to 'StepScaling'", MU::ERR
ok = false
end
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
server.cloud_desc.public_dns_name.empty? ? server.cloud_desc.private_dns_name : server.cloud_desc.public_dns_name