diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-10 18:02:22 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-14 09:54:12 +0300 |
commit | f7071f97997fb7734cf6903285b007336186b22a (patch) | |
tree | 3a5dd5ffa5521f4b16f6f332d4aac53323ea0040 /.golangci.yml | |
parent | 08d5b7b268e36da27a7843a1c7d7021ef9a96487 (diff) |
lint: Disallow use of "normal" contexts
Our testhelper context has recently gained the ability to verify that
feature flags are exercised as expected. This is an important safety
guard which can help us to avoid releasing untested and thus potentially
buggy code.
Disallow usage of "normal" contexts which don't have this ability such
that we do not introduce their usage by accident.
Diffstat (limited to '.golangci.yml')
-rw-r--r-- | .golangci.yml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/.golangci.yml b/.golangci.yml index dce1c42d7..b1359a125 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -53,6 +53,11 @@ linters-settings: # following functions is thus disallowed. and a code smell. - ^context.WithDeadline$ - ^context.WithTimeout$ + # Tests should always use `testhelper.Context()`: this context has + # special handling for feature flags which allows us to assert that + # they're tested as expected. + - ^context.Background$ + - ^context.TODO$ stylecheck: # ST1000 checks for missing package comments. We don't use these for most # packages, so let's disable this check. |