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

Args parsing priority changed #566

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

ZenSecurity
Copy link

ini file goes first, if it's empty, then command-line arguments passed.

@ZenSecurity
Copy link
Author

ZenSecurity commented Jan 20, 2020

After your last MR, arguments from file are not taken (c6b1302)
My small patch fixes this.

What do you think?

Copy link
Member

@ericwb ericwb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the order of preference being changed? Command line arguments almost always have highest priority, followed by environment variable, then config.

@ZenSecurity
Copy link
Author

ZenSecurity commented Jan 20, 2020

I changed the order because currently "--ini INI_PATH" option is not working anymore with your latest change.
https://github.com/PyCQA/bandit/blob/master/bandit/cli/main.py#L225 (takes default values)
https://github.com/PyCQA/bandit/blob/master/bandit/cli/main.py#L311 (passes default values)
https://github.com/PyCQA/bandit/blob/master/bandit/cli/main.py#L82 (breaks "--ini" parameter logic here)
Do you have any suggestions?

@ericwb
Copy link
Member

ericwb commented Jan 21, 2020

I changed the order because currently "--ini INI_PATH" option is not working anymore with your latest change.
https://github.com/PyCQA/bandit/blob/master/bandit/cli/main.py#L225 (takes default values)
https://github.com/PyCQA/bandit/blob/master/bandit/cli/main.py#L311 (passes default values)
https://github.com/PyCQA/bandit/blob/master/bandit/cli/main.py#L82 (breaks "--ini" parameter logic here)
Do you have any suggestions?

Yeah, we need to fix or revert my patch if it's now breaking existing function.

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

Successfully merging this pull request may close these issues.

2 participants