Skip to content
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
17 changes: 16 additions & 1 deletion .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,7 @@ linters:
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redundant-test-main-exit
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redundant-test-main-exit
- name: redundant-test-main-exit
severity: warning
disabled: false
Expand Down Expand Up @@ -2629,6 +2629,11 @@ linters:
exclude: [""]
arguments:
- "preserve-scope"
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-date
- name: time-date
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-equal
- name: time-equal
severity: warning
Expand Down Expand Up @@ -2669,6 +2674,11 @@ linters:
arguments:
- "fmt.Printf"
- "myFunction"
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unnecessary-format
- name: unnecessary-format
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unnecessary-stmt
- name: unnecessary-stmt
severity: warning
Expand Down Expand Up @@ -2703,6 +2713,11 @@ linters:
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#use-fmt-print
- name: use-fmt-print
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#useless-break
- name: useless-break
severity: warning
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ require (
github.com/maratori/testpackage v1.1.1
github.com/matoous/godox v1.1.0
github.com/mattn/go-colorable v0.1.14
github.com/mgechev/revive v1.9.0
github.com/mgechev/revive v1.10.0
github.com/mitchellh/go-homedir v1.1.0
github.com/moricho/tparallel v0.3.2
github.com/nakabonne/nestif v0.3.1
Expand Down Expand Up @@ -141,6 +141,7 @@ require (
)

require (
codeberg.org/chavacava/garif v0.2.0 // indirect
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand All @@ -150,7 +151,6 @@ require (
github.com/charmbracelet/x/ansi v0.8.0 // indirect
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/chavacava/garif v0.1.0 // indirect
github.com/dave/dst v0.27.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.11.5 // indirect
Expand Down Expand Up @@ -184,7 +184,6 @@ require (
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
Expand Down
16 changes: 4 additions & 12 deletions go.sum

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

3 changes: 3 additions & 0 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -638,19 +638,22 @@
"string-of-int",
"struct-tag",
"superfluous-else",
"time-date",
"time-equal",
"time-naming",
"unchecked-type-assertion",
"unconditional-recursion",
"unexported-naming",
"unexported-return",
"unhandled-error",
"unnecessary-format",
"unnecessary-stmt",
"unreachable-code",
"unused-parameter",
"unused-receiver",
"use-any",
"use-errors-new",
"use-fmt-print",
"useless-break",
"var-declaration",
"var-naming",
Expand Down
102 changes: 53 additions & 49 deletions pkg/golinters/revive/revive.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (w *wrapper) toIssue(pass *analysis.Pass, failure *lint.Failure) goanalysis
f := pass.Fset.File(token.Pos(failure.Position.Start.Offset))

// Skip cgo files because the positions are wrong.
if failure.GetFilename() == f.Name() {
if failure.Filename() == f.Name() {
issue.SuggestedFixes = []analysis.SuggestedFix{{
TextEdits: []analysis.TextEdit{{
Pos: f.LineStart(failure.Position.Start.Line),
Expand Down Expand Up @@ -269,7 +269,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.6.0/config/config.go#L16
// Extracted from https://github.com/mgechev/revive/blob/v1.10.0/config/config.go#L16
var defaultRules = []lint.Rule{
&rule.VarDeclarationsRule{},
&rule.PackageCommentsRule{},
Expand Down Expand Up @@ -297,66 +297,70 @@ var defaultRules = []lint.Rule{
}

var allRules = append([]lint.Rule{
&rule.AddConstantRule{},
&rule.ArgumentsLimitRule{},
&rule.CyclomaticRule{},
&rule.FileHeaderRule{},
&rule.AtomicRule{},
&rule.BannedCharsRule{},
&rule.BareReturnRule{},
&rule.BoolLiteralRule{},
&rule.CallToGCRule{},
&rule.CognitiveComplexityRule{},
&rule.CommentsDensityRule{},
&rule.CommentSpacingsRule{},
&rule.ConfusingNamingRule{},
&rule.GetReturnRule{},
&rule.ModifiesParamRule{},
&rule.ConfusingResultsRule{},
&rule.DeepExitRule{},
&rule.AddConstantRule{},
&rule.FlagParamRule{},
&rule.UnnecessaryStmtRule{},
&rule.StructTagRule{},
&rule.ModifiesValRecRule{},
&rule.ConstantLogicalExprRule{},
&rule.BoolLiteralRule{},
&rule.ImportsBlocklistRule{},
&rule.FunctionResultsLimitRule{},
&rule.MaxPublicStructsRule{},
&rule.RangeValInClosureRule{},
&rule.RangeValAddress{},
&rule.WaitGroupByValueRule{},
&rule.AtomicRule{},
&rule.EmptyLinesRule{},
&rule.LineLengthLimitRule{},
&rule.CallToGCRule{},
&rule.CyclomaticRule{},
&rule.DataRaceRule{},
&rule.DeepExitRule{},
&rule.DeferRule{},
&rule.DuplicatedImportsRule{},
&rule.ImportShadowingRule{},
&rule.BareReturnRule{},
&rule.UnusedReceiverRule{},
&rule.UnhandledErrorRule{},
&rule.CognitiveComplexityRule{},
&rule.StringOfIntRule{},
&rule.StringFormatRule{},
&rule.EarlyReturnRule{},
&rule.UnconditionalRecursionRule{},
&rule.IdenticalBranchesRule{},
&rule.DeferRule{},
&rule.UnexportedNamingRule{},
&rule.FunctionLength{},
&rule.NestedStructs{},
&rule.UselessBreak{},
&rule.UncheckedTypeAssertionRule{},
&rule.TimeEqualRule{},
&rule.BannedCharsRule{},
&rule.OptimizeOperandsOrderRule{},
&rule.UseAnyRule{},
&rule.DataRaceRule{},
&rule.CommentSpacingsRule{},
&rule.IfReturnRule{},
&rule.RedundantImportAlias{},
&rule.ImportAliasNamingRule{},
&rule.EmptyLinesRule{},
&rule.EnforceMapStyleRule{},
&rule.EnforceRepeatedArgTypeStyleRule{},
&rule.EnforceSliceStyleRule{},
&rule.MaxControlNestingRule{},
&rule.CommentsDensityRule{},
&rule.FileHeaderRule{},
&rule.FileLengthLimitRule{},
&rule.FilenameFormatRule{},
&rule.FlagParamRule{},
&rule.FunctionLength{},
&rule.FunctionResultsLimitRule{},
&rule.GetReturnRule{},
&rule.IdenticalBranchesRule{},
&rule.IfReturnRule{},
&rule.ImportAliasNamingRule{},
&rule.ImportsBlocklistRule{},
&rule.ImportShadowingRule{},
&rule.LineLengthLimitRule{},
&rule.MaxControlNestingRule{},
&rule.MaxPublicStructsRule{},
&rule.ModifiesParamRule{},
&rule.ModifiesValRecRule{},
&rule.NestedStructs{},
&rule.OptimizeOperandsOrderRule{},
&rule.RangeValAddress{},
&rule.RangeValInClosureRule{},
&rule.RedundantBuildTagRule{},
&rule.RedundantImportAlias{},
&rule.RedundantTestMainExitRule{},
&rule.StringFormatRule{},
&rule.StringOfIntRule{},
&rule.StructTagRule{},
&rule.TimeDateRule{},
&rule.TimeEqualRule{},
&rule.UncheckedTypeAssertionRule{},
&rule.UnconditionalRecursionRule{},
&rule.UnexportedNamingRule{},
&rule.UnhandledErrorRule{},
&rule.UnnecessaryFormatRule{},
&rule.UnnecessaryStmtRule{},
&rule.UnusedReceiverRule{},
&rule.UseAnyRule{},
&rule.UseErrorsNewRule{},
&rule.UseFmtPrintRule{},
&rule.UselessBreak{},
&rule.WaitGroupByValueRule{},
}, defaultRules...)

const defaultConfidence = 0.8
Expand Down
Loading