dev: handle old TODO (#4374)
This commit is contained in:
parent
cc3e67b3bd
commit
bf5008a11a
@ -1,13 +1,16 @@
|
|||||||
linters-settings:
|
linters-settings:
|
||||||
depguard:
|
depguard:
|
||||||
# new configuration
|
|
||||||
rules:
|
rules:
|
||||||
logger:
|
logger:
|
||||||
deny:
|
deny:
|
||||||
# logging is allowed only by logutils.Log,
|
# logging is allowed only by logutils.Log,
|
||||||
# logrus is allowed to use only in logutils package.
|
# logrus is allowed to use only in logutils package.
|
||||||
- pkg: "github.com/sirupsen/logrus"
|
- pkg: "github.com/sirupsen/logrus"
|
||||||
desc: logging is allowed only by logutils.Log
|
desc: logging is allowed only by logutils.Log.
|
||||||
|
- pkg: "github.com/pkg/errors"
|
||||||
|
desc: Should be replaced by standard lib errors package.
|
||||||
|
- pkg: "github.com/instana/testify"
|
||||||
|
desc: It's a fork of github.com/stretchr/testify.
|
||||||
dupl:
|
dupl:
|
||||||
threshold: 100
|
threshold: 100
|
||||||
funlen:
|
funlen:
|
||||||
@ -50,7 +53,6 @@ linters-settings:
|
|||||||
- '3'
|
- '3'
|
||||||
ignored-functions:
|
ignored-functions:
|
||||||
- strings.SplitN
|
- strings.SplitN
|
||||||
|
|
||||||
govet:
|
govet:
|
||||||
settings:
|
settings:
|
||||||
printf:
|
printf:
|
||||||
@ -118,14 +120,11 @@ linters:
|
|||||||
|
|
||||||
# don't enable:
|
# don't enable:
|
||||||
# - asciicheck
|
# - asciicheck
|
||||||
# - scopelint
|
|
||||||
# - gochecknoglobals
|
# - gochecknoglobals
|
||||||
# - gocognit
|
# - gocognit
|
||||||
# - godot
|
# - godot
|
||||||
# - godox
|
# - godox
|
||||||
# - goerr113
|
# - goerr113
|
||||||
# - interfacer
|
|
||||||
# - maligned
|
|
||||||
# - nestif
|
# - nestif
|
||||||
# - prealloc
|
# - prealloc
|
||||||
# - testpackage
|
# - testpackage
|
||||||
@ -156,12 +155,6 @@ issues:
|
|||||||
- path: test/(fix|linters)_test.go
|
- path: test/(fix|linters)_test.go
|
||||||
text: "string `gocritic.go` has 3 occurrences, make it a constant"
|
text: "string `gocritic.go` has 3 occurrences, make it a constant"
|
||||||
|
|
||||||
# Due to a change inside go-critic v0.10.0, some reports have been removed,
|
|
||||||
# but as we run analysis with the previous version of golangci-lint this leads to a paradoxical situation.
|
|
||||||
# This exclusion will be removed when the next version of golangci-lint (v1.56.0) will be released.
|
|
||||||
- path: pkg/golinters/nolintlint/nolintlint.go
|
|
||||||
text: "hugeParam: (i|b) is heavy \\(\\d+ bytes\\); consider passing it by pointer"
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
|
@ -19,10 +19,12 @@ type BaseIssue struct {
|
|||||||
replacement *result.Replacement
|
replacement *result.Replacement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (b BaseIssue) Position() token.Position {
|
func (b BaseIssue) Position() token.Position {
|
||||||
return b.position
|
return b.position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (b BaseIssue) Replacement() *result.Replacement {
|
func (b BaseIssue) Replacement() *result.Replacement {
|
||||||
return b.replacement
|
return b.replacement
|
||||||
}
|
}
|
||||||
@ -31,6 +33,7 @@ type ExtraLeadingSpace struct {
|
|||||||
BaseIssue
|
BaseIssue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (i ExtraLeadingSpace) Details() string {
|
func (i ExtraLeadingSpace) Details() string {
|
||||||
return fmt.Sprintf("directive `%s` should not have more than one leading space", i.fullDirective)
|
return fmt.Sprintf("directive `%s` should not have more than one leading space", i.fullDirective)
|
||||||
}
|
}
|
||||||
@ -41,6 +44,7 @@ type NotMachine struct {
|
|||||||
BaseIssue
|
BaseIssue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (i NotMachine) Details() string {
|
func (i NotMachine) Details() string {
|
||||||
expected := i.fullDirective[:2] + strings.TrimLeftFunc(i.fullDirective[2:], unicode.IsSpace)
|
expected := i.fullDirective[:2] + strings.TrimLeftFunc(i.fullDirective[2:], unicode.IsSpace)
|
||||||
return fmt.Sprintf("directive `%s` should be written without leading space as `%s`",
|
return fmt.Sprintf("directive `%s` should be written without leading space as `%s`",
|
||||||
@ -53,6 +57,7 @@ type NotSpecific struct {
|
|||||||
BaseIssue
|
BaseIssue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (i NotSpecific) Details() string {
|
func (i NotSpecific) Details() string {
|
||||||
return fmt.Sprintf("directive `%s` should mention specific linter such as `%s:my-linter`",
|
return fmt.Sprintf("directive `%s` should mention specific linter such as `%s:my-linter`",
|
||||||
i.fullDirective, i.directiveWithOptionalLeadingSpace)
|
i.fullDirective, i.directiveWithOptionalLeadingSpace)
|
||||||
@ -64,6 +69,7 @@ type ParseError struct {
|
|||||||
BaseIssue
|
BaseIssue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (i ParseError) Details() string {
|
func (i ParseError) Details() string {
|
||||||
return fmt.Sprintf("directive `%s` should match `%s[:<comma-separated-linters>] [// <explanation>]`",
|
return fmt.Sprintf("directive `%s` should match `%s[:<comma-separated-linters>] [// <explanation>]`",
|
||||||
i.fullDirective,
|
i.fullDirective,
|
||||||
@ -77,6 +83,7 @@ type NoExplanation struct {
|
|||||||
fullDirectiveWithoutExplanation string
|
fullDirectiveWithoutExplanation string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (i NoExplanation) Details() string {
|
func (i NoExplanation) Details() string {
|
||||||
return fmt.Sprintf("directive `%s` should provide explanation such as `%s // this is why`",
|
return fmt.Sprintf("directive `%s` should provide explanation such as `%s // this is why`",
|
||||||
i.fullDirective, i.fullDirectiveWithoutExplanation)
|
i.fullDirective, i.fullDirectiveWithoutExplanation)
|
||||||
@ -89,6 +96,7 @@ type UnusedCandidate struct {
|
|||||||
ExpectedLinter string
|
ExpectedLinter string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocritic // TODO(ldez) must be change in the future.
|
||||||
func (i UnusedCandidate) Details() string {
|
func (i UnusedCandidate) Details() string {
|
||||||
details := fmt.Sprintf("directive `%s` is unused", i.fullDirective)
|
details := fmt.Sprintf("directive `%s` is unused", i.fullDirective)
|
||||||
if i.ExpectedLinter != "" {
|
if i.ExpectedLinter != "" {
|
||||||
|
@ -3,7 +3,6 @@ package lintersdb
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"plugin"
|
"plugin"
|
||||||
|
|
||||||
@ -115,11 +114,8 @@ func (m *Manager) lookupAnalyzerPlugin(plug *plugin.Plugin) ([]*analysis.Analyze
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ldez): remove this env var (but keep the log) in the next minor version (v1.55.0)
|
|
||||||
if _, ok := os.LookupEnv("GOLANGCI_LINT_HIDE_WARNING_ABOUT_PLUGIN_API_DEPRECATION"); !ok {
|
|
||||||
m.log.Warnf("plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: " +
|
m.log.Warnf("plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: " +
|
||||||
"https://golangci-lint.run/contributing/new-linters/#create-a-plugin")
|
"https://golangci-lint.run/contributing/new-linters/#create-a-plugin")
|
||||||
}
|
|
||||||
|
|
||||||
analyzerPlugin, ok := symbol.(AnalyzerPlugin)
|
analyzerPlugin, ok := symbol.(AnalyzerPlugin)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user