Skip to content

Commit bf5008a

Browse files
authored
dev: handle old TODO (#4374)
1 parent cc3e67b commit bf5008a

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

.golangci.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
linters-settings:
22
depguard:
3-
# new configuration
43
rules:
54
logger:
65
deny:
76
# logging is allowed only by logutils.Log,
87
# logrus is allowed to use only in logutils package.
98
- pkg: "github.com/sirupsen/logrus"
10-
desc: logging is allowed only by logutils.Log
9+
desc: logging is allowed only by logutils.Log.
10+
- pkg: "github.com/pkg/errors"
11+
desc: Should be replaced by standard lib errors package.
12+
- pkg: "github.com/instana/testify"
13+
desc: It's a fork of github.com/stretchr/testify.
1114
dupl:
1215
threshold: 100
1316
funlen:
@@ -50,7 +53,6 @@ linters-settings:
5053
- '3'
5154
ignored-functions:
5255
- strings.SplitN
53-
5456
govet:
5557
settings:
5658
printf:
@@ -118,14 +120,11 @@ linters:
118120

119121
# don't enable:
120122
# - asciicheck
121-
# - scopelint
122123
# - gochecknoglobals
123124
# - gocognit
124125
# - godot
125126
# - godox
126127
# - goerr113
127-
# - interfacer
128-
# - maligned
129128
# - nestif
130129
# - prealloc
131130
# - testpackage
@@ -156,12 +155,6 @@ issues:
156155
- path: test/(fix|linters)_test.go
157156
text: "string `gocritic.go` has 3 occurrences, make it a constant"
158157

159-
# Due to a change inside go-critic v0.10.0, some reports have been removed,
160-
# but as we run analysis with the previous version of golangci-lint this leads to a paradoxical situation.
161-
# This exclusion will be removed when the next version of golangci-lint (v1.56.0) will be released.
162-
- path: pkg/golinters/nolintlint/nolintlint.go
163-
text: "hugeParam: (i|b) is heavy \\(\\d+ bytes\\); consider passing it by pointer"
164-
165158
run:
166159
timeout: 5m
167160
skip-dirs:

pkg/golinters/nolintlint/nolintlint.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ type BaseIssue struct {
1919
replacement *result.Replacement
2020
}
2121

22+
//nolint:gocritic // TODO(ldez) must be change in the future.
2223
func (b BaseIssue) Position() token.Position {
2324
return b.position
2425
}
2526

27+
//nolint:gocritic // TODO(ldez) must be change in the future.
2628
func (b BaseIssue) Replacement() *result.Replacement {
2729
return b.replacement
2830
}
@@ -31,6 +33,7 @@ type ExtraLeadingSpace struct {
3133
BaseIssue
3234
}
3335

36+
//nolint:gocritic // TODO(ldez) must be change in the future.
3437
func (i ExtraLeadingSpace) Details() string {
3538
return fmt.Sprintf("directive `%s` should not have more than one leading space", i.fullDirective)
3639
}
@@ -41,6 +44,7 @@ type NotMachine struct {
4144
BaseIssue
4245
}
4346

47+
//nolint:gocritic // TODO(ldez) must be change in the future.
4448
func (i NotMachine) Details() string {
4549
expected := i.fullDirective[:2] + strings.TrimLeftFunc(i.fullDirective[2:], unicode.IsSpace)
4650
return fmt.Sprintf("directive `%s` should be written without leading space as `%s`",
@@ -53,6 +57,7 @@ type NotSpecific struct {
5357
BaseIssue
5458
}
5559

60+
//nolint:gocritic // TODO(ldez) must be change in the future.
5661
func (i NotSpecific) Details() string {
5762
return fmt.Sprintf("directive `%s` should mention specific linter such as `%s:my-linter`",
5863
i.fullDirective, i.directiveWithOptionalLeadingSpace)
@@ -64,6 +69,7 @@ type ParseError struct {
6469
BaseIssue
6570
}
6671

72+
//nolint:gocritic // TODO(ldez) must be change in the future.
6773
func (i ParseError) Details() string {
6874
return fmt.Sprintf("directive `%s` should match `%s[:<comma-separated-linters>] [// <explanation>]`",
6975
i.fullDirective,
@@ -77,6 +83,7 @@ type NoExplanation struct {
7783
fullDirectiveWithoutExplanation string
7884
}
7985

86+
//nolint:gocritic // TODO(ldez) must be change in the future.
8087
func (i NoExplanation) Details() string {
8188
return fmt.Sprintf("directive `%s` should provide explanation such as `%s // this is why`",
8289
i.fullDirective, i.fullDirectiveWithoutExplanation)
@@ -89,6 +96,7 @@ type UnusedCandidate struct {
8996
ExpectedLinter string
9097
}
9198

99+
//nolint:gocritic // TODO(ldez) must be change in the future.
92100
func (i UnusedCandidate) Details() string {
93101
details := fmt.Sprintf("directive `%s` is unused", i.fullDirective)
94102
if i.ExpectedLinter != "" {

pkg/lint/lintersdb/custom_linters.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package lintersdb
33
import (
44
"errors"
55
"fmt"
6-
"os"
76
"path/filepath"
87
"plugin"
98

@@ -115,11 +114,8 @@ func (m *Manager) lookupAnalyzerPlugin(plug *plugin.Plugin) ([]*analysis.Analyze
115114
return nil, err
116115
}
117116

118-
// TODO(ldez): remove this env var (but keep the log) in the next minor version (v1.55.0)
119-
if _, ok := os.LookupEnv("GOLANGCI_LINT_HIDE_WARNING_ABOUT_PLUGIN_API_DEPRECATION"); !ok {
120-
m.log.Warnf("plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: " +
121-
"https://golangci-lint.run/contributing/new-linters/#create-a-plugin")
122-
}
117+
m.log.Warnf("plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: " +
118+
"https://golangci-lint.run/contributing/new-linters/#create-a-plugin")
123119

124120
analyzerPlugin, ok := symbol.(AnalyzerPlugin)
125121
if !ok {

0 commit comments

Comments
 (0)