Showing 255 of 2,705 total issues
Avoid deeply nested control flow statements. Open
Open
if dnsrec["type"] == "CNAME"
if public
deploydata['public_dns_name'].empty? ? deploydata['private_dns_name'] : deploydata['public_dns_name']
else
deploydata['private_dns_name']
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
if !@config["vpc"]["vpc_name"].nil? and @dependencies.has_key?("vpc") and @dependencies["vpc"].has_key?(@config["vpc"]["vpc_name"])
igw_name, igw_template = MU::Cloud::CloudFormation.cloudFormationBase("vpcgwattach", name: @dependencies["vpc"][@config["vpc"]["vpc_name"]].cloudobj.mu_name, scrub_mu_isms: @config['scrub_mu_isms'])
MU::Cloud::CloudFormation.setCloudFormationProp(eip_template[eip_name], "DependsOn", igw_name)
end
Avoid deeply nested control flow statements. Open
Open
for c in (0..(path.size-1)) do
path_str << (" " * (c+2)) + (path[c] || "<nil>")
end
Avoid deeply nested control flow statements. Open
Open
plain = (name ? name : type_of) if name or type_of
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
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 !subnet['nat_host_name'].nil?
configurator.nat_routes[subnet['name'].to_s] << subnet['nat_host_name'].to_s
end
Avoid deeply nested control flow statements. Open
Open
MU.log "#{@deploy_id}'s original config has #{@original_config[type].size == 1 ? "a" : @original_config[type].size.to_s} #{type}, but loadObjects could not populate anything from deployment metadata", MU::ERR if !@object_load_fails
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
raise MuError, "Couldn't find #{dnsrec['mu_type']} #{dnsrec["target"]}" if found.nil? || found.empty?
Avoid deeply nested control flow statements. Open
Open
configurator.nat_routes[subnet['name'].to_s] = [] if configurator.nat_routes[subnet['name'].to_s].nil?
Avoid deeply nested control flow statements. Open
Open
if step["lower_bound"].nil? && step["upper_bound"].nil?
MU.log "You must specify 'lower_bound' and/or upper_bound for 'step_adjustments' when 'policy_type' is set to 'StepScaling'", MU::ERR
ok = false
end
Avoid deeply nested control flow statements. Open
Open
if sub["endpoint"].match(/^http:/i)
"http"
elsif sub["endpoint"].match(/^https:/i)
"https"
elsif sub["endpoint"].match(/:sqs:/i)
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
if step["adjustment"].nil?
MU.log "You must specify 'adjustment' for 'step_adjustments' when 'policy_type' is set to 'StepScaling'", MU::ERR
ok = false
end
Method initialize
has a Cognitive Complexity of 78 (exceeds 75 allowed). Consider refactoring. Open
Open
def initialize(path, skipinitialupdates = false, params: {}, updating: nil, default_credentials: nil, cloud: nil)
$myPublicIp ||= MU.mu_public_ip
$myRoot ||= MU.myRoot
$myRoot.freeze
- 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 used_uids.include?(change_uid)
raise MuLDAPError, "Uid #{change_uid} is unavailable, cannot allocate to user #{user}"
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)