Add "nosleep" linter #4753
Replies: 4 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"
  #... | 
Beta Was this translation helpful? Give feedback.
-
| Isn't this will apply both to tests and code, instead of just tests? | 
Beta Was this translation helpful? Give feedback.
-
| You can use the issues section to configure files to include/exclude: issues:
  exclude-rules:
    - path-except: _test\.go
      linters:
        - forbidigo | 
Beta Was this translation helpful? Give feedback.
-
| Yes, but this will exclude all rules of the linter, not just this one. | 
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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
Beta Was this translation helpful? Give feedback.
All reactions