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

PEP-518 support: configure bandit via pyproject.toml #401

Merged
merged 27 commits into from Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4a40e04
parse config from toml
orsinium Oct 8, 2018
98ff64b
test toml config parsing
orsinium Oct 8, 2018
d49c487
update docs
orsinium Oct 8, 2018
6154e9e
FIX pep8 "line too long" in tests
orsinium Oct 8, 2018
bfb4cba
review
orsinium Oct 9, 2018
6578950
Merge remote-tracking branch 'PyCQA/master' into toml
orsinium Mar 4, 2019
bdf6c18
+extras
orsinium Mar 4, 2019
fac79ba
use setup.cfg for extras
orsinium Mar 5, 2019
7bcce45
Merge branch 'master' into toml
orsinium Oct 16, 2019
15f31e2
Merge branch 'master' into toml
orsinium Nov 4, 2019
be67498
Merge branch 'master' into toml
ericwb Jan 12, 2020
9f982b1
Merge branch 'master' into toml
ericwb Jan 21, 2020
bd4b927
Merge branch 'master' into toml
lukehinds Mar 7, 2020
c6d7e38
fix setup.cfg
orsinium Mar 9, 2020
0b6e636
fix
orsinium Mar 9, 2020
67d00c9
Merge branch 'master' into toml
orsinium Mar 30, 2020
e128337
Merge branch 'master' into toml
orsinium May 8, 2020
ddb063e
Merge branch 'master' into toml
orsinium Jun 15, 2020
e966372
Merge branch 'master' into toml
orsinium Jan 5, 2021
027a8cb
Merge branch 'master' into toml
lukehinds Feb 12, 2021
41c8ba6
Apply suggestions from code review
orsinium Feb 16, 2021
edef1b0
Update doc/source/config.rst
orsinium Feb 16, 2021
f09f47b
Merge branch 'master' into toml
ericwb May 13, 2021
48b713c
Merge branch 'master' into toml
ericwb Aug 13, 2021
3e04a66
Update doc/source/config.rst
orsinium Aug 14, 2021
6600e52
actualize TOML config example in docs
orsinium Aug 18, 2021
d8fce0d
Merge branch 'master' into toml
ericwb Aug 24, 2021
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
6 changes: 4 additions & 2 deletions bandit/core/config.py
Expand Up @@ -49,13 +49,15 @@ def __init__(self, config_file=None):
if config_file.endswith('.toml'):
import toml
try:
self._config = toml.load(f)['tool']['bandit']
with f:
self._config = toml.load(f)['tool']['bandit']
except toml.TomlDecodeError as err:
LOG.error(err)
raise utils.ConfigError("Error parsing file.", config_file)
else:
try:
self._config = yaml.safe_load(f)
with f:
self._config = yaml.safe_load(f)
except yaml.YAMLError as err:
LOG.error(err)
raise utils.ConfigError("Error parsing file.", config_file)
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Expand Up @@ -26,4 +26,8 @@

setuptools.setup(
setup_requires=['pbr>=2.0.0'],
extras_require={
orsinium marked this conversation as resolved.
Show resolved Hide resolved
'yaml': ['PyYAML'],
'toml': ['toml'],
},
pbr=True)