Skip to content
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

Skip configuration for certain paths only #457

Open
andreas-h opened this issue Feb 28, 2019 · 5 comments
Open

Skip configuration for certain paths only #457

andreas-h opened this issue Feb 28, 2019 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@andreas-h
Copy link

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.

@lukehinds lukehinds added the enhancement New feature or request label Feb 28, 2019
@lukehinds
Copy link
Member

sounds rationale to me @andreas-h , is this a patch you would like to work on?

@bittner
Copy link
Contributor

bittner commented Mar 14, 2019

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?

@ericwb ericwb added this to the Near Future milestone May 9, 2019
@cc-stjm
Copy link

cc-stjm commented Apr 30, 2020

See also #346 - B101 in tests is a big pain.

@diegovalenzuelaiturra
Copy link

Hi, the following may be helpful to configure bandit to avoid raising B101 assert_used warnings on python tests.

@mpas
Copy link

mpas commented Nov 3, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants