-
Notifications
You must be signed in to change notification settings - Fork 23
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
Make flake8-bandit work with latest bandit 1.7.3 version #22
Make flake8-bandit work with latest bandit 1.7.3 version #22
Conversation
3aaa001
to
c991d91
Compare
I created #23 keeping compatibility with bandit <= 1.7.2. |
Maybe update the requirements on this PR to "bandit>=1.7.3" in setup.py? Then the maintainer can choose which PR to use, depending on whether they want to maintain backwards compatibility or not. |
c991d91
to
7583561
Compare
flake8_bandit.py
Outdated
@@ -108,6 +108,7 @@ def _check_source(self): | |||
|
|||
bnv = BanditNodeVisitor( | |||
self.filename, | |||
None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest naming the arguments explicitly, as is being done in #23 :
bnv = BanditNodeVisitor(
fname=self.filename,
fdata=None,
metaast=BanditMetaAst(),
testset=BanditTestSet(BanditConfig(), profile=config.profile),
debug=False,
nosec_lines=[],
metrics=Metrics(),
)
It costs nothing, makes the call easier to read, and highlights the real root cause of issues in future when/if Bandit changes something again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, updated the code
I'll copy here as well, I think there needs to be two releases pushed:
|
7583561
to
0153473
Compare
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.
0153473
to
dfba032
Compare
Another possibility would be to detect whether or not Something along the lines of: kwargs = {}
if "fdata" in inspect.signature(BanditNodeVisitor).parameters:
kwargs["fdata"] = None
bnv = BanditNodeVisitor(
....,
**kwargs
) Yet another solution would be to get bandit to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Fixes #21
flake8-bandit 1.7.3 (PyCQA/bandit#496)
introduced an
fdata
argument.