Skip to content

Commit 5536bb5

Browse files
build(deps): bump github.com/mgechev/revive from 1.3.7 to 1.3.9 (#4886)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent f903621 commit 5536bb5

File tree

7 files changed

+27
-7
lines changed

7 files changed

+27
-7
lines changed

Diff for: .golangci.next.reference.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,12 @@ linters-settings:
16121612
arguments:
16131613
- mypragma
16141614
- otherpragma
1615+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comments-density
1616+
- name: comments-density
1617+
severity: warning
1618+
disabled: false
1619+
exclude: [""]
1620+
arguments: [ 15 ]
16151621
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming
16161622
- name: confusing-naming
16171623
severity: warning

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ require (
7575
github.com/maratori/testpackage v1.1.1
7676
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26
7777
github.com/mattn/go-colorable v0.1.13
78-
github.com/mgechev/revive v1.3.7
78+
github.com/mgechev/revive v1.3.9
7979
github.com/mitchellh/go-homedir v1.1.0
8080
github.com/mitchellh/go-ps v1.0.0
8181
github.com/moricho/tparallel v0.3.2

Diff for: go.sum

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: jsonschema/golangci.next.jsonschema.json

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@
217217
"call-to-gc",
218218
"cognitive-complexity",
219219
"comment-spacings",
220+
"comments-density",
220221
"confusing-naming",
221222
"confusing-results",
222223
"constant-logical-expr",

Diff for: pkg/config/linters_settings.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,9 @@ type ReassignSettings struct {
791791
}
792792

793793
type ReviveSettings struct {
794-
MaxOpenFiles int `mapstructure:"max-open-files"`
795-
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
794+
Go string `mapstructure:"-"`
795+
MaxOpenFiles int `mapstructure:"max-open-files"`
796+
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
796797
Confidence float64
797798
Severity string
798799
EnableAllRules bool `mapstructure:"enable-all-rules"`

Diff for: pkg/config/loader.go

+2
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ func (l *Loader) handleGoVersion() {
292292

293293
trimmedGoVersion := trimGoVersion(l.cfg.Run.Go)
294294

295+
l.cfg.LintersSettings.Revive.Go = trimmedGoVersion
296+
295297
l.cfg.LintersSettings.Gocritic.Go = trimmedGoVersion
296298

297299
// staticcheck related linters.

Diff for: pkg/golinters/revive/revive.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"sync"
1111

1212
"github.com/BurntSushi/toml"
13+
hcversion "github.com/hashicorp/go-version"
1314
reviveConfig "github.com/mgechev/revive/config"
1415
"github.com/mgechev/revive/lint"
1516
"github.com/mgechev/revive/rule"
@@ -89,6 +90,11 @@ func newWrapper(settings *config.ReviveSettings) (*wrapper, error) {
8990
return nil, err
9091
}
9192

93+
conf.GoVersion, err = hcversion.NewVersion(settings.Go)
94+
if err != nil {
95+
return nil, err
96+
}
97+
9298
formatter, err := reviveConfig.GetFormatter("json")
9399
if err != nil {
94100
return nil, err
@@ -183,7 +189,10 @@ func toIssue(pass *analysis.Pass, object *jsonObject) goanalysis.Issue {
183189
func getConfig(cfg *config.ReviveSettings) (*lint.Config, error) {
184190
conf := defaultConfig()
185191

186-
if !reflect.DeepEqual(cfg, &config.ReviveSettings{}) {
192+
// Since the Go version is dynamic, this value must be neutralized in order to compare with a "zero value" of the configuration structure.
193+
zero := &config.ReviveSettings{Go: cfg.Go}
194+
195+
if !reflect.DeepEqual(cfg, zero) {
187196
rawRoot := createConfigMap(cfg)
188197
buf := bytes.NewBuffer(nil)
189198

@@ -275,7 +284,7 @@ func safeTomlSlice(r []any) []any {
275284
}
276285

277286
// This element is not exported by revive, so we need copy the code.
278-
// Extracted from https://github.com/mgechev/revive/blob/v1.3.7/config/config.go#L15
287+
// Extracted from https://github.com/mgechev/revive/blob/v1.3.9/config/config.go#L15
279288
var defaultRules = []lint.Rule{
280289
&rule.VarDeclarationsRule{},
281290
&rule.PackageCommentsRule{},
@@ -358,6 +367,7 @@ var allRules = append([]lint.Rule{
358367
&rule.EnforceRepeatedArgTypeStyleRule{},
359368
&rule.EnforceSliceStyleRule{},
360369
&rule.MaxControlNestingRule{},
370+
&rule.CommentsDensityRule{},
361371
}, defaultRules...)
362372

363373
const defaultConfidence = 0.8

0 commit comments

Comments
 (0)