Skip to content

build(deps): bump github.com/mgechev/revive from 1.3.7 to 1.3.9 #4886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,12 @@ linters-settings:
arguments:
- mypragma
- otherpragma
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comments-density
- name: comments-density
severity: warning
disabled: false
exclude: [""]
arguments: [ 15 ]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming
- name: confusing-naming
severity: warning
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ require (
github.com/maratori/testpackage v1.1.1
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26
github.com/mattn/go-colorable v0.1.13
github.com/mgechev/revive v1.3.7
github.com/mgechev/revive v1.3.9
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-ps v1.0.0
github.com/moricho/tparallel v0.3.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"call-to-gc",
"cognitive-complexity",
"comment-spacings",
"comments-density",
"confusing-naming",
"confusing-results",
"constant-logical-expr",
Expand Down
5 changes: 3 additions & 2 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,9 @@ type ReassignSettings struct {
}

type ReviveSettings struct {
MaxOpenFiles int `mapstructure:"max-open-files"`
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
Go string `mapstructure:"-"`
MaxOpenFiles int `mapstructure:"max-open-files"`
IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
Confidence float64
Severity string
EnableAllRules bool `mapstructure:"enable-all-rules"`
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ func (l *Loader) handleGoVersion() {

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

l.cfg.LintersSettings.Revive.Go = trimmedGoVersion

l.cfg.LintersSettings.Gocritic.Go = trimmedGoVersion

// staticcheck related linters.
Expand Down
14 changes: 12 additions & 2 deletions pkg/golinters/revive/revive.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"sync"

"github.com/BurntSushi/toml"
hcversion "github.com/hashicorp/go-version"
reviveConfig "github.com/mgechev/revive/config"
"github.com/mgechev/revive/lint"
"github.com/mgechev/revive/rule"
Expand Down Expand Up @@ -89,6 +90,11 @@ func newWrapper(settings *config.ReviveSettings) (*wrapper, error) {
return nil, err
}

conf.GoVersion, err = hcversion.NewVersion(settings.Go)
if err != nil {
return nil, err
}

formatter, err := reviveConfig.GetFormatter("json")
if err != nil {
return nil, err
Expand Down Expand Up @@ -183,7 +189,10 @@ func toIssue(pass *analysis.Pass, object *jsonObject) goanalysis.Issue {
func getConfig(cfg *config.ReviveSettings) (*lint.Config, error) {
conf := defaultConfig()

if !reflect.DeepEqual(cfg, &config.ReviveSettings{}) {
// Since the Go version is dynamic, this value must be neutralized in order to compare with a "zero value" of the configuration structure.
zero := &config.ReviveSettings{Go: cfg.Go}

if !reflect.DeepEqual(cfg, zero) {
rawRoot := createConfigMap(cfg)
buf := bytes.NewBuffer(nil)

Expand Down Expand Up @@ -275,7 +284,7 @@ func safeTomlSlice(r []any) []any {
}

// This element is not exported by revive, so we need copy the code.
// Extracted from https://github.com/mgechev/revive/blob/v1.3.7/config/config.go#L15
// Extracted from https://github.com/mgechev/revive/blob/v1.3.9/config/config.go#L15
var defaultRules = []lint.Rule{
&rule.VarDeclarationsRule{},
&rule.PackageCommentsRule{},
Expand Down Expand Up @@ -358,6 +367,7 @@ var allRules = append([]lint.Rule{
&rule.EnforceRepeatedArgTypeStyleRule{},
&rule.EnforceSliceStyleRule{},
&rule.MaxControlNestingRule{},
&rule.CommentsDensityRule{},
}, defaultRules...)

const defaultConfidence = 0.8
Expand Down
Loading