Excluded paths from the .ini file ignored if -x flag is set
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 835
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 1
Description
Describe the bug
Bandit 1.7.1 no longer appends CLI-provided excluded paths to those provided in the .ini file, but rather substitutes the excluded paths list, which contradicts the doc: note that these are in addition to the excluded paths provided in the config file
Reproduction steps
- Create .ini file with a couple of excluded paths
[bandit]
exclude = src/lib
recursive = true
targets = src
- Run bandit with both ini file and
-xflags provided:bandit --ini .config -x 'test'
Expected behavior
Bandit will exclude both ini-provided and cli-provided paths
Bandit version
1.7.0 (Default)
Python version
3.9 (Default)
Additional context
I'm setting bandit version to 1.7.0 as 1.7.1 is not available in the GitHub dropdown (though it is available at PyPi at https://pypi.org/project/bandit/1.7.1/)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the shown .ini file and bandit --ini .config -x 'test'. Trace the CLI option and configuration loading paths to find where the excluded-path list is replaced, then verify that the completed change preserves both the .ini and -x paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100