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

Show usage with no arguments #814

Merged
merged 1 commit into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion bandit/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,9 @@ def main():
)

if not args.targets:
LOG.error("No targets found in CLI or ini files, exiting.")
parser.print_usage()
sys.exit(2)

# if the log format string was set in the options, reinitialize
if b_conf.get_option("log_format"):
log_format = b_conf.get_option("log_format")
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_no_arguments(self):
]
)
self.assertEqual(2, retcode)
self.assertIn("No targets found in CLI or ini files", output)
self.assertIn("usage: bandit [-h]", output)

def test_piped_input(self):
with open("examples/imports.py") as infile:
Expand Down