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

Use current directory unless explicitly specified #467

Closed
bittner opened this issue Mar 21, 2019 · 2 comments
Closed

Use current directory unless explicitly specified #467

bittner opened this issue Mar 21, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@bittner
Copy link
Contributor

bittner commented Mar 21, 2019

Is your feature request related to a problem? Please describe.
A usability issue, not a technical problem. It's also about an alignment of the CLI handling with, e.g., flake8, to honor programmers' muscle memory.

Describe the solution you'd like
Bandit should assume to be meant to run against the current folder, ideally recursively. Hence, running just bandit would try to look up a configuration file (e.g. .bandit et al.) and run its checks against the current working directory in a recursive manner.

Currently, you have to run bandit -r . for the same behavior.

Describe alternatives you've considered
Running Bandit is non-destructive. It should be safe to assume sane defaults to make our lives easier. There are no real alternatives w.r.t. the CLI and the .bandit configuration file.

Just running bandit should do something meaningful (to get the job done, including saving time).

The actual alternative is having a tool that is more cumbersome to use than it could be. We don't want this, do we?

Additional context
See also: #274, #396

@ericwb
Copy link
Member

ericwb commented Mar 21, 2019

I do agree. And it shouldn't cause any backwards capability issue that I can think of. It would make the -r redundant, but that's okay.

@ericwb ericwb added the enhancement New feature or request label Mar 21, 2019
@ericwb ericwb added this to the Near Future milestone May 9, 2019
bittner added a commit to behave/behave-django that referenced this issue Jan 10, 2022
Bandit UX is seriously broken, only <1.6 works predictably.

Exclude/ignore of files is currently broken in Bandit:
- PyCQA/bandit#693
- PyCQA/bandit#490
- PyCQA/bandit#438 (comment)

Reading settings from configuration files is broken:
- PyCQA/bandit#753
- PyCQA/bandit#595

Reading from pyproject.toml not yet functional:
- Must install "toml" package and use "-c pyproject.toml".
- PyCQA/bandit#758

INI file configuration and CLI usage is unclear:
- PyCQA/bandit#603
- PyCQA/bandit#467
- PyCQA/bandit#396
bittner added a commit to behave/behave-django that referenced this issue Jan 10, 2022
Bandit UX is seriously broken, only <1.6 works predictably.

Exclude/ignore of files is currently broken in Bandit:
- PyCQA/bandit#693
- PyCQA/bandit#490
- PyCQA/bandit#438 (comment)

Reading settings from configuration files is broken:
- PyCQA/bandit#753
- PyCQA/bandit#595

Reading from pyproject.toml not yet functional:
Must install "toml" package and use "-c pyproject.toml".
- PyCQA/bandit#758

INI file configuration and CLI usage is unclear:
- PyCQA/bandit#603
- PyCQA/bandit#467
- PyCQA/bandit#396
bittner added a commit to behave/behave-django that referenced this issue Jan 10, 2022
Bandit UX is seriously broken, only <1.6 works predictably.

Exclude/ignore of files is currently broken in Bandit:
- PyCQA/bandit#693
- PyCQA/bandit#490
- PyCQA/bandit#438 (comment)

Reading settings from configuration files is broken:
- PyCQA/bandit#753
- PyCQA/bandit#595

Reading from pyproject.toml not yet functional:
Must install "toml" package and use "-c pyproject.toml".
- PyCQA/bandit#758

INI file configuration and CLI usage is unclear:
- PyCQA/bandit#603
- PyCQA/bandit#467
- PyCQA/bandit#396
@ericwb
Copy link
Member

ericwb commented Jan 12, 2024

Rethinking my opinion on this one...

I think we should try to conform to CLI standards as much as possible. After reading (https://clig.dev/#help), it states only if your program is very simple should you automatically run an action. A non-simple command should output the help, as Bandit does today. And I would argue that a Bandit run can be non-trivial and time consuming if run against many files (especially when run recursively). Therefore I feel it's better to keep the current behavior.

@ericwb ericwb closed this as completed Jan 12, 2024
@ericwb ericwb removed this from the Near Future milestone Jan 12, 2024
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

2 participants