ekristen/aws-nuke

View on GitHub

Showing 44 of 54 total issues

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

func (l *IoTSiteWiseAccessPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { //nolint:gocyclo
    opts := o.(*nuke.ListerOpts)

    svc := iotsitewise.New(opts.Session)
    resources := make([]resource.Resource, 0)
Severity: Minor
Found in resources/iotsitewise-access-policy.go - About 6 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 IoTSiteWiseDashboardLister.List has a Cognitive Complexity of 45 (exceeds 20 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 4 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 execute has 124 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 111 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 107 lines of code (exceeds 50 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: Major
      Found in tools/generate-docs/docs.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

          Method IoTSiteWiseAccessPolicyLister.List has 77 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (l *IoTSiteWiseAccessPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { //nolint:gocyclo
              opts := o.(*nuke.ListerOpts)
          
              svc := iotsitewise.New(opts.Session)
              resources := make([]resource.Resource, 0)
          Severity: Major
          Found in resources/iotsitewise-access-policy.go - About 2 hrs to fix

            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 KMSKeyLister.List has 70 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (l *KMSKeyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) {
                    opts := o.(*nuke.ListerOpts)
                    resources := make([]resource.Resource, 0)
                
                    var svc kmsiface.KMSAPI
                Severity: Minor
                Found in resources/kms-key.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

                    Function execute has a Cognitive Complexity of 29 (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

                    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

                    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

                      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

                        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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language