Showing 255 of 2,705 total issues
Avoid deeply nested control flow statements. Open
Open
if public
# Make sure we have a public canonical name to register. Use the private one if we don't
deploydata['public_dns_name'].empty? ? deploydata['private_dns_name'] : deploydata['public_dns_name']
else
# If we specifically requested to register the private canonical name lets use that
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
elsif new_args.is_a?(Hash)
new_args[page_markers[paginator]] = new_page
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
return name_only ? "#default" : @@my_hosted_cfg
Avoid deeply nested control flow statements. Open
Open
new_args << {} if new_args.empty?
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
MU.log e.message+" - Google admin bucket #{adminBucketName(credentials)}/#{name} with #{credentials ? credentials : "default"} credentials", MU::DEBUG, details: aclobj
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
MU.log "Disabling CloudFront distribution #{my_name ? my_name : ids[my_arn].id})", MU::NOTICE
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
if acct_num.to_s == name.to_s
@@acct_to_profile_map[name.to_s] = cfg
return name_only ? name.to_s : cfg
end
Avoid deeply nested control flow statements. Open
Open
raise MuError, "No valid credentials available! Either grant admin privileges to machine service account, or manually add a different one with mu-configure" if found.nil?
Avoid deeply nested control flow statements. Open
Open
next if e.message.match(/notFound/)
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
elsif dnsrec["type"] == "A"
if public
# Make sure we have a public IP address to register. Use the private one if we don't
deploydata['public_ip_address'] ? deploydata['public_ip_address'] : deploydata['private_ip_address']
else
Avoid deeply nested control flow statements. Open
Open
rescue ::Google::Apis::ClientError => e
MU.log "Error enabling #{svc_name} in #{project.gsub(/^projects\/([^\/]+)\/.*/, '\1')} for #{method_sym.to_s}: "+ e.message, MU::ERR, details: enable_obj
raise e
Avoid deeply nested control flow statements. Open
Open
MU.log "External Google user specified with no role binding, will grant 'viewer' in #{my_org ? "organization #{my_org.display_name}" : "project #{user['project']}"}", MU::WARN
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
raise e if !e.message.match(/(?:forbidden|notFound): /)