From 7d15ce5673553a2ce0c9946d64f3118dc710d6db Mon Sep 17 00:00:00 2001 From: Oleg Butuzov Date: Fri, 14 Jan 2022 16:47:45 +0200 Subject: [PATCH 1/4] dev(godot): refactor `godot` settings --- .golangci.example.yml | 9 ++++++--- pkg/config/linters_settings.go | 5 +++++ pkg/golinters/godot.go | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index a785363d963f..b400d421c06b 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -322,10 +322,13 @@ linters-settings: scope: declarations # list of regexps for excluding particular comment lines from check exclude: - # example: exclude comments which contain numbers - # - '[0-9]+' + # exclude todo and fixme comments + - "^fixme:" + - "^todo:" + # check that each sentence ends with a dot + period: false # check that each sentence starts with a capital letter - capital: 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 == "" { From 7bffe47904b375c042caaceff7bf5007ef8517a7 Mon Sep 17 00:00:00 2001 From: Oleg Butuzov Date: Sat, 15 Jan 2022 12:55:26 +0200 Subject: [PATCH 2/4] fix: example configuration --- .golangci.example.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index b400d421c06b..57df732b5b41 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -318,16 +318,16 @@ 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: # exclude todo and fixme comments - "^fixme:" - "^todo:" - # check that each sentence ends with a dot + # don't check that each sentence ends with a period (default: true) period: false - # check that each sentence starts with a capital letter + # check that each sentence starts with a capital letter (default: false) capital: true godox: From 32458de05e57a027b131fe7289ddff6bedc038cc Mon Sep 17 00:00:00 2001 From: Oleg Butuzov Date: Sat, 15 Jan 2022 13:13:24 +0200 Subject: [PATCH 3/4] Update .golangci.example.yml Co-authored-by: Ludovic Fernandez --- .golangci.example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 57df732b5b41..80edc8de07a7 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -325,7 +325,7 @@ linters-settings: # exclude todo and fixme comments - "^fixme:" - "^todo:" - # don't check that each sentence ends with a period (default: true) + # 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 From c6ff8673e697afd06b0057c4f6a8c842d04dc42c Mon Sep 17 00:00:00 2001 From: Oleg Butuzov Date: Sat, 15 Jan 2022 13:22:00 +0200 Subject: [PATCH 4/4] Update .golangci.example.yml Co-authored-by: Ludovic Fernandez --- .golangci.example.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 80edc8de07a7..dff0aec98fb2 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -322,9 +322,9 @@ linters-settings: scope: toplevel # list of regexps for excluding particular comment lines from check exclude: - # exclude todo and fixme comments - - "^fixme:" - - "^todo:" + # 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)