ekristen/aws-nuke

View on GitHub

Showing 26 of 34 total issues

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

func execute(c *cli.Context) error { //nolint:funlen,gocyclo
    ctx, cancel := context.WithCancel(c.Context)
    defer cancel()

    defaultRegion := c.String("default-region")
Severity: Major
Found in pkg/commands/nuke/nuke.go - About 3 hrs to fix

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

    func init() { //nolint:funlen
        flags := []cli.Flag{
            &cli.PathFlag{
                Name:    "config",
                Aliases: []string{"c"},
    Severity: Major
    Found in pkg/commands/nuke/nuke.go - About 3 hrs to fix

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

      func execute(c *cli.Context) error { //nolint:funlen,gocyclo
          accountID := c.String("account-id")
      
          parsedConfig, err := config.New(libconfig.Options{
              Path:         c.Path("config"),
      Severity: Major
      Found in pkg/commands/config/config.go - About 2 hrs to fix

        Function main has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
        Open

        func main() { //nolint:funlen,gocyclo
            args := os.Args[1:]
        
            if len(args) == 0 {
                panic("no arguments given")
        Severity: Minor
        Found in tools/compare-resources/main.go - About 2 hrs 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 GlobalAcceleratorEndpointGroupLister.List has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
        Open

        func (l *GlobalAcceleratorEndpointGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
            opts := o.(*nuke.ListerOpts)
        
            svc := globalaccelerator.New(opts.Session)
            var acceleratorARNs []*string
        Severity: Minor
        Found in resources/ga-endpoints.go - About 2 hrs 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

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

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

          Method CloudFormationStack.doRemove has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
          Open

          func (cfs *CloudFormationStack) doRemove() error { //nolint:gocyclo
              if cfs.stack.ParentId != nil {
                  p, err := GetParentStack(cfs.svc, *cfs.stack.ParentId)
                  if err != nil {
                      return err
          Severity: Minor
          Found in resources/cloudformation-stack.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 ELBv2ListenerRuleLister.List has 72 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            Method CloudFormationStack.doRemove has 69 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (cfs *CloudFormationStack) doRemove() error { //nolint:gocyclo
                if cfs.stack.ParentId != nil {
                    p, err := GetParentStack(cfs.svc, *cfs.stack.ParentId)
                    if err != nil {
                        return err
            Severity: Minor
            Found in resources/cloudformation-stack.go - About 1 hr to fix

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

              func (l *ELBv2ListenerRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                  opts := o.(*nuke.ListerOpts)
              
                  svc := elbv2.New(opts.Session)
              
              
              Severity: Minor
              Found in resources/elbv2-listenerrule.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

              Function NewAccount has 63 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func NewAccount(creds *Credentials, endpoints config.CustomEndpoints) (*Account, error) {
                  creds.CustomEndpoints = endpoints
                  account := Account{
                      Credentials: creds,
                  }
              Severity: Minor
              Found in pkg/awsutil/account.go - About 1 hr to fix

                Method GlobalAcceleratorEndpointGroupLister.List has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

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

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

                  func (l *TransferServerUserLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                      opts := o.(*nuke.ListerOpts)
                  
                      svc := transfer.New(opts.Session)
                      resources := make([]resource.Resource, 0)
                  Severity: Minor
                  Found in resources/transfer-server-user.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

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

                  func execute(c *cli.Context) error { //nolint:funlen,gocyclo
                      accountID := c.String("account-id")
                  
                      parsedConfig, err := config.New(libconfig.Options{
                          Path:         c.Path("config"),
                  Severity: Minor
                  Found in pkg/commands/config/config.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

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

                  func execute(c *cli.Context) error { //nolint:funlen,gocyclo
                      ctx, cancel := context.WithCancel(c.Context)
                      defer cancel()
                  
                      defaultRegion := c.String("default-region")
                  Severity: Minor
                  Found in pkg/commands/nuke/nuke.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

                  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

                    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 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 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 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

                          Severity
                          Category
                          Status
                          Source
                          Language