Showing 255 of 2,705 total issues
Method validate
has a Cognitive Complexity of 78 (exceeds 75 allowed). Consider refactoring. Open
Open
def self.validate(db, configurator)
ok = true
read_replicas = []
cluster_nodes = []
- 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
# 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
raise MuError, "Couldn't find #{dnsrec['mu_type']} #{dnsrec["target"]}" if found.nil? || found.empty?
Avoid deeply nested control flow statements. Open
Open
slack_path_str += "#{preposition} \*"+path.join(" ⇨ ")+"\*" if path.size > 0
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
ok = false if !insertKitten(siblingvpc, "vpcs", overwrite: overwrite)
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
if mu_acct
attr[:userAccountControl] = (attr[:userAccountControl].to_i & AD_PW_ATTRS['pwdNeverExpires']).to_s
end
Avoid deeply nested control flow statements. Open
Open
if step["adjustment"] >= 1 && policy["estimated_instance_warmup"].nil?
MU.log "You must specify 'estimated_instance_warmup' when 'policy_type' is set to 'StepScaling' and adding capacity", 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"] }
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
path.pop if path.last == name
Avoid deeply nested control flow statements. Open
Open
if @config['basis'] and !unq.nil? and !unq.empty?
@mu_windows_name = @deploy.getResourceName(@config['name'], max_length: 15, need_unique_string: true, use_unique_string: unq, reuse_unique_string: true)
else
@mu_windows_name = @deploy.getResourceName(@config['name'], max_length: 15, need_unique_string: true)
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 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 ![: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
hashcfg.delete("id") if hashcfg["name"]
Avoid deeply nested control flow statements. Open
Open
if @type == "folders"
MU.log "would assign name '#{@obj.mu_name}' in ref to this folder if I were feeling aggressive", MU::WARN, details: self.to_h
end
Avoid deeply nested control flow statements. Open
Open
if used_uids.include?(change_uid)
raise MuLDAPError, "Uid #{change_uid} is unavailable, cannot allocate to user #{user}"
end
Method generate_dummy_object
has 11 arguments (exceeds 10 allowed). Consider refactoring. Open
Open
def self.generate_dummy_object(type, cloud, name, mu_name, cloud_id, desc, region, habitat, tag_value, calling_deploy, credentials)