ekristen/gcp-nuke

View on GitHub

Showing 28 of 55 total issues

Function New has 94 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func New(ctx context.Context, projectID, impersonateServiceAccount string) (*GCP, error) {
    gcp := &GCP{
        Organizations: make([]*Organization, 0),
        Projects:      make([]*Project, 0),
        Regions:       []string{"global"},
Severity: Major
Found in pkg/gcputil/gcp.go - About 2 hrs to fix

    Function execute has 91 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func execute(c *cli.Context) error {
        ctx, cancel := context.WithCancel(c.Context)
        defer cancel()
    
        gcp, err := gcputil.New(ctx, c.String("project-id"), c.String("impersonate-service-account"))
    Severity: Major
    Found in pkg/commands/run/command.go - About 2 hrs to fix

      Function execute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func execute(c *cli.Context) error {
          project, err := gcputil.New(c.Context, c.String("project-id"), c.String("impersonate-service-account"))
          if err != nil {
              return err
          }
      Severity: Minor
      Found in pkg/commands/project/project.go - About 1 hr to fix

        Method KMSKeyLister.List has 61 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (l *KMSKeyLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
            var resources []resource.Resource
        
            opts := o.(*nuke.ListerOpts)
            if err := opts.BeforeList(nuke.Regional, "cloudkms.googleapis.com"); err != nil {
        Severity: Minor
        Found in resources/kms-key.go - About 1 hr to fix

          Function init has 58 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func init() {
              flags := []cli.Flag{
                  &cli.PathFlag{
                      Name:  "config",
                      Usage: "path to config file",
          Severity: Minor
          Found in pkg/commands/run/command.go - About 1 hr to fix

            Method CloudFunctionLister.List has 55 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (l *CloudFunctionLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
                var resources []resource.Resource
            
                opts := o.(*nuke.ListerOpts)
                if err := opts.BeforeList(nuke.Regional, "cloudfunctions.googleapis.com"); err != nil {
            Severity: Minor
            Found in resources/cloud-function.go - About 1 hr to fix

              Method IAMWorkloadIdentityPoolProviderLister.List has 52 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (l *IAMWorkloadIdentityPoolProviderLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
                  var resources []resource.Resource
              
                  opts := o.(*nuke.ListerOpts)
                  if err := opts.BeforeList(nuke.Global, "iam.googleapis.com"); err != nil {
              Severity: Minor
              Found in resources/iam-workload-identity-pool-provider.go - About 1 hr to fix

                Function New has 10 return statements (exceeds 4 allowed).
                Open

                func New(ctx context.Context, projectID, impersonateServiceAccount string) (*GCP, error) {
                    gcp := &GCP{
                        Organizations: make([]*Organization, 0),
                        Projects:      make([]*Project, 0),
                        Regions:       []string{"global"},
                Severity: Major
                Found in pkg/gcputil/gcp.go - About 1 hr to fix

                  Function execute has 6 return statements (exceeds 4 allowed).
                  Open

                  func execute(c *cli.Context) error {
                      ctx, cancel := context.WithCancel(c.Context)
                      defer cancel()
                  
                      gcp, err := gcputil.New(ctx, c.String("project-id"), c.String("impersonate-service-account"))
                  Severity: Major
                  Found in pkg/commands/run/command.go - About 40 mins to fix

                    Method FirebaseRealtimeDatabase.EmptyDefaultDatabase has 6 return statements (exceeds 4 allowed).
                    Open

                    func (r *FirebaseRealtimeDatabase) EmptyDefaultDatabase(ctx context.Context) error {
                        if r.settings == nil {
                            return nil
                        }
                    
                    
                    Severity: Major
                    Found in resources/firebase-realtime-database.go - About 40 mins to fix

                      Method FirebaseDatabaseService.ListDatabaseInstances has 5 return statements (exceeds 4 allowed).
                      Open

                      func (s *FirebaseDatabaseService) ListDatabaseInstances(ctx context.Context, parent string) ([]*DatabaseInstance, error) {
                          url1 := fmt.Sprintf("%sv1beta/%s/instances", s.BasePath, parent)
                          logrus.Tracef("url: %s", url1)
                      
                          req, err := http.NewRequestWithContext(ctx, http.MethodGet, url1, nil)
                      Severity: Major
                      Found in pkg/gcputil/firebase.go - About 35 mins to fix

                        Method VPCGlobalIPAddress.HandleWait has 5 return statements (exceeds 4 allowed).
                        Open

                        func (r *VPCGlobalIPAddress) HandleWait(ctx context.Context) error {
                            if r.removeOp == nil {
                                return nil
                            }
                        
                        
                        Severity: Major
                        Found in resources/vpc-global-ip-address.go - About 35 mins to fix

                          Method ComputeForwardingRule.HandleWait has 5 return statements (exceeds 4 allowed).
                          Open

                          func (r *ComputeForwardingRule) HandleWait(ctx context.Context) error {
                              if r.removeOp == nil {
                                  return nil
                              }
                          
                          
                          Severity: Major
                          Found in resources/compute-forwarding-rule.go - About 35 mins to fix

                            Method CloudFunctionLister.List has 5 return statements (exceeds 4 allowed).
                            Open

                            func (l *CloudFunctionLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
                                var resources []resource.Resource
                            
                                opts := o.(*nuke.ListerOpts)
                                if err := opts.BeforeList(nuke.Regional, "cloudfunctions.googleapis.com"); err != nil {
                            Severity: Major
                            Found in resources/cloud-function.go - About 35 mins to fix

                              Method VPCNetwork.HandleWait has 5 return statements (exceeds 4 allowed).
                              Open

                              func (r *VPCNetwork) HandleWait(ctx context.Context) error {
                                  if r.removeOp == nil {
                                      return nil
                                  }
                              
                              
                              Severity: Major
                              Found in resources/vpc-network.go - About 35 mins to fix

                                Method GKECluster.HandleWait has 5 return statements (exceeds 4 allowed).
                                Open

                                func (r *GKECluster) HandleWait(ctx context.Context) error {
                                    if r.removeOp == nil {
                                        return nil
                                    }
                                
                                
                                Severity: Major
                                Found in resources/gke-cluster.go - About 35 mins to fix

                                  Method FirebaseRealtimeDatabaseLister.List has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (l *FirebaseRealtimeDatabaseLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
                                      var resources []resource.Resource
                                  
                                      opts := o.(*nuke.ListerOpts)
                                      if err := opts.BeforeList(nuke.Regional, "firebasedatabase.googleapis.com"); err != nil {
                                  Severity: Major
                                  Found in resources/firebase-realtime-database.go - About 35 mins to fix

                                    Method ComputeTargetHTTPSProxy.HandleWait has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (r *ComputeTargetHTTPSProxy) HandleWait(ctx context.Context) error {
                                        if r.removeOp == nil {
                                            return nil
                                        }
                                    
                                    
                                    Severity: Major
                                    Found in resources/compute-target-https-proxy.go - About 35 mins to fix

                                      Method ComputeSecurityPolicy.HandleWait has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (r *ComputeSecurityPolicy) HandleWait(ctx context.Context) error {
                                          if r.removeOp == nil {
                                              return nil
                                          }
                                      
                                      
                                      Severity: Major
                                      Found in resources/compute-security-policy.go - About 35 mins to fix

                                        Method ComputeBackendService.HandleWait has 5 return statements (exceeds 4 allowed).
                                        Open

                                        func (r *ComputeBackendService) HandleWait(ctx context.Context) error {
                                            if r.removeOp == nil {
                                                return nil
                                            }
                                        
                                        
                                        Severity: Major
                                        Found in resources/compute-backend-service.go - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language