Skip to content

Commit 378dfbd

Browse files
authored
feat: remove options (#5464)
1 parent a79eeab commit 378dfbd

25 files changed

+43
-192
lines changed

.golangci.next.reference.yml

-33
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,6 @@ formatters:
366366
# Default: false
367367
no-prefix-comments: true
368368

369-
# Skip generated files.
370-
# Default: true
371-
skip-generated: false
372-
373369
# Enable custom order of sections.
374370
# If `true`, make the section order the same as the order of `sections`.
375371
# Default: false
@@ -438,9 +434,6 @@ linters-settings:
438434
# See the default value of `exclude` to get the builtin exclusions.
439435
# Default: true
440436
use-builtin-exclusions: false
441-
# Ignore *_test.go files.
442-
# Default: false
443-
ignore-test: true
444437

445438
bidichk:
446439
# The following configurations check for all mentioned invisible Unicode runes.
@@ -468,9 +461,6 @@ linters-settings:
468461
# If it's higher than 0.0 (float) the check is enabled
469462
# Default: 0.0
470463
package-average: 0.5
471-
# Should ignore tests.
472-
# Default: false
473-
skip-tests: true
474464

475465
decorder:
476466
# Required order of `type`, `const`, `var` and `func` declarations inside a file.
@@ -655,9 +645,6 @@ linters-settings:
655645
check:
656646
- switch
657647
- map
658-
# Check switch statements in generated files also.
659-
# Default: false
660-
check-generated: true
661648
# Presence of "default" case in switch statements satisfies exhaustiveness,
662649
# even if all enum members are not listed.
663650
# Default: false
@@ -817,9 +804,6 @@ linters-settings:
817804
# Minimum occurrences of constant string count to trigger issue.
818805
# Default: 3
819806
min-occurrences: 2
820-
# Ignore test files.
821-
# Default: false
822-
ignore-tests: true
823807
# Look for existing constants matching the values.
824808
# Default: true
825809
match-constant: false
@@ -1733,10 +1717,6 @@ linters-settings:
17331717
- G601 # Implicit memory aliasing of items from a range statement
17341718
- G602 # Slice access out of bounds
17351719

1736-
# Exclude generated files
1737-
# Default: false
1738-
exclude-generated: true
1739-
17401720
# Filter out the issues with a lower severity than the given value.
17411721
# Valid options are: low, medium, high.
17421722
# Default: low
@@ -1843,10 +1823,6 @@ linters-settings:
18431823
- 'example.com/your/project/i18n/markers.OK'
18441824
- 'example.com/your/project/i18n/markers.TODO'
18451825
- 'command-line-arguments.Simple'
1846-
# Ignore test files.
1847-
#
1848-
# Default: true
1849-
ignore-tests: false
18501826
# List of Unicode scripts to watch for any usage in string literals.
18511827
# https://pkg.go.dev/unicode#pkg-variables
18521828
#
@@ -2462,11 +2438,6 @@ linters-settings:
24622438
# Defaults to unlimited.
24632439
max-open-files: 2048
24642440

2465-
# When set to false, ignores files with "GENERATED" header, similar to golint.
2466-
# See https://github.com/mgechev/revive#configuration for details.
2467-
# Default: false
2468-
ignore-generated-header: true
2469-
24702441
# Sets the default severity.
24712442
# See https://github.com/mgechev/revive#configuration
24722443
# Default: warning
@@ -4238,10 +4209,6 @@ severity:
42384209
# Default: ""
42394210
default: error
42404211

4241-
# If set to true `severity-rules` regular expressions become case-sensitive.
4242-
# Default: false
4243-
case-sensitive: true
4244-
42454212
# When a list of severity rules are provided, severity information will be added to lint issues.
42464213
# Severity rules have the same filtering capability as exclude rules
42474214
# except you are allowed to specify one matcher per severity rule.

jsonschema/golangci.next.jsonschema.json

-43
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,6 @@
526526
"description": "To enable/disable the asasalint builtin exclusions of function names.",
527527
"type": "boolean",
528528
"default": true
529-
},
530-
"ignore-test": {
531-
"description": "Ignore *_test.go files.",
532-
"type": "boolean",
533-
"default": false
534529
}
535530
}
536531
},
@@ -589,11 +584,6 @@
589584
"type": "object",
590585
"additionalProperties": false,
591586
"properties": {
592-
"skip-tests": {
593-
"description": "Should the linter execute on test files as well",
594-
"type": "boolean",
595-
"default": false
596-
},
597587
"max-complexity": {
598588
"description": "Max complexity the function can have",
599589
"type": "integer",
@@ -852,11 +842,6 @@
852842
"examples": ["switch", "map"]
853843
}
854844
},
855-
"check-generated": {
856-
"description": "Check switch statements in generated files",
857-
"type": "boolean",
858-
"default": false
859-
},
860845
"explicit-exhaustive-switch": {
861846
"description": "Only run exhaustive check on switches with \"//exhaustive:enforce\" comment.",
862847
"type": "boolean",
@@ -1010,11 +995,6 @@
1010995
},
1011996
"default": ["standard", "default"]
1012997
},
1013-
"skip-generated": {
1014-
"description": "Skip generated files.",
1015-
"type": "boolean",
1016-
"default": true
1017-
},
1018998
"no-inline-comments": {
1019999
"description": "Checks that no inline Comments are present.",
10201000
"type": "boolean",
@@ -1149,11 +1129,6 @@
11491129
"type": "integer",
11501130
"default": 3
11511131
},
1152-
"ignore-tests": {
1153-
"description": "Ignore test files.",
1154-
"type": "boolean",
1155-
"default": false
1156-
},
11571132
"ignore-calls": {
11581133
"description": "Ignore when constant is not used as function argument",
11591134
"type": "boolean",
@@ -1767,11 +1742,6 @@
17671742
"$ref": "#/definitions/gosec-rules"
17681743
}
17691744
},
1770-
"exclude-generated": {
1771-
"description": "Exclude generated files",
1772-
"type": "boolean",
1773-
"default": false
1774-
},
17751745
"severity": {
17761746
"description": "Filter out the issues with a lower severity than the given value",
17771747
"type": "string",
@@ -1810,11 +1780,6 @@
18101780
"type": "string"
18111781
}
18121782
},
1813-
"ignore-tests": {
1814-
"description": "Ignore test files.",
1815-
"type": "boolean",
1816-
"default": false
1817-
},
18181783
"watch-for-scripts": {
18191784
"description": "List of Unicode scripts to watch for any usage in string literals.",
18201785
"type": "array",
@@ -2541,9 +2506,6 @@
25412506
"max-open-files": {
25422507
"type": "integer"
25432508
},
2544-
"ignore-generated-header": {
2545-
"type": "boolean"
2546-
},
25472509
"confidence": {
25482510
"type": "number"
25492511
},
@@ -4422,11 +4384,6 @@
44224384
"type": "string",
44234385
"default": ""
44244386
},
4425-
"case-sensitive": {
4426-
"description": "If set to true, severity-rules regular expressions become case sensitive.",
4427-
"type": "boolean",
4428-
"default": false
4429-
},
44304387
"rules": {
44314388
"description": "When a list of severity rules are provided, severity information will be added to lint issues. Severity rules have the same filtering capability as exclude rules except you are allowed to specify one matcher per severity rule.\nOnly affects out formats that support setting severity information.",
44324389
"type": "array",

pkg/config/linters_settings.go

+12-21
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ var defaultLintersSettings = LintersSettings{
3232
},
3333
Exhaustive: ExhaustiveSettings{
3434
Check: []string{"switch"},
35-
CheckGenerated: false,
3635
DefaultSignifiesExhaustive: false,
3736
IgnoreEnumMembers: "",
3837
PackageScopeOnly: false,
@@ -75,7 +74,6 @@ var defaultLintersSettings = LintersSettings{
7574
Gosmopolitan: GosmopolitanSettings{
7675
AllowTimeLocal: false,
7776
EscapeHatches: []string{},
78-
IgnoreTests: true,
7977
WatchForScripts: []string{"Han"},
8078
},
8179
Inamedparam: INamedParamSettings{
@@ -304,7 +302,6 @@ func (s *LintersSettings) Validate() error {
304302
type AsasalintSettings struct {
305303
Exclude []string `mapstructure:"exclude"`
306304
UseBuiltinExclusions bool `mapstructure:"use-builtin-exclusions"`
307-
IgnoreTest bool `mapstructure:"ignore-test"`
308305
}
309306

310307
type BiDiChkSettings struct {
@@ -326,7 +323,6 @@ type CopyLoopVarSettings struct {
326323
type Cyclop struct {
327324
MaxComplexity int `mapstructure:"max-complexity"`
328325
PackageAverage float64 `mapstructure:"package-average"`
329-
SkipTests bool `mapstructure:"skip-tests"`
330326
}
331327

332328
type DepGuardSettings struct {
@@ -397,7 +393,6 @@ type ErrorLintAllowPair struct {
397393

398394
type ExhaustiveSettings struct {
399395
Check []string `mapstructure:"check"`
400-
CheckGenerated bool `mapstructure:"check-generated"`
401396
DefaultSignifiesExhaustive bool `mapstructure:"default-signifies-exhaustive"`
402397
IgnoreEnumMembers string `mapstructure:"ignore-enum-members"`
403398
IgnoreEnumTypes string `mapstructure:"ignore-enum-types"`
@@ -460,7 +455,6 @@ type GocognitSettings struct {
460455

461456
type GoConstSettings struct {
462457
IgnoreStrings string `mapstructure:"ignore-strings"`
463-
IgnoreTests bool `mapstructure:"ignore-tests"`
464458
MatchWithConstants bool `mapstructure:"match-constant"`
465459
MinStringLen int `mapstructure:"min-len"`
466460
MinOccurrencesCount int `mapstructure:"min-occurrences"`
@@ -535,19 +529,17 @@ type GoModGuardSettings struct {
535529
}
536530

537531
type GoSecSettings struct {
538-
Includes []string `mapstructure:"includes"`
539-
Excludes []string `mapstructure:"excludes"`
540-
Severity string `mapstructure:"severity"`
541-
Confidence string `mapstructure:"confidence"`
542-
ExcludeGenerated bool `mapstructure:"exclude-generated"`
543-
Config map[string]any `mapstructure:"config"`
544-
Concurrency int `mapstructure:"concurrency"`
532+
Includes []string `mapstructure:"includes"`
533+
Excludes []string `mapstructure:"excludes"`
534+
Severity string `mapstructure:"severity"`
535+
Confidence string `mapstructure:"confidence"`
536+
Config map[string]any `mapstructure:"config"`
537+
Concurrency int `mapstructure:"concurrency"`
545538
}
546539

547540
type GosmopolitanSettings struct {
548541
AllowTimeLocal bool `mapstructure:"allow-time-local"`
549542
EscapeHatches []string `mapstructure:"escape-hatches"`
550-
IgnoreTests bool `mapstructure:"ignore-tests"`
551543
WatchForScripts []string `mapstructure:"watch-for-scripts"`
552544
}
553545

@@ -749,13 +741,12 @@ type RecvcheckSettings struct {
749741
}
750742

751743
type ReviveSettings struct {
752-
Go string `mapstructure:"-"`
753-
MaxOpenFiles int `mapstructure:"max-open-files"`
754-
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
755-
Confidence float64 `mapstructure:"confidence"`
756-
Severity string `mapstructure:"severity"`
757-
EnableAllRules bool `mapstructure:"enable-all-rules"`
758-
Rules []struct {
744+
Go string `mapstructure:"-"`
745+
MaxOpenFiles int `mapstructure:"max-open-files"`
746+
Confidence float64 `mapstructure:"confidence"`
747+
Severity string `mapstructure:"severity"`
748+
EnableAllRules bool `mapstructure:"enable-all-rules"`
749+
Rules []struct {
759750
Name string `mapstructure:"name"`
760751
Arguments []any `mapstructure:"arguments"`
761752
Severity string `mapstructure:"severity"`

pkg/config/severity.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import (
88
const severityRuleMinConditionsCount = 1
99

1010
type Severity struct {
11-
Default string `mapstructure:"default"`
12-
CaseSensitive bool `mapstructure:"case-sensitive"`
13-
Rules []SeverityRule `mapstructure:"rules"`
11+
Default string `mapstructure:"default"`
12+
Rules []SeverityRule `mapstructure:"rules"`
1413
}
1514

1615
func (s *Severity) Validate() error {

pkg/goformatters/gci/gci.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ func New(settings *config.GciSettings) (*Formatter, error) {
3232
Cfg: gcicfg.BoolConfig{
3333
NoInlineComments: settings.NoInlineComments,
3434
NoPrefixComments: settings.NoPrefixComments,
35-
SkipGenerated: settings.SkipGenerated,
3635
CustomOrder: settings.CustomOrder,
3736
NoLexOrder: settings.NoLexOrder,
37+
38+
// Should be managed with `formatters.exclusions.generated`.
39+
SkipGenerated: false,
3840
},
3941
SectionStrings: settings.Sections,
4042
ModPath: modPath,

pkg/golinters/asasalint/asasalint.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ func New(settings *config.AsasalintSettings) *goanalysis.Linter {
1414
if settings != nil {
1515
cfg.Exclude = settings.Exclude
1616
cfg.NoBuiltinExclusions = !settings.UseBuiltinExclusions
17-
cfg.IgnoreTest = settings.IgnoreTest
17+
18+
// Should be managed with `linters.exclusions.rules`.
19+
cfg.IgnoreTest = false
1820
}
1921

2022
a, err := asasalint.NewAnalyzer(cfg)

pkg/golinters/cyclop/cyclop.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ func New(settings *config.Cyclop) *goanalysis.Linter {
1414
var cfg map[string]map[string]any
1515
if settings != nil {
1616
d := map[string]any{
17-
"skipTests": settings.SkipTests,
17+
// Should be managed with `linters.exclusions.rules`.
18+
"skipTests": false,
1819
}
1920

2021
if settings.MaxComplexity != 0 {

pkg/golinters/exhaustive/exhaustive.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ func New(settings *config.ExhaustiveSettings) *goanalysis.Linter {
1616
cfg = map[string]map[string]any{
1717
a.Name: {
1818
exhaustive.CheckFlag: settings.Check,
19-
exhaustive.CheckGeneratedFlag: settings.CheckGenerated,
2019
exhaustive.DefaultSignifiesExhaustiveFlag: settings.DefaultSignifiesExhaustive,
2120
exhaustive.IgnoreEnumMembersFlag: settings.IgnoreEnumMembers,
2221
exhaustive.IgnoreEnumTypesFlag: settings.IgnoreEnumTypes,
2322
exhaustive.PackageScopeOnlyFlag: settings.PackageScopeOnly,
2423
exhaustive.ExplicitExhaustiveMapFlag: settings.ExplicitExhaustiveMap,
2524
exhaustive.ExplicitExhaustiveSwitchFlag: settings.ExplicitExhaustiveSwitch,
2625
exhaustive.DefaultCaseRequiredFlag: settings.DefaultCaseRequired,
26+
// Should be managed with `linters.exclusions.generated`.
27+
exhaustive.CheckGeneratedFlag: true,
2728
},
2829
}
2930
}

pkg/golinters/goconst/goconst.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ func New(settings *config.GoConstSettings) *goanalysis.Linter {
5454
func runGoconst(pass *analysis.Pass, settings *config.GoConstSettings) ([]goanalysis.Issue, error) {
5555
cfg := goconstAPI.Config{
5656
IgnoreStrings: settings.IgnoreStrings,
57-
IgnoreTests: settings.IgnoreTests,
5857
MatchWithConstants: settings.MatchWithConstants,
5958
MinStringLength: settings.MinStringLen,
6059
MinOccurrences: settings.MinOccurrencesCount,
6160
ParseNumbers: settings.ParseNumbers,
6261
NumberMin: settings.NumberMin,
6362
NumberMax: settings.NumberMax,
6463
ExcludeTypes: map[goconstAPI.Type]bool{},
64+
65+
// Should be managed with `linters.exclusions.rules`.
66+
IgnoreTests: false,
6567
}
6668

6769
if settings.IgnoreCalls {

pkg/golinters/goconst/testdata/goconst_dont_ignore.yml

-5
This file was deleted.

pkg/golinters/goconst/testdata/goconst_dont_ignore_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//golangcitest:args -Egoconst
2-
//golangcitest:config_path testdata/goconst_dont_ignore.yml
32
package testdata
43

54
import (

pkg/golinters/goconst/testdata/goconst_ignore.yml

-5
This file was deleted.

0 commit comments

Comments
 (0)