Cleanup nolint directives. (#779)
This commit is contained in:
		
							parent
							
								
									202e6f9546
								
							
						
					
					
						commit
						fd997edeeb
					
				@ -85,21 +85,17 @@ linters:
 | 
			
		||||
    - whitespace
 | 
			
		||||
 | 
			
		||||
  # don't enable:
 | 
			
		||||
  # - godox
 | 
			
		||||
  # - maligned,prealloc
 | 
			
		||||
  # - gochecknoglobals
 | 
			
		||||
  # - gocognit
 | 
			
		||||
  # - godox
 | 
			
		||||
  # - maligned
 | 
			
		||||
  # - prealloc
 | 
			
		||||
 | 
			
		||||
run:
 | 
			
		||||
  skip-dirs:
 | 
			
		||||
    - test/testdata_etc
 | 
			
		||||
    - internal/(cache|renameio|robustio)
 | 
			
		||||
 | 
			
		||||
issues:
 | 
			
		||||
  exclude-rules:
 | 
			
		||||
    - text: "weak cryptographic primitive"
 | 
			
		||||
      linters:
 | 
			
		||||
        - gosec
 | 
			
		||||
 | 
			
		||||
# golangci.com configuration
 | 
			
		||||
# https://github.com/golangci/golangci/wiki/Configuration
 | 
			
		||||
service:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							@ -969,21 +969,17 @@ linters:
 | 
			
		||||
    - whitespace
 | 
			
		||||
 | 
			
		||||
  # don't enable:
 | 
			
		||||
  # - godox
 | 
			
		||||
  # - maligned,prealloc
 | 
			
		||||
  # - gochecknoglobals
 | 
			
		||||
  # - gocognit
 | 
			
		||||
  # - godox
 | 
			
		||||
  # - maligned
 | 
			
		||||
  # - prealloc
 | 
			
		||||
 | 
			
		||||
run:
 | 
			
		||||
  skip-dirs:
 | 
			
		||||
    - test/testdata_etc
 | 
			
		||||
    - internal/(cache|renameio|robustio)
 | 
			
		||||
 | 
			
		||||
issues:
 | 
			
		||||
  exclude-rules:
 | 
			
		||||
    - text: "weak cryptographic primitive"
 | 
			
		||||
      linters:
 | 
			
		||||
        - gosec
 | 
			
		||||
 | 
			
		||||
# golangci.com configuration
 | 
			
		||||
# https://github.com/golangci/golangci/wiki/Configuration
 | 
			
		||||
service:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								internal/cache/cache.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								internal/cache/cache.go
									
									
									
									
										vendored
									
									
								
							@ -159,8 +159,7 @@ func (c *Cache) get(id ActionID) (Entry, error) {
 | 
			
		||||
	eid, entry := entry[3:3+hexSize], entry[3+hexSize:]
 | 
			
		||||
	eout, entry := entry[1:1+hexSize], entry[1+hexSize:]
 | 
			
		||||
	esize, entry := entry[1:1+20], entry[1+20:]
 | 
			
		||||
	//lint:ignore SA4006 See https://github.com/dominikh/go-tools/issues/465
 | 
			
		||||
  etime, entry := entry[1:1+20], entry[1+20:] //nolint:staticcheck
 | 
			
		||||
	etime, entry := entry[1:1+20], entry[1+20:]
 | 
			
		||||
	var buf [HashSize]byte
 | 
			
		||||
	if _, err := hex.Decode(buf[:], eid); err != nil || buf != id {
 | 
			
		||||
		return missing()
 | 
			
		||||
 | 
			
		||||
@ -342,7 +342,7 @@ type Issues struct {
 | 
			
		||||
	NeedFix bool `mapstructure:"fix"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Config struct { //nolint:maligned
 | 
			
		||||
type Config struct {
 | 
			
		||||
	Run Run
 | 
			
		||||
 | 
			
		||||
	Output struct {
 | 
			
		||||
 | 
			
		||||
@ -97,7 +97,6 @@ func (s *GocriticSettings) gocriticDisabledCheckersDebugf() {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//nolint:gocyclo
 | 
			
		||||
func (s *GocriticSettings) InferEnabledChecks(log logutils.Log) {
 | 
			
		||||
	gocriticCheckerTagsDebugf()
 | 
			
		||||
 | 
			
		||||
@ -175,7 +174,6 @@ func validateStringsUniq(ss []string) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//nolint:gocyclo
 | 
			
		||||
func (s *GocriticSettings) Validate(log logutils.Log) error {
 | 
			
		||||
	if len(s.EnabledTags) == 0 {
 | 
			
		||||
		if len(s.EnabledChecks) != 0 && len(s.DisabledChecks) != 0 {
 | 
			
		||||
 | 
			
		||||
@ -95,7 +95,6 @@ func newRunner(prefix string, logger logutils.Log, pkgCache *pkgcache.Cache, loa
 | 
			
		||||
// It provides most of the logic for the main functions of both the
 | 
			
		||||
// singlechecker and the multi-analysis commands.
 | 
			
		||||
// It returns the appropriate exit code.
 | 
			
		||||
//nolint:gocyclo
 | 
			
		||||
func (r *runner) run(analyzers []*analysis.Analyzer, initialPackages []*packages.Package) ([]Diagnostic, []error) {
 | 
			
		||||
	debugf("Analyzing %d packages on load mode %s", len(initialPackages), r.loadMode)
 | 
			
		||||
	defer r.pkgCache.Trim()
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,6 @@ func NewEnabledSet(m *Manager, v *Validator, log logutils.Log, cfg *config.Confi
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// nolint:gocyclo
 | 
			
		||||
func (es EnabledSet) build(lcfg *config.Linters, enabledByDefaultLinters []*linter.Config) map[string]*linter.Config {
 | 
			
		||||
	resultLintersSet := map[string]*linter.Config{}
 | 
			
		||||
	switch {
 | 
			
		||||
 | 
			
		||||
@ -275,7 +275,6 @@ func (cl *ContextLoader) filterDuplicatePackages(pkgs []*packages.Package) []*pa
 | 
			
		||||
	return retPkgs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//nolint:gocyclo
 | 
			
		||||
func (cl *ContextLoader) Load(ctx context.Context, linters []*linter.Config) (*linter.Context, error) {
 | 
			
		||||
	loadMode := cl.findLoadMode(linters)
 | 
			
		||||
	pkgs, err := cl.loadPackages(ctx, loadMode)
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,6 @@ import (
 | 
			
		||||
	"golang.org/x/tools/go/packages"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
//nolint:gocyclo
 | 
			
		||||
func ExtractErrors(pkg *packages.Package) []packages.Error {
 | 
			
		||||
	errors := extractErrorsImpl(pkg, map[*packages.Package]bool{})
 | 
			
		||||
	if len(errors) == 0 {
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@ package printers
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"crypto/md5"
 | 
			
		||||
	"crypto/md5" //nolint:gosec
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ func (p CodeClimate) Print(ctx context.Context, issues []result.Issue) error {
 | 
			
		||||
		issue.Location.Lines.Begin = i.Pos.Line
 | 
			
		||||
 | 
			
		||||
		// Need a checksum of the issue, so we use MD5 of the filename, text, and first line of source
 | 
			
		||||
		hash := md5.New()
 | 
			
		||||
		hash := md5.New() //nolint:gosec
 | 
			
		||||
		_, _ = hash.Write([]byte(i.Pos.Filename + i.Text + i.SourceLines[0]))
 | 
			
		||||
		issue.Fingerprint = fmt.Sprintf("%X", hash.Sum(nil))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -115,7 +115,6 @@ func (f Fixer) fixIssuesInFile(filePath string, issues []result.Issue) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//nolint:gocyclo
 | 
			
		||||
func (f Fixer) mergeLineIssues(lineNum int, lineIssues []result.Issue, origFileLines [][]byte) *result.Issue {
 | 
			
		||||
	origLine := origFileLines[lineNum-1] // lineNum is 1-based
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user