Skip to content

Commit fd997ed

Browse files
tpoundsjirfag
authored andcommitted
Cleanup nolint directives. (#779)
1 parent 202e6f9 commit fd997ed

File tree

11 files changed

+12
-28
lines changed

11 files changed

+12
-28
lines changed

.golangci.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,17 @@ linters:
8585
- whitespace
8686

8787
# don't enable:
88-
# - godox
89-
# - maligned,prealloc
9088
# - gochecknoglobals
89+
# - gocognit
90+
# - godox
91+
# - maligned
92+
# - prealloc
9193

9294
run:
9395
skip-dirs:
9496
- test/testdata_etc
9597
- internal/(cache|renameio|robustio)
9698

97-
issues:
98-
exclude-rules:
99-
- text: "weak cryptographic primitive"
100-
linters:
101-
- gosec
102-
10399
# golangci.com configuration
104100
# https://github.com/golangci/golangci/wiki/Configuration
105101
service:

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -969,21 +969,17 @@ linters:
969969
- whitespace
970970
971971
# don't enable:
972-
# - godox
973-
# - maligned,prealloc
974972
# - gochecknoglobals
973+
# - gocognit
974+
# - godox
975+
# - maligned
976+
# - prealloc
975977
976978
run:
977979
skip-dirs:
978980
- test/testdata_etc
979981
- internal/(cache|renameio|robustio)
980982
981-
issues:
982-
exclude-rules:
983-
- text: "weak cryptographic primitive"
984-
linters:
985-
- gosec
986-
987983
# golangci.com configuration
988984
# https://github.com/golangci/golangci/wiki/Configuration
989985
service:

internal/cache/cache.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ func (c *Cache) get(id ActionID) (Entry, error) {
159159
eid, entry := entry[3:3+hexSize], entry[3+hexSize:]
160160
eout, entry := entry[1:1+hexSize], entry[1+hexSize:]
161161
esize, entry := entry[1:1+20], entry[1+20:]
162-
//lint:ignore SA4006 See https://github.com/dominikh/go-tools/issues/465
163-
etime, entry := entry[1:1+20], entry[1+20:] //nolint:staticcheck
162+
etime, entry := entry[1:1+20], entry[1+20:]
164163
var buf [HashSize]byte
165164
if _, err := hex.Decode(buf[:], eid); err != nil || buf != id {
166165
return missing()

pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ type Issues struct {
342342
NeedFix bool `mapstructure:"fix"`
343343
}
344344

345-
type Config struct { //nolint:maligned
345+
type Config struct {
346346
Run Run
347347

348348
Output struct {

pkg/config/config_gocritic.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ func (s *GocriticSettings) gocriticDisabledCheckersDebugf() {
9797
}
9898
}
9999

100-
//nolint:gocyclo
101100
func (s *GocriticSettings) InferEnabledChecks(log logutils.Log) {
102101
gocriticCheckerTagsDebugf()
103102

@@ -175,7 +174,6 @@ func validateStringsUniq(ss []string) error {
175174
return nil
176175
}
177176

178-
//nolint:gocyclo
179177
func (s *GocriticSettings) Validate(log logutils.Log) error {
180178
if len(s.EnabledTags) == 0 {
181179
if len(s.EnabledChecks) != 0 && len(s.DisabledChecks) != 0 {

pkg/golinters/goanalysis/runner.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ func newRunner(prefix string, logger logutils.Log, pkgCache *pkgcache.Cache, loa
9595
// It provides most of the logic for the main functions of both the
9696
// singlechecker and the multi-analysis commands.
9797
// It returns the appropriate exit code.
98-
//nolint:gocyclo
9998
func (r *runner) run(analyzers []*analysis.Analyzer, initialPackages []*packages.Package) ([]Diagnostic, []error) {
10099
debugf("Analyzing %d packages on load mode %s", len(initialPackages), r.loadMode)
101100
defer r.pkgCache.Trim()

pkg/lint/lintersdb/enabled_set.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func NewEnabledSet(m *Manager, v *Validator, log logutils.Log, cfg *config.Confi
2727
}
2828
}
2929

30-
// nolint:gocyclo
3130
func (es EnabledSet) build(lcfg *config.Linters, enabledByDefaultLinters []*linter.Config) map[string]*linter.Config {
3231
resultLintersSet := map[string]*linter.Config{}
3332
switch {

pkg/lint/load.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ func (cl *ContextLoader) filterDuplicatePackages(pkgs []*packages.Package) []*pa
275275
return retPkgs
276276
}
277277

278-
//nolint:gocyclo
279278
func (cl *ContextLoader) Load(ctx context.Context, linters []*linter.Config) (*linter.Context, error) {
280279
loadMode := cl.findLoadMode(linters)
281280
pkgs, err := cl.loadPackages(ctx, loadMode)

pkg/packages/util.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"golang.org/x/tools/go/packages"
77
)
88

9-
//nolint:gocyclo
109
func ExtractErrors(pkg *packages.Package) []packages.Error {
1110
errors := extractErrorsImpl(pkg, map[*packages.Package]bool{})
1211
if len(errors) == 0 {

pkg/printers/codeclimate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package printers
22

33
import (
44
"context"
5-
"crypto/md5"
5+
"crypto/md5" //nolint:gosec
66
"encoding/json"
77
"fmt"
88

@@ -39,7 +39,7 @@ func (p CodeClimate) Print(ctx context.Context, issues []result.Issue) error {
3939
issue.Location.Lines.Begin = i.Pos.Line
4040

4141
// Need a checksum of the issue, so we use MD5 of the filename, text, and first line of source
42-
hash := md5.New()
42+
hash := md5.New() //nolint:gosec
4343
_, _ = hash.Write([]byte(i.Pos.Filename + i.Text + i.SourceLines[0]))
4444
issue.Fingerprint = fmt.Sprintf("%X", hash.Sum(nil))
4545

pkg/result/processors/fixer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ func (f Fixer) fixIssuesInFile(filePath string, issues []result.Issue) error {
115115
return nil
116116
}
117117

118-
//nolint:gocyclo
119118
func (f Fixer) mergeLineIssues(lineNum int, lineIssues []result.Issue, origFileLines [][]byte) *result.Issue {
120119
origLine := origFileLines[lineNum-1] // lineNum is 1-based
121120

0 commit comments

Comments
 (0)