Skip to content

feat: remove options #5464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,6 @@ formatters:
# Default: false
no-prefix-comments: true

# Skip generated files.
# Default: true
skip-generated: false

# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
Expand Down Expand Up @@ -438,9 +434,6 @@ linters-settings:
# See the default value of `exclude` to get the builtin exclusions.
# Default: true
use-builtin-exclusions: false
# Ignore *_test.go files.
# Default: false
ignore-test: true

bidichk:
# The following configurations check for all mentioned invisible Unicode runes.
Expand Down Expand Up @@ -468,9 +461,6 @@ linters-settings:
# If it's higher than 0.0 (float) the check is enabled
# Default: 0.0
package-average: 0.5
# Should ignore tests.
# Default: false
skip-tests: true

decorder:
# Required order of `type`, `const`, `var` and `func` declarations inside a file.
Expand Down Expand Up @@ -655,9 +645,6 @@ linters-settings:
check:
- switch
- map
# Check switch statements in generated files also.
# Default: false
check-generated: true
# Presence of "default" case in switch statements satisfies exhaustiveness,
# even if all enum members are not listed.
# Default: false
Expand Down Expand Up @@ -817,9 +804,6 @@ linters-settings:
# Minimum occurrences of constant string count to trigger issue.
# Default: 3
min-occurrences: 2
# Ignore test files.
# Default: false
ignore-tests: true
# Look for existing constants matching the values.
# Default: true
match-constant: false
Expand Down Expand Up @@ -1733,10 +1717,6 @@ linters-settings:
- G601 # Implicit memory aliasing of items from a range statement
- G602 # Slice access out of bounds

# Exclude generated files
# Default: false
exclude-generated: true

# Filter out the issues with a lower severity than the given value.
# Valid options are: low, medium, high.
# Default: low
Expand Down Expand Up @@ -1843,10 +1823,6 @@ linters-settings:
- 'example.com/your/project/i18n/markers.OK'
- 'example.com/your/project/i18n/markers.TODO'
- 'command-line-arguments.Simple'
# Ignore test files.
#
# Default: true
ignore-tests: false
# List of Unicode scripts to watch for any usage in string literals.
# https://pkg.go.dev/unicode#pkg-variables
#
Expand Down Expand Up @@ -2462,11 +2438,6 @@ linters-settings:
# Defaults to unlimited.
max-open-files: 2048

# When set to false, ignores files with "GENERATED" header, similar to golint.
# See https://github.com/mgechev/revive#configuration for details.
# Default: false
ignore-generated-header: true

# Sets the default severity.
# See https://github.com/mgechev/revive#configuration
# Default: warning
Expand Down Expand Up @@ -4238,10 +4209,6 @@ severity:
# Default: ""
default: error

# If set to true `severity-rules` regular expressions become case-sensitive.
# Default: false
case-sensitive: true

