Skip to content

docs: add arguments to revive.error-strings #5455

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 1 commit into from
Feb 21, 2025
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
2 changes: 2 additions & 0 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,8 @@ linters-settings:
severity: warning
disabled: false
exclude: [""]
arguments:
- "xerrors.New"
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#errorf
- name: errorf
severity: warning
Expand Down
6 changes: 6 additions & 0 deletions pkg/golinters/revive/testdata/revive.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package testdata
import (
"net/http"
"time"

"golang.org/x/xerrors"
)

func SampleRevive(t *time.Duration) error {
Expand All @@ -28,3 +30,7 @@ func testReviveComplexity(s string) { // want "cyclomatic: function testReviveCo
return
}
}

func testErrorStrings() {
_ = xerrors.New("Some error!") // want "error strings should not be capitalized or end with punctuation or a newline"
}
3 changes: 3 additions & 0 deletions pkg/golinters/revive/testdata/revive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ linters-settings:
arguments: [ 10 ]
- name: max-public-structs
arguments: [ 3 ]
- name: error-strings
arguments:
- "xerrors.New"
Loading