There doesn't seem to be an easy way to specify a broad rule, but add a few exceptions to it. Specifically, I'd like to do the following:
- Disable everything from the
os package everywhere across k6
- Add
//nolint:forbidigo in the single place where we assemble our global state from the OS
- Add exceptions for certain
os types like os.Signal, which are safe to use and are valid return types even when we'd be mocking this global state in our tests.
Since Go doesn't support negative lookaheads in regular expressions, I am not sure there is an easy way to currently do this?
One way to solve this would be to be able to add a list (or even another regex) for every rule, for defining exceptions to the rule.
Another way would be to specify that only matching a specific group in the regexp constitutes a linter error. Then we'd be able to use "The Greatest Regex Trick Ever" to define rule exceptions 😅
There doesn't seem to be an easy way to specify a broad rule, but add a few exceptions to it. Specifically, I'd like to do the following:
ospackage everywhere across k6//nolint:forbidigoin the single place where we assemble our global state from the OSostypes likeos.Signal, which are safe to use and are valid return types even when we'd be mocking this global state in our tests.Since Go doesn't support negative lookaheads in regular expressions, I am not sure there is an easy way to currently do this?
One way to solve this would be to be able to add a list (or even another regex) for every rule, for defining exceptions to the rule.
Another way would be to specify that only matching a specific group in the regexp constitutes a linter error. Then we'd be able to use "The Greatest Regex Trick Ever" to define rule exceptions 😅