cloudamatic/mu

View on GitHub

Showing 255 of 2,705 total issues

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

    Avoid deeply nested control flow statements.
    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
    Severity: Major
    Found in extras/lambda_waf_domain_blacklist.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          elsif new_args.is_a?(Hash)
                            new_args[page_markers[paginator]] = new_page
      Severity: Major
      Found in modules/mu/providers/aws.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        rescue ::Google::Apis::ClientError => e
        #MU.log e.message, MU::ERR, details: id
        #next
                          next if e.message.match(/notFound/)
                          raise e
        Severity: Major
        Found in modules/mu/providers/google/role.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                            return name_only ? "#default" : @@my_hosted_cfg
          Severity: Major
          Found in modules/mu/providers/aws.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                  new_args << {} if new_args.empty?
            Severity: Major
            Found in modules/mu/providers/aws.rb - About 45 mins to fix

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

                Avoid deeply nested control flow statements.
                Open

                            MU.log e.message+" - Google admin bucket #{adminBucketName(credentials)}/#{name} with #{credentials ? credentials : "default"} credentials", MU::DEBUG, details: aclobj
                Severity: Major
                Found in modules/mu/providers/google.rb - About 45 mins to fix

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

                          def toKitten(**_args)
                  
                            bok = {
                              "cloud" => "Google",
                              "project" => @config['project'],
                  Severity: Minor
                  Found in modules/mu/providers/google/container_cluster.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

                                        MU.log "Disabling CloudFront distribution #{my_name ? my_name : ids[my_arn].id})", MU::NOTICE
                  Severity: Major
                  Found in modules/mu/providers/aws/cdn.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/aws/dnszone.rb - About 45 mins to fix

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

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

                          Avoid deeply nested control flow statements.
                          Open

                                            next if e.message.match(/notFound/)
                          Severity: Major
                          Found in modules/mu/providers/google/role.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if resp
                                              MU.log "Deleting organization role #{resp.name}"
                                              if !noop
                                                MU::Cloud::Google.iam(credentials: credentials).delete_organization_role(id)
                                              end
                            Severity: Major
                            Found in modules/mu/providers/google/role.rb - About 45 mins to fix

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

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

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

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

                                      Avoid deeply nested control flow statements.
                                      Open

                                                        raise e if !e.message.match(/(?:forbidden|notFound): /)
                                      Severity: Major
                                      Found in modules/mu/providers/google/role.rb - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language