# 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.
Expand Down
43 changes: 0 additions & 43 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,6 @@
"description": "To enable/disable the asasalint builtin exclusions of function names.",
"type": "boolean",
"default": true
},
"ignore-test": {
"description": "Ignore *_test.go files.",
"type": "boolean",
"default": false
}
}
},
Expand Down Expand Up @@ -589,11 +584,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"skip-tests": {
"description": "Should the linter execute on test files as well",
"type": "boolean",
"default": false
},
"max-complexity": {
"description": "Max complexity the function can have",
"type": "integer",
Expand Down Expand Up @@ -852,11 +842,6 @@
"examples": ["switch", "map"]
}
},
"check-generated": {
"description": "Check switch statements in generated files",
"type": "boolean",
"default": false
},
"explicit-exhaustive-switch": {
"description": "Only run exhaustive check on switches with \"//exhaustive:enforce\" comment.",
"type": "boolean",
Expand Down Expand Up @@ -1010,11 +995,6 @@
},
"default": ["standard", "default"]
},
"skip-generated": {
"description": "Skip generated files.",
"type": "boolean",
"default": true
},
"no-inline-comments": {
"description": "Checks that no inline Comments are present.",
"type": "boolean",
Expand Down Expand Up @@ -1149,11 +1129,6 @@
"type": "integer",
"default": 3
},
"ignore-tests": {
"description": "Ignore test files.",
"type": "boolean",
"default": false
},
"ignore-calls": {
"description": "Ignore when constant is not used as function argument",
"type": "boolean",
Expand Down Expand Up @@ -1767,11 +1742,6 @@
"$ref": "#/definitions/gosec-rules"
}
},
"exclude-generated": {
"description": "Exclude generated files",
"type": "boolean",
"default": false
},
"severity": {
"description": "Filter out the issues with a lower severity than the given value",
"type": "string",
Expand Down Expand Up @@ -1810,11 +1780,6 @@
"type": "string"
}
},
"ignore-tests": {
"description": "Ignore test files.",
"type": "boolean",
"default": false
},
"watch-for-scripts": {
"description": "List of Unicode scripts to watch for any usage in string literals.",
"type": "array",
Expand Down Expand Up @@ -2541,9 +2506,6 @@
"max-open-files": {
"type": "integer"
},
"ignore-generated-header": {
"type": "boolean"
},
"confidence": {
"type": "number"
},
Expand Down Expand Up @@ -4422,11 +4384,6 @@
"type": "string",
"default": ""
},
"case-sensitive": {
"description": "If set to true, severity-rules regular expressions become case sensitive.",
"type": "boolean",
"default": false
},
"rules": {
"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.",
"type": "array",
Expand Down
33 changes: 12 additions & 21 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ var defaultLintersSettings = LintersSettings{
},
Exhaustive: ExhaustiveSettings{
Check: []string{"switch"},
CheckGenerated: false,
DefaultSignifiesExhaustive: false,
IgnoreEnumMembers: "",
PackageScopeOnly: false,
Expand Down Expand Up @@ -75,7 +74,6 @@ var defaultLintersSettings = LintersSettings{
Gosmopolitan: GosmopolitanSettings{
AllowTimeLocal: false,
EscapeHatches: []string{},
IgnoreTests: true,
WatchForScripts: []string{"Han"},
},
Inamedparam: INamedParamSettings{
Expand Down Expand Up @@ -304,7 +302,6 @@ func (s *LintersSettings) Validate() error {
type AsasalintSettings struct {
Exclude []string `mapstructure:"exclude"`
UseBuiltinExclusions bool `mapstructure:"use-builtin-exclusions"`
IgnoreTest bool `mapstructure:"ignore-test"`
}

type BiDiChkSettings struct {
Expand All @@ -326,7 +323,6 @@ type CopyLoopVarSettings struct {
type Cyclop struct {
MaxComplexity int `mapstructure:"max-complexity"`
PackageAverage float64 `mapstructure:"package-average"`
SkipTests bool `mapstructure:"skip-tests"`
}

type DepGuardSettings struct {
Expand Down Expand Up @@ -397,7 +393,6 @@ type ErrorLintAllowPair struct {

type ExhaustiveSettings struct {
Check []string `mapstructure:"check"`
CheckGenerated bool `mapstructure:"check-generated"`
DefaultSignifiesExhaustive bool `mapstructure:"default-signifies-exhaustive"`
IgnoreEnumMembers string `mapstructure:"ignore-enum-members"`
IgnoreEnumTypes string `mapstructure:"ignore-enum-types"`
Expand Down Expand Up @@ -460,7 +455,6 @@ type GocognitSettings struct {

type GoConstSettings struct {
IgnoreStrings string `mapstructure:"ignore-strings"`
IgnoreTests bool `mapstructure:"ignore-tests"`
MatchWithConstants bool `mapstructure:"match-constant"`
MinStringLen int `mapstructure:"min-len"`
MinOccurrencesCount int `mapstructure:"min-occurrences"`
Expand Down Expand Up @@ -535,19 +529,17 @@ type GoModGuardSettings struct {
}

type GoSecSettings struct {
Includes []string `mapstructure:"includes"`
Excludes []string `mapstructure:"excludes"`
Severity string `mapstructure:"severity"`
Confidence string `mapstructure:"confidence"`
ExcludeGenerated bool `mapstructure:"exclude-generated"`
Config map[string]any `mapstructure:"config"`
Concurrency int `mapstructure:"concurrency"`
Includes []string `mapstructure:"includes"`
Excludes []string `mapstructure:"excludes"`
Severity string `mapstructure:"severity"`
Confidence string `mapstructure:"confidence"`
Config map[string]any `mapstructure:"config"`
Concurrency int `mapstructure:"concurrency"`
}

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

Expand Down Expand Up @@ -749,13 +741,12 @@ type RecvcheckSettings struct {
}

type ReviveSettings struct {
Go string `mapstructure:"-"`
MaxOpenFiles int `mapstructure:"max-open-files"`
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
Confidence float64 `mapstructure:"confidence"`
Severity string `mapstructure:"severity"`
EnableAllRules bool `mapstructure:"enable-all-rules"`
Rules []struct {
Go string `mapstructure:"-"`
MaxOpenFiles int `mapstructure:"max-open-files"`
Confidence float64 `mapstructure:"confidence"`
Severity string `mapstructure:"severity"`
EnableAllRules bool `mapstructure:"enable-all-rules"`
Rules []struct {
Name string `mapstructure:"name"`
Arguments []any `mapstructure:"arguments"`
Severity string `mapstructure:"severity"`
Expand Down
5 changes: 2 additions & 3 deletions pkg/config/severity.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import (
const severityRuleMinConditionsCount = 1

type Severity struct {
Default string `mapstructure:"default"`
CaseSensitive bool `mapstructure:"case-sensitive"`
Rules []SeverityRule `mapstructure:"rules"`
Default string `mapstructure:"default"`
Rules []SeverityRule `mapstructure:"rules"`
}

func (s *Severity) Validate() error {
Expand Down
4 changes: 3 additions & 1 deletion pkg/goformatters/gci/gci.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ func New(settings *config.GciSettings) (*Formatter, error) {
Cfg: gcicfg.BoolConfig{
NoInlineComments: settings.NoInlineComments,
NoPrefixComments: settings.NoPrefixComments,
SkipGenerated: settings.SkipGenerated,
CustomOrder: settings.CustomOrder,
NoLexOrder: settings.NoLexOrder,

// Should be managed with `formatters.exclusions.generated`.
SkipGenerated: false,
},
SectionStrings: settings.Sections,
ModPath: modPath,
Expand Down
4 changes: 3 additions & 1 deletion pkg/golinters/asasalint/asasalint.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ func New(settings *config.AsasalintSettings) *goanalysis.Linter {
if settings != nil {
cfg.Exclude = settings.Exclude
cfg.NoBuiltinExclusions = !settings.UseBuiltinExclusions
cfg.IgnoreTest = settings.IgnoreTest

// Should be managed with `linters.exclusions.rules`.
cfg.IgnoreTest = false
}

a, err := asasalint.NewAnalyzer(cfg)
Expand Down
3 changes: 2 additions & 1 deletion pkg/golinters/cyclop/cyclop.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ func New(settings *config.Cyclop) *goanalysis.Linter {
var cfg map[string]map[string]any
if settings != nil {
d := map[string]any{
"skipTests": settings.SkipTests,
// Should be managed with `linters.exclusions.rules`.
"skipTests": false,
}

if settings.MaxComplexity != 0 {
Expand Down
3 changes: 2 additions & 1 deletion pkg/golinters/exhaustive/exhaustive.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ func New(settings *config.ExhaustiveSettings) *goanalysis.Linter {
cfg = map[string]map[string]any{
a.Name: {
exhaustive.CheckFlag: settings.Check,
exhaustive.CheckGeneratedFlag: settings.CheckGenerated,
exhaustive.DefaultSignifiesExhaustiveFlag: settings.DefaultSignifiesExhaustive,
exhaustive.IgnoreEnumMembersFlag: settings.IgnoreEnumMembers,
exhaustive.IgnoreEnumTypesFlag: settings.IgnoreEnumTypes,
exhaustive.PackageScopeOnlyFlag: settings.PackageScopeOnly,
exhaustive.ExplicitExhaustiveMapFlag: settings.ExplicitExhaustiveMap,
exhaustive.ExplicitExhaustiveSwitchFlag: settings.ExplicitExhaustiveSwitch,
exhaustive.DefaultCaseRequiredFlag: settings.DefaultCaseRequired,
// Should be managed with `linters.exclusions.generated`.
exhaustive.CheckGeneratedFlag: true,
},
}
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/golinters/goconst/goconst.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ func New(settings *config.GoConstSettings) *goanalysis.Linter {
func runGoconst(pass *analysis.Pass, settings *config.GoConstSettings) ([]goanalysis.Issue, error) {
cfg := goconstAPI.Config{
IgnoreStrings: settings.IgnoreStrings,
IgnoreTests: settings.IgnoreTests,
MatchWithConstants: settings.MatchWithConstants,
MinStringLength: settings.MinStringLen,
MinOccurrences: settings.MinOccurrencesCount,
ParseNumbers: settings.ParseNumbers,
NumberMin: settings.NumberMin,
NumberMax: settings.NumberMax,
ExcludeTypes: map[goconstAPI.Type]bool{},

// Should be managed with `linters.exclusions.rules`.
IgnoreTests: false,
}

if settings.IgnoreCalls {
Expand Down
5 changes: 0 additions & 5 deletions pkg/golinters/goconst/testdata/goconst_dont_ignore.yml

This file was deleted.

1 change: 0 additions & 1 deletion pkg/golinters/goconst/testdata/goconst_dont_ignore_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//golangcitest:args -Egoconst
//golangcitest:config_path testdata/goconst_dont_ignore.yml
package testdata

import (
Expand Down
5 changes: 0 additions & 5 deletions pkg/golinters/goconst/testdata/goconst_ignore.yml

This file was deleted.

Loading
Loading