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
42 changes: 42 additions & 0 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,26 @@ linters:
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#identical-ifelseif-branches
- name: identical-ifelseif-branches
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#identical-ifelseif-conditions
- name: identical-ifelseif-conditions
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#identical-switch-branches
- name: identical-switch-branches
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#identical-switch-conditions
- name: identical-switch-conditions
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#if-return
- name: if-return
severity: warning
Expand Down Expand Up @@ -2601,6 +2621,13 @@ linters:
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#package-directory-mismatch
- name: package-directory-mismatch
severity: warning
disabled: false
exclude: [""]
arguments:
- ignore-directories: ["testcases", "testinfo"]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#range
- name: range
severity: warning
Expand Down Expand Up @@ -2738,6 +2765,11 @@ linters:
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unsecure-url-scheme
- name: unsecure-url-scheme
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
Expand Down Expand Up @@ -2767,11 +2799,21 @@ linters:
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#use-waitgroup-go
- name: use-waitgroup-go
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#useless-break
- name: useless-break
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#useless-fallthrough
- name: useless-fallthrough
severity: warning
disabled: false
exclude: [""]
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#var-declaration
- name: var-declaration
severity: warning
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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.11.0
github.com/mgechev/revive v1.12.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
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.

8 changes: 8 additions & 0 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,10 @@
"function-result-limit",
"get-return",
"identical-branches",
"identical-ifelseif-branches",
"identical-ifelseif-conditions",
"identical-switch-branches",
"identical-switch-conditions",
"if-return",
"import-alias-naming",
"import-shadowing",
Expand All @@ -627,6 +631,7 @@
"nested-structs",
"optimize-operands-order",
"package-comments",
"package-directory-mismatch",
"range-val-address",
"range-val-in-closure",
"range",
Expand All @@ -650,12 +655,15 @@
"unnecessary-format",
"unnecessary-stmt",
"unreachable-code",
"unsecure-url-scheme",
"unused-parameter",
"unused-receiver",
"use-any",
"use-errors-new",
"use-fmt-print",
"use-waitgroup-go",
"useless-break",
"useless-fallthrough",
"var-declaration",
"var-naming",
"waitgroup-by-value"
Expand Down
16 changes: 12 additions & 4 deletions pkg/golinters/revive/revive.go
Original file line number Diff line number Diff line change
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.11.0/config/config.go#L166
// Extracted from https://github.com/mgechev/revive/blob/v1.12.0/config/config.go#L16
var defaultRules = []lint.Rule{
&rule.VarDeclarationsRule{},
&rule.PackageCommentsRule{},
Expand Down Expand Up @@ -329,6 +329,10 @@ var allRules = append([]lint.Rule{
&rule.FunctionResultsLimitRule{},
&rule.GetReturnRule{},
&rule.IdenticalBranchesRule{},
&rule.IdenticalIfElseIfBranchesRule{},
&rule.IdenticalIfElseIfConditionsRule{},
&rule.IdenticalSwitchBranchesRule{},
&rule.IdenticalSwitchConditionsRule{},
&rule.IfReturnRule{},
&rule.ImportAliasNamingRule{},
&rule.ImportsBlocklistRule{},
Expand All @@ -340,6 +344,7 @@ var allRules = append([]lint.Rule{
&rule.ModifiesValRecRule{},
&rule.NestedStructs{},
&rule.OptimizeOperandsOrderRule{},
&rule.PackageDirectoryMismatchRule{},
&rule.RangeValAddress{},
&rule.RangeValInClosureRule{},
&rule.RedundantBuildTagRule{},
Expand All @@ -356,18 +361,21 @@ var allRules = append([]lint.Rule{
&rule.UnhandledErrorRule{},
&rule.UnnecessaryFormatRule{},
&rule.UnnecessaryStmtRule{},
&rule.UnsecureURLSchemeRule{},
&rule.UnusedReceiverRule{},
&rule.UseAnyRule{},
&rule.UseErrorsNewRule{},
&rule.UseFmtPrintRule{},
&rule.UselessBreak{},
&rule.UselessFallthroughRule{},
&rule.UseWaitGroupGoRule{},
&rule.WaitGroupByValueRule{},
}, defaultRules...)

const defaultConfidence = 0.8

// This element is not exported by revive, so we need copy the code.
// Extracted from https://github.com/mgechev/revive/blob/v1.11.0/config/config.go#L198
// Extracted from https://github.com/mgechev/revive/blob/v1.12.0/config/config.go#L206
func normalizeConfig(cfg *lint.Config) {
// NOTE(ldez): this custom section for golangci-lint should be kept.
// ---
Expand Down Expand Up @@ -409,7 +417,7 @@ func normalizeConfig(cfg *lint.Config) {
}

// This element is not exported by revive, so we need copy the code.
// Extracted from https://github.com/mgechev/revive/blob/v1.11.0/config/config.go#L266
// Extracted from https://github.com/mgechev/revive/blob/v1.12.0/config/config.go#L274
func defaultConfig() *lint.Config {
defaultConfig := lint.Config{
Confidence: defaultConfidence,
Expand Down Expand Up @@ -455,7 +463,7 @@ func extractRulesName(rules []lint.Rule) []string {
return names
}

// Extracted from https://github.com/mgechev/revive/blob/v1.11.0/formatter/severity.go
// Extracted from https://github.com/mgechev/revive/blob/v1.12.0/formatter/severity.go
// Modified to use pointers (related to hugeParam rule).
func severity(cfg *lint.Config, failure *lint.Failure) lint.Severity {
if cfg, ok := cfg.Rules[failure.RuleName]; ok && cfg.Severity == lint.SeverityError {
Expand Down
Loading