ekristen/aws-nuke

View on GitHub

Showing 44 of 54 total issues

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

func execute(c *cli.Context) error {
    defaultRegion := c.String("default-region")
    creds := nuke.ConfigureCreds(c)

    if err := creds.Validate(); err != nil {
Severity: Minor
Found in pkg/commands/account/account.go - About 1 hr to fix

    Method Credentials.rootConfig has 57 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (c *Credentials) rootConfig(ctx context.Context) (*aws.Config, error) {
        if c.cfg != nil {
            return c.cfg, nil
        }
    
    
    Severity: Minor
    Found in pkg/awsutil/config.go - About 1 hr to fix

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

      func init() {
          flags := []cli.Flag{
              &cli.PathFlag{
                  Name:    "config",
                  Aliases: []string{"c"},
      Severity: Minor
      Found in pkg/commands/account/account.go - About 1 hr to fix

        Method BatchDelete.Delete has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
        Open

        func (d *BatchDelete) Delete(ctx context.Context, iter BatchDeleteIterator, opts ...func(input *s3.DeleteObjectsInput)) error {
            var errs []Error
            var objects []BatchDeleteObject
            var input *s3.DeleteObjectsInput
        
        
        Severity: Minor
        Found in pkg/awsmod/batch.go - About 1 hr 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

        Method ECSTaskLister.List has 56 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (l *ECSTaskLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
            opts := o.(*nuke.ListerOpts)
        
            resources := make([]resource.Resource, 0)
        
        
        Severity: Minor
        Found in resources/ecs-task.go - About 1 hr to fix

          Method IoTSiteWiseDashboardLister.List has 56 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (l *IoTSiteWiseDashboardLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
              opts := o.(*nuke.ListerOpts)
          
              svc := iotsitewise.New(opts.Session)
              resources := make([]resource.Resource, 0)
          Severity: Minor
          Found in resources/iotsitewise-dashboard.go - About 1 hr to fix

            Method AppMeshRouteLister.List has 56 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (l *AppMeshRouteLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                opts := o.(*nuke.ListerOpts)
                svc := appmesh.New(opts.Session)
                var resources []resource.Resource
            
            
            Severity: Minor
            Found in resources/appmesh-route.go - About 1 hr to fix

              Method AppMeshGatewayRouteLister.List has 56 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (l *AppMeshGatewayRouteLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                  opts := o.(*nuke.ListerOpts)
                  svc := appmesh.New(opts.Session)
                  var resources []resource.Resource
              
              
              Severity: Minor
              Found in resources/appmesh-gatewayroute.go - About 1 hr to fix

                Method EKSFargateProfileLister.List has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (l *EKSFargateProfileLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                    opts := o.(*nuke.ListerOpts)
                    svc := eks.New(opts.Session)
                    var clusterNames []*string
                    var resources []resource.Resource
                Severity: Minor
                Found in resources/eks-fargate-profile.go - About 1 hr to fix

                  Method IAMRolePolicyAttachmentLister.List has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (l *IAMRolePolicyAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                      opts := o.(*nuke.ListerOpts)
                  
                      svc := iam.New(opts.Session)
                      roleParams := &iam.ListRolesInput{}
                  Severity: Minor
                  Found in resources/iam-role-policy-attachments.go - About 1 hr 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

                  Method IAMRolePolicyLister.List has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (l *IAMRolePolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                      opts := o.(*nuke.ListerOpts)
                  
                      svc := iam.New(opts.Session)
                      roleParams := &iam.ListRolesInput{}
                  Severity: Minor
                  Found in resources/iam-role-policy.go - About 1 hr 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

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

                  func (l *CloudWatchLogsLogGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                      opts := o.(*nuke.ListerOpts)
                  
                      svc := cloudwatchlogs.New(opts.Session)
                      resources := make([]resource.Resource, 0)
                  Severity: Minor
                  Found in resources/cloudwatchlogs-loggroups.go - About 1 hr to fix

                    Method Credentials.NewSession has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (c *Credentials) NewSession(region, serviceType string) (*session.Session, error) {
                        log.Debugf("creating new session in %s for %s", region, serviceType)
                    
                        global := false
                    
                    
                    Severity: Minor
                    Found in pkg/awsutil/session.go - About 1 hr to fix

                      Function execute has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func execute(c *cli.Context) error { //nolint:funlen,gocyclo
                          var regs registry.Registrations
                      
                          if c.String("resource") == "all" {
                              regs = registry.GetRegistrations()
                      Severity: Minor
                      Found in tools/generate-docs/docs.go - About 55 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

                      Method S3ObjectLister.List has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (l *S3ObjectLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
                          opts := o.(*nuke.ListerOpts)
                          svc := s3.NewFromConfig(*opts.Config)
                      
                          resources := make([]resource.Resource, 0)
                      Severity: Minor
                      Found in resources/s3-objects.go - About 55 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 awsError.Code() == "AccessDeniedException" {
                                                  inaccessibleKeys = true
                                                  logrus.WithError(err).Debug("unable to list tags")
                                                  continue
                                              } else {
                      Severity: Major
                      Found in resources/kms-key.go - About 45 mins to fix

                        Method IoTTwinMakerComponentTypeLister.List has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (l *IoTTwinMakerComponentTypeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                            opts := o.(*nuke.ListerOpts)
                            resources := make([]resource.Resource, 0)
                        
                            if !l.IsSupportedRegion(opts.Region.Name) {
                        Severity: Minor
                        Found in resources/iottwinmaker-component-type.go - 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

                                } else if _, err := cfs.svc.DeleteStack(&cloudformation.DeleteStackInput{
                                    StackName: cfs.stack.StackName,
                                }); err != nil {
                                    return err
                                } else if err := cfs.svc.WaitUntilStackDeleteComplete(&cloudformation.DescribeStacksInput{
                        Severity: Major
                        Found in resources/cloudformation-stack.go - About 45 mins to fix

                          Method S3BucketLister.List has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (l *S3BucketLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
                              opts := o.(*nuke.ListerOpts)
                              svc := s3.NewFromConfig(*opts.Config)
                          
                              buckets, err := DescribeS3Buckets(ctx, svc)
                          Severity: Minor
                          Found in resources/s3-bucket.go - 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

                          Method LexModelBuildingServiceBotAliasLister.List has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (l *LexModelBuildingServiceBotAliasLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                              opts := o.(*nuke.ListerOpts)
                          
                              svc := lexmodelbuildingservice.New(opts.Session)
                              resources := make([]resource.Resource, 0)
                          Severity: Minor
                          Found in resources/lex-model-building-service-bot-alias.go - About 35 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