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 {
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
}
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"},
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
- Read upRead up
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)
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)
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
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
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
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{}
- Read upRead up
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{}
- Read upRead up
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)
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
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()
- Read upRead up
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)
- Read upRead up
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 {
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) {
- Read upRead up
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{
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)
- Read upRead up
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)
- Read upRead up
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"