diff --git a/.golangci.example.yml b/.golangci.example.yml index a785363d963f..dff0aec98fb2 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -318,14 +318,17 @@ linters-settings: min-complexity: 10 godot: - # comments to be checked: `declarations`, `toplevel`, or `all` - scope: declarations + # comments to be checked: `declarations`, `toplevel`, or `all` (default: declarations) + scope: toplevel # list of regexps for excluding particular comment lines from check exclude: - # example: exclude comments which contain numbers - # - '[0-9]+' - # check that each sentence starts with a capital letter - capital: false + # exclude todo and fixme comments + - "^fixme:" + - "^todo:" + # 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: # report any comments starting with keywords, this is useful for TODO or FIXME comments that diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 62edb3c86cb1..2757bae366c4 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -29,6 +29,10 @@ var defaultLintersSettings = LintersSettings{ Godox: GodoxSettings{ Keywords: []string{}, }, + Godot: GodotSettings{ + Scope: "declarations", + Period: true, + }, Gofumpt: GofumptSettings{ LangVersion: "", ExtraRules: false, @@ -253,6 +257,7 @@ type GodotSettings struct { Scope string `mapstructure:"scope"` Exclude []string `mapstructure:"exclude"` Capital bool `mapstructure:"capital"` + Period bool `mapstructure:"period"` // Deprecated: use `Scope` instead CheckAll bool `mapstructure:"check-all"` diff --git a/pkg/golinters/godot.go b/pkg/golinters/godot.go index 57c9c4493fd8..cd5b2a43ef02 100644 --- a/pkg/golinters/godot.go +++ b/pkg/golinters/godot.go @@ -31,13 +31,14 @@ func NewGodot() *goanalysis.Linter { settings := godot.Settings{ Scope: godot.Scope(cfg.Scope), Exclude: cfg.Exclude, - Period: true, + Period: cfg.Period, Capital: cfg.Capital, } // Convert deprecated setting + // todo(butuzov): remove on v2 release if cfg.CheckAll { // nolint:staticcheck - settings.Scope = godot.TopLevelScope + settings.Scope = godot.AllScope } if settings.Scope == "" {