diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-08-10 13:54:28 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-08-11 15:03:14 +0300 |
commit | 3b6e4a13fcda407cdfa1f37874fd3fc04e8c0421 (patch) | |
tree | 22bb5b74205099f234f2009e086fa098f1062842 | |
parent | 7e87131edb431c2d7d491f29606fe88955b399eb (diff) |
golangci-lint: Add `thelper` linter
Add the `thelper` linter, which knows to enforce consistent code styles
around tests:
- `testing.T` should be the first parameter in test-related
functions.
- Functions called by tests should call `t.Helper()`.
- `testing.T`, `testing.B` and testing.TB` variables should be
consistently named as `t`, `b`, and `tb`, respectively.
Right now we still have all rules disabled that would trigger warnings.
-rw-r--r-- | .golangci.yml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/.golangci.yml b/.golangci.yml index 4c07d598d..cced853f6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,6 +34,7 @@ linters: - staticcheck - structcheck - stylecheck + - thelper - unconvert - unused - varcheck @@ -73,6 +74,17 @@ linters-settings: # ST1000 checks for missing package comments. We don't use these for most # packages, so let's disable this check. checks: [ "all", "-ST1000" ] + thelper: + test: + first: false + begin: false + benchmark: + first: false + begin: false + tb: + first: false + name: false + begin: false issues: exclude-use-default: false |