R005

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

README

R005

The R005 analyzer reports when multiple HasChange() calls in a conditional can be combined into a single HasChanges() call.

Flagged Code

if d.HasChange("attr1") || d.HasChange("attr2") {
  // handle attr1 and attr2 changes
}

Passing Code

if d.HasChanges("attr1", "attr2") {
  // handle attr1 and attr2 changes
}

Ignoring Reports

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

//lintignore:R005
if d.HasChange("attr1") || d.HasChange("attr2") {
  // handle attr1 and attr2 changes
}

Documentation

Overview

Package R005 defines an Analyzer that checks for ResourceData.HasChange() calls that can be combined into a single HasChanges() call.

Index

Constants

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

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc:  Doc,
	Requires: []*analysis.Analyzer{
		commentignore.Analyzer,
		inspect.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