flake8-bandit: Bandit 1.7.3 addition of new positional argument ``fdata`` causes ``TypeError``
I’ve been using the flake8-bandit plugin. But recently, a new positional argument fdata was recently added to the BanditNodeVisitor function in version 1.7.3, causing a TypeError as follows
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/mnt/home/liurenmi/software/anaconda3/envs/geneplexus/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/mnt/ufs18/home-026/liurenmi/repo/GeneplexusPublic/.tox/flake8/lib/python3.8/site-packages/flake8/checker.py", line 687, in _run_checks
return checker.run_checks()
File "/mnt/ufs18/home-026/liurenmi/repo/GeneplexusPublic/.tox/flake8/lib/python3.8/site-packages/flake8/checker.py", line 597, in run_checks
self.run_ast_checks()
File "/mnt/ufs18/home-026/liurenmi/repo/GeneplexusPublic/.tox/flake8/lib/python3.8/site-packages/flake8/checker.py", line 500, in run_ast_checks
for (line_number, offset, text, _) in runner:
File "/mnt/ufs18/home-026/liurenmi/repo/GeneplexusPublic/.tox/flake8/lib/python3.8/site-packages/flake8_bandit.py", line 85, in run
for warn in self._check_source():
File "/mnt/ufs18/home-026/liurenmi/repo/GeneplexusPublic/.tox/flake8/lib/python3.8/site-packages/flake8_bandit.py", line 59, in _check_source
bnv = BanditNodeVisitor(
TypeError: __init__() missing 1 required positional argument: 'metrics'
"""
Would it be possible to make a patch for this?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 66
- Comments: 21 (2 by maintainers)
Commits related to this issue
- Temporarily disable flake8-bandit due to https://github.com/tylerwince/flake8-bandit/issues/21 — committed to krishnanlab/PyGenePlexus by RemyLau 2 years ago
- Make flake8-bandit work with latest bandit 1.7.3 version Fixes #21 flake8-bandit 1.7.3 (https://github.com/PyCQA/bandit/pull/496) introduced an `fdata` argument. — committed to nastra/flake8-bandit by nastra 2 years ago
- Make flake8-bandit work with latest bandit 1.7.3 version Fixes #21 flake8-bandit 1.7.3 (https://github.com/PyCQA/bandit/pull/496) introduced an `fdata` argument and this just passes a `None` to make... — committed to nastra/flake8-bandit by nastra 2 years ago
- Temporarily pin dependency version due to failure cf. https://github.com/tylerwince/flake8-bandit/issues/21 — committed to sosy-lab/benchexec by PhilippWendler 2 years ago
- temporarily pin bandit==1.7.2 (github.com/tylerwince/flake8-bandit/issues/21) — committed to workfloworchestrator/orchestrator-core by Mark90 2 years ago
- Update from bumpversion-0.3.7 (#114) * bumpversion to 0.3.7 * temporarily pin bandit==1.7.2 (github.com/tylerwince/flake8-bandit/issues/21) Co-authored-by: Mark90 <mark_moes@live.nl> — committed to workfloworchestrator/orchestrator-core by github-actions[bot] 2 years ago
- Make flake8-bandit work with latest bandit 1.7.3 too Fixes: #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 lates... — committed to sathieu/flake8-bandit by sathieu 2 years ago
- Refactor util (#29) * Refactor global variables * Fix fstring * Refactor _geneplexus.py * Fix typo * Refactor get_geneid_conversion * Temporarily disable flake8-bandit due to https://g... — committed to krishnanlab/PyGenePlexus by RemyLau 2 years ago
- Make flake8-bandit work with latest bandit 1.7.3 version Fixes #21 flake8-bandit 1.7.3 (https://github.com/PyCQA/bandit/pull/496) introduced an `fdata` argument and this just passes a `None` to make... — committed to nastra/flake8-bandit by nastra 2 years ago
- Temporarily pin dependency version due to failure cf. https://github.com/tylerwince/flake8-bandit/issues/21 git-svn-id: https://svn.sosy-lab.org/software/cpachecker/trunk@39610 4712c6d2-40bb-43ae-aa... — committed to sosy-lab/cpachecker by PhilippWendler 2 years ago
- Temporary fix for https://github.com/tylerwince/flake8-bandit/issues/21 — committed to smarie/python-decopatch by deleted user 2 years ago
- Pin bandit==1.7.2 Temporary measure until https://github.com/tylerwince/flake8-bandit/issues/21 is resolved — committed to NAFTeam/NAFF by silasary 2 years ago
- Make flake8-bandit work with latest bandit 1.7.3 version Fixes #21 flake8-bandit 1.7.3 (https://github.com/PyCQA/bandit/pull/496) introduced an `fdata` argument and this just passes a `None` to make... — committed to nastra/flake8-bandit by nastra 2 years ago
- Make flake8-bandit work with latest bandit 1.7.3 version Fixes #21 flake8-bandit 1.7.3 (https://github.com/PyCQA/bandit/pull/496) introduced an `fdata` argument and this just passes a `None` to make... — committed to nastra/flake8-bandit by nastra 2 years ago
- ci: Pin bandit==1.7.2 (#345) * Pin bandit==1.7.2 Temporary measure until https://github.com/tylerwince/flake8-bandit/issues/21 is resolved * [pre-commit.ci] auto fixes from pre-commit.com hook... — committed to NAFTeam/NAFF by silasary 2 years ago
- Add docstring; temporarily pin bandit==1.7.2 https://github.com/tylerwince/flake8-bandit/issues/21 — committed to krishnanlab/obnb by RemyLau 2 years ago
- Create ``GraphGymTrainer`` (#130) * Create GraphGym traininer, tested with trivial metric * Add docstring; temporarily pin bandit==1.7.2 https://github.com/tylerwince/flake8-bandit/issues/21 * ... — committed to krishnanlab/obnb by RemyLau 2 years ago
- chore: Set temporary upper bound on bandit See https://github.com/tylerwince/flake8-bandit/issues/21 — committed to mkdocstrings/autorefs by pawamoy 2 years ago
- https://github.com/tylerwince/flake8-bandit/issues/21 Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com> — committed to konstruktoid/action-pylint by konstruktoid 2 years ago
- Fix flake8-bandit errors ## Motivation / Description See https://github.com/tylerwince/flake8-bandit/issues/21 ## Changes introduced - pin bandit version — committed to RevenueCat/meta-memcache-py by bisho 2 years ago
Sorry all! Been crazy the last week at work but this should be resolved! Let me know if you see anything that isn’t working right! Cheers and thanks for being patient.
Hey all! I’m happy to update and add a dependabot and accept PRs on this.
Let me take a look at the PR that was opened this morning and I’ll try to work on it later today.
Thank you very much for fixing this! 😃
Would it be also possible do a new flake8-bandit release to pypi?
@Natureshadow I understand that you find it frustrating if a change in an open-source tool breaks your workflow. But remember that these tools are maintained by volunteers in their free time, for you and everybody else. They deserve our kindness and respect.
Here’s some great reading on the topic:
As for the name PyCQA, see https://meta.pycqa.org/introduction.html
We all make mistakes. And even when we don’t, we can’t know in advance that a specific change will break someone’s use case, or not. About naming conventions: sure, they communicate that something is public or private. But to be fair, Bandit’s README and documentation pages never speak about programmatic use, so we could guess that none of its API is public.
Disagree as well, for the reasons you mentioned:
Compatibility can be broken at any time indeed. Upper bounds do not protect your library. And they prevent downstream users to get upgrades. Without upper bounds, sure, things can break more often, but users can exclude the problematic version themselves. Then upstream can either fix the compatibility issue or exclude the version as well.
Upper bounds can still be used of course, but only if you know the excluded range broke or is going to break compatiblity.
This is not a good idea for a library. In such a case user will not be able to install another library which requires some other
banditversion, as well as just upgradebanditbecause some issue was fixed or a new feature was introduced.If
flake8-banditrequires some changes were added only tobandit==1.7.3,requirements.txtshould look likebandit>=1.7.3. This allows user to install any other new version ofbanditif this is required.There is a way to protect from issues with future bandit releases - set up upper limit for bandit version, like
bandit>=1.7.3,<2.0or evenbandit>=1.7.3,<1.8. But this requiresflake8-banditto release more often.Also there is no guarantee that
1.7.4release will not break backward compatibility. Actually, instead of1.7.3version https://github.com/PyCQA/bandit/pull/496 commit should be released as1.8.0because it caused backward compatibility break in the first place.@tylerwince thank you! I think that for this to propagate properly we need a new release on PyPI. Would appreciate it!
Maybe the “Code Quality Authority” should learn about semantic versioning and naming conventions in Python, then.
I found this while investigating why
pre-commitbroke in CI for all our repos. We don’t useflake8-banditdirectly, but it’s used by one of our hooks. For anyone using theflake8pre-commit hook who finds this and needs a workaround, my team temporarily added abandit < 1.7.3inadditional_dependenciesin pre-commit config like:to unblock our CI until there’s an update.
It would probably be good to pin the exact bandit version in the requirements of this plugin to avoid a similar situation in the future. Not sure how exactly right now but happy to provide a PR if @tylerwince agrees.
It’s not a public API: https://github.com/PyCQA/bandit/issues/837#issuecomment-1054746340
It can do more than that, but we just saw breakage in a patch release, so it would need to pin to exact versions to avoid this situation anyway. Unless you pinned it to a
<=1.7.3until it is tested on newer versions (which dependabot can still update).