Skip to content

Commit 70a27a5

Browse files
dependabot[bot]ldez
authored andcommitted
build(deps): bump github.com/mgechev/revive from 1.3.7 to 1.3.9 (golangci#4886)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent bbf1b91 commit 70a27a5

File tree

7 files changed

+27
-7
lines changed

7 files changed

+27
-7
lines changed

.golangci.next.reference.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,12 @@ linters-settings:
16231623
arguments:
16241624
- mypragma
16251625
- otherpragma
1626+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comments-density
1627+
- name: comments-density
1628+
severity: warning
1629+
disabled: false
1630+
exclude: [""]
1631+
arguments: [ 15 ]
16261632
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming
16271633
- name: confusing-naming
16281634
severity: warning

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

go.sum

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

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",

pkg/config/linters_settings.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,9 @@ type ReassignSettings struct {
803803
}
804804

805805
type ReviveSettings struct {
806-
MaxOpenFiles int `mapstructure:"max-open-files"`
807-
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
806+
Go string `mapstructure:"-"`
807+
MaxOpenFiles int `mapstructure:"max-open-files"`
808+
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
808809
Confidence float64
809810
Severity string
810811
EnableAllRules bool `mapstructure:"enable-all-rules"`

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.

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)