godot: add period option (#2483)

This commit is contained in:
Oleg Butuzov 2022-01-15 13:53:05 +02:00 committed by GitHub
parent cf053b2624
commit 95b9b23464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View File

@ -343,14 +343,17 @@ linters-settings:
min-complexity: 10 min-complexity: 10
godot: godot:
# comments to be checked: `declarations`, `toplevel`, or `all` # comments to be checked: `declarations`, `toplevel`, or `all` (default: declarations)
scope: declarations scope: toplevel
# list of regexps for excluding particular comment lines from check # list of regexps for excluding particular comment lines from check
exclude: exclude:
# example: exclude comments which contain numbers # exclude todo and fixme comments
# - '[0-9]+' - "^fixme:"
# check that each sentence starts with a capital letter - "^todo:"
capital: false # check that each sentence ends with a period (default: true)
period: false
# check that each sentence starts with a capital letter (default: false)
capital: true
godox: godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that # report any comments starting with keywords, this is useful for TODO or FIXME comments that

View File

@ -35,6 +35,10 @@ var defaultLintersSettings = LintersSettings{
Godox: GodoxSettings{ Godox: GodoxSettings{
Keywords: []string{}, Keywords: []string{},
}, },
Godot: GodotSettings{
Scope: "declarations",
Period: true,
},
Gofumpt: GofumptSettings{ Gofumpt: GofumptSettings{
LangVersion: "", LangVersion: "",
ExtraRules: false, ExtraRules: false,
@ -266,6 +270,7 @@ type GodotSettings struct {
Scope string `mapstructure:"scope"` Scope string `mapstructure:"scope"`
Exclude []string `mapstructure:"exclude"` Exclude []string `mapstructure:"exclude"`
Capital bool `mapstructure:"capital"` Capital bool `mapstructure:"capital"`
Period bool `mapstructure:"period"`
// Deprecated: use `Scope` instead // Deprecated: use `Scope` instead
CheckAll bool `mapstructure:"check-all"` CheckAll bool `mapstructure:"check-all"`

View File

@ -31,13 +31,14 @@ func NewGodot() *goanalysis.Linter {
settings := godot.Settings{ settings := godot.Settings{
Scope: godot.Scope(cfg.Scope), Scope: godot.Scope(cfg.Scope),
Exclude: cfg.Exclude, Exclude: cfg.Exclude,
Period: true, Period: cfg.Period,
Capital: cfg.Capital, Capital: cfg.Capital,
} }
// Convert deprecated setting // Convert deprecated setting
// todo(butuzov): remove on v2 release
if cfg.CheckAll { // nolint:staticcheck if cfg.CheckAll { // nolint:staticcheck
settings.Scope = godot.TopLevelScope settings.Scope = godot.AllScope
} }
if settings.Scope == "" { if settings.Scope == "" {