Skip to content

Commit

Permalink
Make flake8-bandit work with latest bandit 1.7.3 too
Browse files Browse the repository at this point in the history
Fixes: tylerwince#21

flake8-bandit 1.7.3 (PyCQA/bandit#496)
introduced an `fdata` argument and this just passes a `None` to make
things work with the latest version of bandit.
  • Loading branch information
sathieu committed Feb 28, 2022
1 parent 00ba2e4 commit 30a7152
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions flake8_bandit.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,26 @@ def _check_source(self):
):
return []

bnv = BanditNodeVisitor(
self.filename,
BanditMetaAst(),
BanditTestSet(BanditConfig(), profile=config.profile),
False,
[],
Metrics(),
)
try:
bnv = BanditNodeVisitor(
fname=self.filename,
fdata=None,
metaast=BanditMetaAst(),
testset=BanditTestSet(BanditConfig(), profile=config.profile),
debug=False,
nosec_lines=[],
metrics=Metrics(),
)
except TypeError:
# bandit < 1.7.3 (https://github.com/tylerwince/flake8-bandit/issues/21)
bnv = BanditNodeVisitor(
fname=self.filename,
metaast=BanditMetaAst(),
testset=BanditTestSet(BanditConfig(), profile=config.profile),
debug=False,
nosec_lines=[],
metrics=Metrics(),
)
bnv.generic_visit(self.tree)
return [
{
Expand Down

0 comments on commit 30a7152

Please sign in to comment.