-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[flake8-bandit
] Add Rule S110 (try/except/pass)
#2197
Conversation
3ea3183
to
f30b8b8
Compare
I think there's some overlap between this rule and |
SIM105 is intentionally restricted because |
@andersk's link doesn't seem to resolve so I'm not sure what SIM105 being restricted means in this context, but the point about overlapping rules is a good one - I'm not sure what the best approach would be for that. (Also - it's a small world, I remember Anders from my USAMO days!) |
(Oops, fixed the link.) |
Thank you! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://github.com/charliermarsh/ruff) | `^0.0.236` -> `^0.0.237` | [![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.237/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.237/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.237/compatibility-slim/0.0.236)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.237/confidence-slim/0.0.236)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.237`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.237) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.236...v0.0.237) #### What's Changed ##### Breaking Changes `--explain`, `--clean`, and `--generate-shell-completion` are now implemented as subcommands ([#​2190](https://github.com/charliermarsh/ruff/pull/2190)): ruff . # Still works! And will always work. ruff check . # New! Also works. ruff --explain E402 # Still works. ruff rule E402 # New! Also works. (And preferred.) ### Oops! The command has to come first. ruff --format json --explain E402 # No longer works. ruff --explain E402 --format json # Still works! ruff rule E402 --format json # Works! (And preferred.) This change is largely backwards compatible -- most users should experience no change in behavior. For exceptions, see [`BREAKING_CHANGES.md`](https://github.com/charliermarsh/ruff/blob/main/BREAKING_CHANGES.md#--explain---clean-and---generate-shell-completion-are-now-subcommands-2190). ##### Rules - feat: pylint `PLE0604` and `PLE0605` by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2241](https://github.com/charliermarsh/ruff/pull/2241) - feat: include os.getcwdb (bytes) into flake8-use-pathlib by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2276](https://github.com/charliermarsh/ruff/pull/2276) - \[`flake8-bandit`] Add Rule S110 (try/except/pass) by [@​sciyoshi](https://github.com/sciyoshi) in [https://github.com/charliermarsh/ruff/pull/2197](https://github.com/charliermarsh/ruff/pull/2197) ##### Settings - Omit typing module from flake8-type-checking by default by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2277](https://github.com/charliermarsh/ruff/pull/2277) ##### Bug Fixes - Fix SIM300 to take Python constants into account by [@​frenck](https://github.com/frenck) in [https://github.com/charliermarsh/ruff/pull/2255](https://github.com/charliermarsh/ruff/pull/2255) - Treat constant tuples as constants for yoda-conditions by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2265](https://github.com/charliermarsh/ruff/pull/2265) - Treat attribute constants as constant for yoda-conditions by [@​frenck](https://github.com/frenck) in [https://github.com/charliermarsh/ruff/pull/2266](https://github.com/charliermarsh/ruff/pull/2266) - flake8-annotations: Move has_any_typed_arg into correct nested `if` by [@​akx](https://github.com/akx) in [https://github.com/charliermarsh/ruff/pull/2269](https://github.com/charliermarsh/ruff/pull/2269) - Expand heuristic for detecting logging calls by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2279](https://github.com/charliermarsh/ruff/pull/2279) - Preserve global binding kind during reassignments by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2297](https://github.com/charliermarsh/ruff/pull/2297) - Fix typo in typing_extensions by [@​Jonxslays](https://github.com/Jonxslays) in [https://github.com/charliermarsh/ruff/pull/2298](https://github.com/charliermarsh/ruff/pull/2298) #### New Contributors - [@​frenck](https://github.com/frenck) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2255](https://github.com/charliermarsh/ruff/pull/2255) - [@​sladyn98](https://github.com/sladyn98) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2141](https://github.com/charliermarsh/ruff/pull/2141) - [@​the-matt-morris](https://github.com/the-matt-morris) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2291](https://github.com/charliermarsh/ruff/pull/2291) - [@​Jonxslays](https://github.com/Jonxslays) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2298](https://github.com/charliermarsh/ruff/pull/2298) **Full Changelog**: astral-sh/ruff@v0.0.236...v0.0.237 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTYuMSIsInVwZGF0ZWRJblZlciI6IjM0LjExNi4xIn0=--> Signed-off-by: Renovate Bot <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Check for flake8-bandit B110: blank
pass
in exception handler. Just getting my feet wet with implementing checkers in Ruff, so let me know if anything is missing. I used theadd_rule.py
script which has a slightly different convention than the other flake8-bandit checkers.ref: #1646