-c setup.cfg error [config] ERROR expected '<document start>', but found '<scalar>'
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 835
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 1
Description
Describe the bug
Bandit throws error when giving explicitly config file setup.cfg
Reproduction steps
- set setup.cfg file:
[isort]
profile = black
...
[tool.bandit]
skips = ["B101", "B601"]
or
...
[tool.bandit.assert_used]
skips = ['*_test.py', '*/test_*.py']
- run
$ bandit -c setup.cfg -r . - output:
[config] ERROR expected '<document start>', but found '<scalar>'
in "setup.cfg", line 2, column 1
[main] ERROR setup.cfg : Error parsing file.
Expected behavior
Running properly with given config file in according to https://bandit.readthedocs.io/en/latest/config.html#bandit-settings
Bandit version
1.7.5 (Default)
Python version
3.8
Additional context
No response
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
Start by reproducing the issue with setup.cfg and bandit -c setup.cfg -r ., using the shown [tool.bandit] and [tool.bandit.assert_used] examples. Trace the configuration parsing entry point and verify that a valid setup.cfg is accepted without the YAML parsing error. Done means Bandit runs with the supplied skips settings and reports findings normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100