You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This, as you can see, skips over all tests, and is essentially intended to lint only the non-test areas of the codebase, which is does perfectly fine.
However, I want to have a set of linters for tests as well. Below are two approaches I've considered.
A separate golangci.test.yml file dedicated to tests.
Using the issues: section within the same golangci.yml (as below).
...
tests: trueskip-dirs:
- vendor
...
linters: # (A)
...
issues:
exclude-rules:
- path: _test\.golinters: (B)
- ... # NOTE: This is an inverted list of (A) and a subset of it. An empty list here means enabling all linters in (A) for tests. Similarly, a list same as (A) here implies not enabling any linter for tests.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello. 👋🏼
I have a
golangci.yml
file that includes the following content (trimmed for the sake of brevity).This, as you can see, skips over all tests, and is essentially intended to lint only the non-test areas of the codebase, which is does perfectly fine.
However, I want to have a set of linters for tests as well. Below are two approaches I've considered.
golangci.test.yml
file dedicated to tests.issues:
section within the samegolangci.yml
(as below).What is the best practice for this use-case?
Beta Was this translation helpful? Give feedback.
All reactions