cloudamatic/mu

View on GitHub

Showing 255 of 2,705 total issues

Avoid deeply nested control flow statements.
Open

                      id.sub!(/:([^:]+)$/, ":"+'\1'+target["path"]) if target["path"]
Severity: Major
Found in modules/mu/providers/aws/role.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if report_data and !report_data.empty?
                    report ||= {}
                    report[elt_namestr] = report_data
                  end
    Severity: Major
    Found in modules/mu.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    rescue StandardError => e
                      MU.log e.inspect, MU::WARN, details: cfg
                      next
      Severity: Major
      Found in modules/mu/providers/aws.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            MU.log "Filesystem #{pool.name}: #{pool.file_system_id} already deleted", MU::NOTICE if e.to_s.start_with?("invalid file system ID")
        Severity: Major
        Found in modules/mu/providers/aws/storage_pool.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              public = dnsrec["target_type"] == "private" ? false : true
          Severity: Major
          Found in modules/mu/providers/aws/dnszone.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'.size] >= type['min_devcies']
                          spare_device = node['glusterfs']['server']['devices'].pop
                          raid_with_spare(node['glusterfs']['server']['raid_dev'], node['glusterfs']['server']['raid_level'], node['glusterfs']['server']['devices'].size, node['glusterfs']['server']['devices'].join(" "), spare_device)
                        end
            Severity: Major
            Found in cookbooks/mu-glusterfs/recipes/server.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                    if bucket_style
                                      statement["Principal"] << { "AWS" => id }
                                    else
                                      statement["Principal"] << id
                                    end
              Severity: Major
              Found in modules/mu/providers/aws/role.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              if cfg['account_number'] and name.to_s == cfg['account_number'].to_s
                                return name_only ? acctname : $MU_CFG['aws'][acctname]
                              end
                Severity: Major
                Found in modules/mu/providers/aws.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if !MU::Cloud::Google.hosted?
                                  raise MuError, "Google Cloud credentials not found in Vault #{vault}:#{item}"
                                end
                  Severity: Major
                  Found in modules/mu/providers/google.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    rescue
                                      MU.log function['code']['zip_file']+" does not contain function.js or index.js, at least one must be present for runtime #{function['runtime']}", MU::ERR
                                      ok = false
                    Severity: Major
                    Found in modules/mu/providers/google/function.rb - About 45 mins to fix

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

                              def self.find(**args)
                                credcfg = MU::Cloud::Google.credConfig(args[:credentials])
                                customer = MU::Cloud::Google.customerID(args[:credentials])
                                my_org = MU::Cloud::Google.getOrg(args[:credentials])
                      
                      
                      Severity: Minor
                      Found in modules/mu/providers/google/role.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 !noop
                                          MU::Cloud::Google.iam(credentials: credentials).delete_project_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

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

                          Avoid deeply nested control flow statements.
                          Open

                                        elsif entitytype == "role"
                                          resp = MU::Cloud::AWS.iam(credentials: @credentials).list_attached_role_policies(
                                            role_name: entityname
                                          )
                          
                          
                          Severity: Major
                          Found in modules/mu/providers/aws/role.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if args[:types].include?(shortclass) and
                                                       !(entity_type == "serviceAccount" and
                                                         MU::Cloud::Google::User.cannedServiceAcctName?(entity))
                                                      MU.log "Role #{@cloud_id}: Skipping #{shortclass} binding for #{entity}; we are adopting that type and will set bindings from that resource", MU::DEBUG
                                                      next
                            Severity: Major
                            Found in modules/mu/providers/google/role.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if retries < 6
                                                        retries = retries + 1
                                                        sleep 10
                                                        retry
                                                      else
                              Severity: Major
                              Found in modules/mu/providers/aws/loadbalancer.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                  "arn:"+(MU::Cloud::AWS.isGovCloud?(@region) ? "aws-us-gov" : "aws")+":iam::aws:policy/"+policy
                                Severity: Major
                                Found in modules/mu/providers/aws/role.rb - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                              path.pop if path.last == name
                                  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

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

                                            def self.validate(db, configurator)
                                              ok = true
                                              read_replicas = []
                                              cluster_nodes = []
                                      
                                      
                                      Severity: Minor
                                      Found in modules/mu/config/database.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language