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

Bandit shows progress indicator even when passing --quiet #636

Closed
fniessink opened this issue Aug 26, 2020 · 3 comments · Fixed by #641
Closed

Bandit shows progress indicator even when passing --quiet #636

fniessink opened this issue Aug 26, 2020 · 3 comments · Fixed by #641
Labels
bug Something isn't working
Milestone

Comments

@fniessink
Copy link
Contributor

fniessink commented Aug 26, 2020

Describe the bug
Bandit shows a progress indicator when the number of files is greater than 50, even though the --quiet flag is passed

To Reproduce
Steps to reproduce the behavior:
Run "bandit --quiet src" on a folder with more than 50 files.

Expected behavior
Bandit should not show a progress indicator when --quiet is passed

Bandit version

bandit 1.6.2
  python version = 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) [Clang 6.0 (clang-600.0.57)]

Additional context
I'd be happy to submit a PR.

@oriash93
Copy link

oriash93 commented Oct 5, 2020

I believe this is the cause of the issue:

# display progress, if number of files warrants it
if len(self.files_list) > self.progress:
sys.stderr.write("%s [" % len(self.files_list))

While passing the --quiet flag just sets the logging level to WARN:

bandit/bandit/cli/main.py

Lines 415 to 416 in c6b1302

if args.quiet:
_init_logger(log_level=logging.WARN)

@fniessink let me know if you haven't started yet, I'd like to take up on that.

@fniessink
Copy link
Contributor Author

I can prepare a PR. What's the preferred solution: using the logger to display the progress (instead of stderr) in the run_tests method?

@oriash93
Copy link

oriash93 commented Oct 5, 2020

I am not a maintainer so it's not up to me to decide. I would use the logger.

@ericwb ericwb added the bug Something isn't working label Nov 20, 2020
lukehinds pushed a commit that referenced this issue Nov 25, 2020
@ericwb ericwb added this to the Release 1.6.3 milestone Dec 6, 2020
mikespallino pushed a commit to mikespallino/bandit that referenced this issue Aug 25, 2021
mikespallino pushed a commit to mikespallino/bandit that referenced this issue Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants