bandit
bandit copied to clipboard
Skip configuration for certain paths only
Is your feature request related to a problem? Please describe. I'm a bit annoyed by the B101 assert_used warnings in my testing code, as pytest recommends (and I follow) using assert statements. It's confusing that bandit complains about them. On the other hand, I want to be warned about using assert in my non-test code.
Describe the solution you'd like
I'd like to be able to ignore pattern B101 for the /tests
folder only.
sounds rationale to me @andreas-h , is this a patch you would like to work on?
Alternatively, can we make Bandit a bit smarter in a way that it recognizes when assert
is used in a test module, and not warn about it?
See also #346 - B101 in tests is a big pain.
Hi, the following may be helpful to configure bandit
to avoid raising B101 assert_used
warnings on python tests.
- https://github.com/PyCQA/bandit/issues/603#issuecomment-971057519
I am facing the same issue, is there a way to exclude B101 in the /tests folder? I tried to use the assert_used
but this does not seem to work.