Skip to content

Commit

Permalink
Enforce machine-readable nolint statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ashanbrown committed Dec 23, 2020
1 parent 908f431 commit 1b24cfe
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ linters-settings:
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-leading-space: false # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ func (e *Executor) executeRun(_ *cobra.Command, args []string) {

// to be removed when deadline is finally decommissioned
func (e *Executor) setTimeoutToDeadlineIfOnlyDeadlineIsSet() {
// nolint:staticcheck
//nolint:staticcheck
deadlineValue := e.cfg.Run.Deadline
if deadlineValue != 0 && e.cfg.Run.Timeout == defaultTimeout {
e.cfg.Run.Timeout = deadlineValue
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/gocognit.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// nolint:dupl
//nolint:dupl
package golinters

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/gocyclo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// nolint:dupl
//nolint:dupl
package golinters

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/godot.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewGodot() *goanalysis.Linter {
}

// Convert deprecated setting
if cfg.CheckAll { // nolint: staticcheck
if cfg.CheckAll { //nolint: staticcheck
settings.Scope = godot.TopLevelScope
}

Expand Down
1 change: 0 additions & 1 deletion pkg/golinters/scopelint.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ func (f *Node) Visit(node ast.Node) ast.Visitor {
// The variadic arguments may start with link and category types,
// and must end with a format string and any arguments.
// It returns the new Problem.
//nolint:interfacer
func (f *Node) errorf(n ast.Node, format string, args ...interface{}) {
pos := f.fset.Position(n.Pos())
f.errorAtf(pos, format, args...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/structcheck.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package golinters // nolint:dupl
package golinters //nolint:dupl

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/varcheck.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package golinters // nolint:dupl
package golinters //nolint:dupl

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion pkg/result/processors/base_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (r *baseRule) matchLinter(issue *result.Issue) bool {
return false
}

func (r *baseRule) matchSource(issue *result.Issue, lineCache *fsutils.LineCache, log logutils.Log) bool { // nolint:interfacer
func (r *baseRule) matchSource(issue *result.Issue, lineCache *fsutils.LineCache, log logutils.Log) bool { //nolint:interfacer
sourceLine, errSourceLine := lineCache.GetLine(issue.FilePath(), issue.Line())
if errSourceLine != nil {
log.Warnf("Failed to get line %s:%d from line cache: %s", issue.FilePath(), issue.Line(), errSourceLine)
Expand Down
2 changes: 1 addition & 1 deletion scripts/expand_website_templates/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type latestRelease struct {
}

func getLatestVersion() (string, error) {
req, err := http.NewRequest( // nolint:noctx
req, err := http.NewRequest( //nolint:noctx
http.MethodGet,
"https://api.github.com/repos/golangci/golangci-lint/releases/latest",
nil,
Expand Down

0 comments on commit 1b24cfe

Please sign in to comment.