exhaustive: add missing config (#3212)
This commit is contained in:
parent
1f155b7ef6
commit
8a3b754ca2
@ -293,6 +293,11 @@ linters-settings:
|
|||||||
comparison: false
|
comparison: false
|
||||||
|
|
||||||
exhaustive:
|
exhaustive:
|
||||||
|
# Program elements to check for exhaustiveness.
|
||||||
|
# Default: [ switch ]
|
||||||
|
check:
|
||||||
|
- switch
|
||||||
|
- map
|
||||||
# Check switch statements in generated files also.
|
# Check switch statements in generated files also.
|
||||||
# Default: false
|
# Default: false
|
||||||
check-generated: true
|
check-generated: true
|
||||||
@ -307,10 +312,10 @@ linters-settings:
|
|||||||
# Consider enums only in package scopes, not in inner scopes.
|
# Consider enums only in package scopes, not in inner scopes.
|
||||||
# Default: false
|
# Default: false
|
||||||
package-scope-only: true
|
package-scope-only: true
|
||||||
# only run exhaustive check on switches with "//exhaustive:enforce" comment
|
# Only run exhaustive check on switches with "//exhaustive:enforce" comment.
|
||||||
# Default: false
|
# Default: false
|
||||||
explicit-exhaustive-switch: true
|
explicit-exhaustive-switch: true
|
||||||
# only run exhaustive check on map literals with "//exhaustive:enforce" comment.
|
# Only run exhaustive check on map literals with "//exhaustive:enforce" comment.
|
||||||
# Default: false
|
# Default: false
|
||||||
explicit-exhaustive-map: true
|
explicit-exhaustive-map: true
|
||||||
|
|
||||||
|
@ -25,10 +25,13 @@ var defaultLintersSettings = LintersSettings{
|
|||||||
Comparison: true,
|
Comparison: true,
|
||||||
},
|
},
|
||||||
Exhaustive: ExhaustiveSettings{
|
Exhaustive: ExhaustiveSettings{
|
||||||
|
Check: []string{"switch"},
|
||||||
CheckGenerated: false,
|
CheckGenerated: false,
|
||||||
DefaultSignifiesExhaustive: false,
|
DefaultSignifiesExhaustive: false,
|
||||||
IgnoreEnumMembers: "",
|
IgnoreEnumMembers: "",
|
||||||
PackageScopeOnly: false,
|
PackageScopeOnly: false,
|
||||||
|
ExplicitExhaustiveMap: false,
|
||||||
|
ExplicitExhaustiveSwitch: false,
|
||||||
},
|
},
|
||||||
Forbidigo: ForbidigoSettings{
|
Forbidigo: ForbidigoSettings{
|
||||||
ExcludeGodocExamples: true,
|
ExcludeGodocExamples: true,
|
||||||
@ -274,6 +277,7 @@ type ErrorLintSettings struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ExhaustiveSettings struct {
|
type ExhaustiveSettings struct {
|
||||||
|
Check []string `mapstructure:"check"`
|
||||||
CheckGenerated bool `mapstructure:"check-generated"`
|
CheckGenerated bool `mapstructure:"check-generated"`
|
||||||
DefaultSignifiesExhaustive bool `mapstructure:"default-signifies-exhaustive"`
|
DefaultSignifiesExhaustive bool `mapstructure:"default-signifies-exhaustive"`
|
||||||
IgnoreEnumMembers string `mapstructure:"ignore-enum-members"`
|
IgnoreEnumMembers string `mapstructure:"ignore-enum-members"`
|
||||||
|
@ -15,11 +15,13 @@ func NewExhaustive(settings *config.ExhaustiveSettings) *goanalysis.Linter {
|
|||||||
if settings != nil {
|
if settings != nil {
|
||||||
cfg = map[string]map[string]interface{}{
|
cfg = map[string]map[string]interface{}{
|
||||||
a.Name: {
|
a.Name: {
|
||||||
|
exhaustive.CheckFlag: settings.Check,
|
||||||
exhaustive.CheckGeneratedFlag: settings.CheckGenerated,
|
exhaustive.CheckGeneratedFlag: settings.CheckGenerated,
|
||||||
exhaustive.DefaultSignifiesExhaustiveFlag: settings.DefaultSignifiesExhaustive,
|
exhaustive.DefaultSignifiesExhaustiveFlag: settings.DefaultSignifiesExhaustive,
|
||||||
exhaustive.ExplicitExhaustiveMapFlag: settings.ExplicitExhaustiveMap,
|
|
||||||
exhaustive.ExplicitExhaustiveSwitchFlag: settings.PackageScopeOnly,
|
|
||||||
exhaustive.IgnoreEnumMembersFlag: settings.IgnoreEnumMembers,
|
exhaustive.IgnoreEnumMembersFlag: settings.IgnoreEnumMembers,
|
||||||
|
exhaustive.PackageScopeOnlyFlag: settings.PackageScopeOnly,
|
||||||
|
exhaustive.ExplicitExhaustiveMapFlag: settings.ExplicitExhaustiveMap,
|
||||||
|
exhaustive.ExplicitExhaustiveSwitchFlag: settings.ExplicitExhaustiveSwitch,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user