XR006

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2021 License: MPL-2.0 Imports: 4 Imported by: 2

README

XR006

The XR006 analyzer reports extraneous Timeouts fields in resources where the corresponding Create/CreateContext, Delete/DeleteContext, Read/ReadContext, or Update/UpdateContext implementation does not exist.

Flagged Code

&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
  Timeouts: schema.ResourceTimesout{
    Create: schema.DefaultTimeout(10 * time.Minute),
  },
}

Passing Code

// Fixed Timeouts field alignment
&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
  Timeouts: schema.ResourceTimesout{
    Read: schema.DefaultTimeout(10 * time.Minute),
  },
}

// Removed Timeouts
&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
}

Ignoring Reports

Singular reports can be ignored by adding the a //lintignore:XR006 Go code comment at the end of the offending line or on the line immediately proceding, e.g.

//lintignore:XR006
&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
  Timeouts: schema.ResourceTimesout{
    Create: schema.DefaultTimeout(10 * time.Minute),
  },
}

Documentation

Index

Constants

View Source
const Doc = `` /* 257-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc:  Doc,
	Requires: []*analysis.Analyzer{
		commentignore.Analyzer,
		resourceinfo.Analyzer,
	},
	Run: run,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL