Skip to content

Commit 43b5c05

Browse files
committed
chore: predeclared.ignore -> slice
1 parent bed771a commit 43b5c05

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

.golangci.next.reference.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,9 +2356,11 @@ linters-settings:
23562356
for-loops: true
23572357

23582358
predeclared:
2359-
# Comma-separated list of predeclared identifiers to not report on.
2360-
# Default: ""
2361-
ignore: "new,int"
2359+
# List of predeclared identifiers to not report on.
2360+
# Default: []
2361+
ignore:
2362+
- new
2363+
- int
23622364
# Include method names and field names in checks.
23632365
# Default: false
23642366
qualified-name: true

jsonschema/golangci.next.jsonschema.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,8 +2413,11 @@
24132413
"additionalProperties": false,
24142414
"properties": {
24152415
"ignore": {
2416-
"description": "Comma-separated list of predeclared identifiers to not report on.",
2417-
"type": "string"
2416+
"description": "List of predeclared identifiers to not report on.",
2417+
"type": "array",
2418+
"items": {
2419+
"type": "string"
2420+
}
24182421
},
24192422
"qualified-name": {
24202423
"description": "Include method names and field names in checks.",

pkg/config/linters_settings.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ var defaultLintersSettings = LintersSettings{
128128
ForLoops: false,
129129
},
130130
Predeclared: PredeclaredSettings{
131-
Ignore: "",
132131
Qualified: false,
133132
},
134133
SlogLint: SlogLintSettings{
@@ -715,8 +714,8 @@ type PreallocSettings struct {
715714
}
716715

717716
type PredeclaredSettings struct {
718-
Ignore string `mapstructure:"ignore"`
719-
Qualified bool `mapstructure:"qualified-name"`
717+
Ignore []string `mapstructure:"ignore"`
718+
Qualified bool `mapstructure:"qualified-name"`
720719
}
721720

722721
type PromlinterSettings struct {

pkg/golinters/predeclared/predeclared.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package predeclared
22

33
import (
4+
"strings"
5+
46
"github.com/nishanths/predeclared/passes/predeclared"
57
"golang.org/x/tools/go/analysis"
68

@@ -15,7 +17,7 @@ func New(settings *config.PredeclaredSettings) *goanalysis.Linter {
1517
if settings != nil {
1618
cfg = map[string]map[string]any{
1719
a.Name: {
18-
predeclared.IgnoreFlag: settings.Ignore,
20+
predeclared.IgnoreFlag: strings.Join(settings.Ignore, ","),
1921
predeclared.QualifiedFlag: settings.Qualified,
2022
},
2123
}

pkg/golinters/predeclared/testdata/predeclared_custom.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ version: "2"
22

33
linters-settings:
44
predeclared:
5-
ignore: "real,recover"
5+
ignore:
6+
- real
7+
- recover
68
qualified-name: true

0 commit comments

Comments
 (0)