Skip to content

Commit 1b24cfe

Browse files
committed
Enforce machine-readable nolint statements
1 parent 908f431 commit 1b24cfe

File tree

10 files changed

+9
-10
lines changed

10 files changed

+9
-10
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ linters-settings:
5757
misspell:
5858
locale: US
5959
nolintlint:
60-
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
60+
allow-leading-space: false # don't require machine-readable nolint directives (i.e. with no leading space)
6161
allow-unused: false # report any unused nolint directives
6262
require-explanation: false # don't require an explanation for nolint directives
6363
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

pkg/commands/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func (e *Executor) executeRun(_ *cobra.Command, args []string) {
465465

466466
// to be removed when deadline is finally decommissioned
467467
func (e *Executor) setTimeoutToDeadlineIfOnlyDeadlineIsSet() {
468-
// nolint:staticcheck
468+
//nolint:staticcheck
469469
deadlineValue := e.cfg.Run.Deadline
470470
if deadlineValue != 0 && e.cfg.Run.Timeout == defaultTimeout {
471471
e.cfg.Run.Timeout = deadlineValue

pkg/golinters/gocognit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// nolint:dupl
1+
//nolint:dupl
22
package golinters
33

44
import (

pkg/golinters/gocyclo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// nolint:dupl
1+
//nolint:dupl
22
package golinters
33

44
import (

pkg/golinters/godot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func NewGodot() *goanalysis.Linter {
3535
}
3636

3737
// Convert deprecated setting
38-
if cfg.CheckAll { // nolint: staticcheck
38+
if cfg.CheckAll { //nolint: staticcheck
3939
settings.Scope = godot.TopLevelScope
4040
}
4141

pkg/golinters/scopelint.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ func (f *Node) Visit(node ast.Node) ast.Visitor {
163163
// The variadic arguments may start with link and category types,
164164
// and must end with a format string and any arguments.
165165
// It returns the new Problem.
166-
//nolint:interfacer
167166
func (f *Node) errorf(n ast.Node, format string, args ...interface{}) {
168167
pos := f.fset.Position(n.Pos())
169168
f.errorAtf(pos, format, args...)

pkg/golinters/structcheck.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package golinters // nolint:dupl
1+
package golinters //nolint:dupl
22

33
import (
44
"fmt"

pkg/golinters/varcheck.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package golinters // nolint:dupl
1+
package golinters //nolint:dupl
22

33
import (
44
"fmt"

pkg/result/processors/base_rule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (r *baseRule) matchLinter(issue *result.Issue) bool {
5858
return false
5959
}
6060

61-
func (r *baseRule) matchSource(issue *result.Issue, lineCache *fsutils.LineCache, log logutils.Log) bool { // nolint:interfacer
61+
func (r *baseRule) matchSource(issue *result.Issue, lineCache *fsutils.LineCache, log logutils.Log) bool { //nolint:interfacer
6262
sourceLine, errSourceLine := lineCache.GetLine(issue.FilePath(), issue.Line())
6363
if errSourceLine != nil {
6464
log.Warnf("Failed to get line %s:%d from line cache: %s", issue.FilePath(), issue.Line(), errSourceLine)

scripts/expand_website_templates/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ type latestRelease struct {
130130
}
131131

132132
func getLatestVersion() (string, error) {
133-
req, err := http.NewRequest( // nolint:noctx
133+
req, err := http.NewRequest( //nolint:noctx
134134
http.MethodGet,
135135
"https://api.github.com/repos/golangci/golangci-lint/releases/latest",
136136
nil,

0 commit comments

Comments
 (0)