Skip to content

Commit 95b9b23

Browse files
authored
godot: add period option (#2483)
1 parent cf053b2 commit 95b9b23

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.golangci.example.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,17 @@ linters-settings:
343343
min-complexity: 10
344344

345345
godot:
346-
# comments to be checked: `declarations`, `toplevel`, or `all`
347-
scope: declarations
346+
# comments to be checked: `declarations`, `toplevel`, or `all` (default: declarations)
347+
scope: toplevel
348348
# list of regexps for excluding particular comment lines from check
349349
exclude:
350-
# example: exclude comments which contain numbers
351-
# - '[0-9]+'
352-
# check that each sentence starts with a capital letter
353-
capital: false
350+
# exclude todo and fixme comments
351+
- "^fixme:"
352+
- "^todo:"
353+
# check that each sentence ends with a period (default: true)
354+
period: false
355+
# check that each sentence starts with a capital letter (default: false)
356+
capital: true
354357

355358
godox:
356359
# report any comments starting with keywords, this is useful for TODO or FIXME comments that

pkg/config/linters_settings.go

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ var defaultLintersSettings = LintersSettings{
3535
Godox: GodoxSettings{
3636
Keywords: []string{},
3737
},
38+
Godot: GodotSettings{
39+
Scope: "declarations",
40+
Period: true,
41+
},
3842
Gofumpt: GofumptSettings{
3943
LangVersion: "",
4044
ExtraRules: false,
@@ -266,6 +270,7 @@ type GodotSettings struct {
266270
Scope string `mapstructure:"scope"`
267271
Exclude []string `mapstructure:"exclude"`
268272
Capital bool `mapstructure:"capital"`
273+
Period bool `mapstructure:"period"`
269274

270275
// Deprecated: use `Scope` instead
271276
CheckAll bool `mapstructure:"check-all"`

pkg/golinters/godot.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ func NewGodot() *goanalysis.Linter {
3131
settings := godot.Settings{
3232
Scope: godot.Scope(cfg.Scope),
3333
Exclude: cfg.Exclude,
34-
Period: true,
34+
Period: cfg.Period,
3535
Capital: cfg.Capital,
3636
}
3737

3838
// Convert deprecated setting
39+
// todo(butuzov): remove on v2 release
3940
if cfg.CheckAll { // nolint:staticcheck
40-
settings.Scope = godot.TopLevelScope
41+
settings.Scope = godot.AllScope
4142
}
4243

4344
if settings.Scope == "" {

0 commit comments

Comments
 (0)