cloudamatic/mu

View on GitHub

Showing 255 of 2,705 total issues

Avoid deeply nested control flow statements.
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']
Severity: Major
Found in modules/mu/providers/cloudformation/dnszone.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    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
    Severity: Major
    Found in modules/mu/providers/aws/server_pool.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      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
      Severity: Major
      Found in modules/mu/providers/cloudformation/server.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    for c in (0..(path.size-1)) do
                      path_str << ("  " * (c+2)) + (path[c] || "<nil>")
                    end
        Severity: Major
        Found in modules/mu/adoption.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    plain = (name ? name : type_of) if name or type_of
          Severity: Major
          Found in modules/mu/adoption.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            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
            Severity: Major
            Found in modules/mu/cloud/resource_base.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              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
              Severity: Major
              Found in modules/mu/config/ref.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if !subnet['nat_host_name'].nil?
                                      configurator.nat_routes[subnet['name'].to_s] << subnet['nat_host_name'].to_s
                                    end
                Severity: Major
                Found in modules/mu/config/vpc.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  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
                  Severity: Major
                  Found in modules/mu/mommacat/search.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    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
                    Severity: Major
                    Found in modules/mu/providers/aws/server_pool.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                        raise MuError, "Couldn't find #{dnsrec['mu_type']} #{dnsrec["target"]}" if found.nil? || found.empty?
                      Severity: Major
                      Found in modules/mu/providers/cloudformation/dnszone.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            configurator.nat_routes[subnet['name'].to_s] = [] if configurator.nat_routes[subnet['name'].to_s].nil?
                        Severity: Major
                        Found in modules/mu/config/vpc.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          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
                          Severity: Major
                          Found in modules/mu/providers/aws/server_pool.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                              if sub["endpoint"].match(/^http:/i)
                                                "http"
                                              elsif sub["endpoint"].match(/^https:/i)
                                                "https"
                                              elsif sub["endpoint"].match(/:sqs:/i)
                            Severity: Major
                            Found in modules/mu/providers/aws/notifier.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          slack_path_str += "#{preposition} \*"+path.join(" ⇨ ")+"\*" if path.size > 0
                              Severity: Major
                              Found in modules/mu/adoption.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                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
                                Severity: Major
                                Found in modules/mu/providers/aws/server_pool.rb - About 45 mins to fix

                                  Method initialize has a Cognitive Complexity of 78 (exceeds 75 allowed). Consider refactoring.
                                  Open

                                      def initialize(path, skipinitialupdates = false, params: {}, updating: nil, default_credentials: nil, cloud: nil)
                                        $myPublicIp ||= MU.mu_public_ip
                                        $myRoot ||= MU.myRoot
                                        $myRoot.freeze
                                  
                                  
                                  Severity: Minor
                                  Found in modules/mu/config.rb - About 45 mins to fix

                                  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

                                                  if used_uids.include?(change_uid)
                                                    raise MuLDAPError, "Uid #{change_uid} is unavailable, cannot allocate to user #{user}"
                                                  end
                                  Severity: Major
                                  Found in modules/mu/master/ldap.rb - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                    if used_uids.include?(change_uid)
                                                      raise MuLDAPError, "Uid #{change_uid} is unavailable, cannot allocate to user #{user}"
                                                    end
                                    Severity: Major
                                    Found in modules/mu/master/ldap.rb - About 45 mins to fix

                                      Method generate_dummy_object has 11 arguments (exceeds 10 allowed). Consider refactoring.
                                      Open

                                          def self.generate_dummy_object(type, cloud, name, mu_name, cloud_id, desc, region, habitat, tag_value, calling_deploy, credentials)
                                      Severity: Major
                                      Found in modules/mu/mommacat/search.rb - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language