Skip to content

Commit f90e078

Browse files
authored
Add golangci exclude hint (#18)
1 parent 2f5a1fd commit f90e078

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,33 @@ The default values are used internally, but might to be adjusted for your specif
1515
## Installation
1616

1717
Funlen is included in [golangci-lint](https://github.com/golangci/golangci-lint/). Install it and enable funlen.
18+
19+
# Exclude for tests
20+
21+
golangci-lint offers a way to exclude linters in certain cases. More info can be found here: https://golangci-lint.run/usage/configuration/#issues-configuration.
22+
23+
## Disable funlen for \_test.go files
24+
25+
You can utilize the issues configuration in `.golangci.yml` to exclude the funlen linter for all test files:
26+
27+
```yaml
28+
issues:
29+
exclude-rules:
30+
# disable funlen for all _test.go files
31+
- path: _test.go
32+
linters:
33+
- funlen
34+
```
35+
36+
## Disable funlen only for Test funcs
37+
38+
If you want to keep funlen enabled for example in helper functions in test files but disable it specifically for Test funcs, you can use the following configuration:
39+
40+
```yaml
41+
issues:
42+
exclude-rules:
43+
# disable funlen for test funcs
44+
- source: "^func Test"
45+
linters:
46+
- funlen
47+
```

0 commit comments

Comments
 (0)