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
Add "nosleep" linter #3958
Comments
Hi! You can use forbidigo linter for this case. linters:
# ...
enable:
# ...
- forbidigo
# ...
# ...
linters-settings:
# ...
forbidigo:
forbid:
- p: time.Sleep
msg: "Avoid time.Sleep in you code please"
#... |
Isn't this will apply both to tests and code, instead of just tests? |
You can use the issues section to configure files to include/exclude: issues:
exclude-rules:
- path-except: _test\.go
linters:
- forbidigo |
Yes, but this will exclude all rules of the linter, not just this one. |
Your feature request related to a problem? Please describe.
Using time.Sleep in tests is a mistake in most of cases.
Describe the solution you'd like.
Linter should detect time.Sleep in tests.
Describe alternatives you've considered.
TBH as golangci-link contains nearly hundred of linters it's hard to say is some of existing ones can be configured to do this.
Additional context.
https://xeiaso.net/blog/nosleep
The text was updated successfully, but these errors were encountered: