cloudamatic/mu

View on GitHub

Showing 255 of 2,705 total issues

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

    Avoid deeply nested control flow statements.
    Open

                  if disable
                    attr[:userAccountControl] = (attr[:userAccountControl].to_i & AD_PW_ATTRS['disable']).to_s
                  end
    Severity: Major
    Found in modules/mu/master/ldap.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

                          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

                              if policy['target_tracking_configuration']["preferred_target_group"] and
                                 lb["targetgroups"][policy['target_tracking_configuration']["preferred_target_group"]]
                                lb["arn"].split(/:/)[5].sub(/^loadbalancer\//, "")+"/"+lb["targetgroups"][policy['target_tracking_configuration']["preferred_target_group"]].split(/:/)[5]
                              else
                                if policy['target_tracking_configuration']["preferred_target_group"]
          Severity: Major
          Found in modules/mu/providers/aws/server_pool.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 tier[:value].is_a?(Hash)
                            if name
                              tier[:value].delete("entity")
                              tier[:value].delete(name.sub(/\[.*/, '')) if name
                            end
              Severity: Major
              Found in modules/mu/adoption.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          elsif cfg.id
                            littermate = deploy.findLitterMate(type: cfg.type, cloud_id: cfg.id, habitat: cfg.habitat)
                            if littermate and littermate.config['name']
                              hashcfg['name'] = littermate.config['name']
                              hashcfg.delete("id") if hashcfg["name"]
                Severity: Major
                Found in modules/mu/adoption.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 !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

                                    unless policy['type']
                                      MU.log "You must specify a 'type' 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 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

                                            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 sib_by_name.size == 1
                                              @vpc = sib_by_name.values.first
                                              MU.log "Single VPC match for #{self}", loglevel, details: @vpc.to_s
                                            else
                            # XXX ok but this is the wrong place for this really the config parser needs to sort this out somehow
                            Severity: Major
                            Found in modules/mu/cloud/resource_base.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 public
                                                      { "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PublicDnsName"] }
                                                    else
                                                      { "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PrivateDnsName"] }
                                                    end
                                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 wait >= 30
                                                    MU.log "User #{user} has been created in LDAP, but local system can't see it. Are PAM/LDAP configured correctly?", MU::ERR
                                                    return false
                                                  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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language