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

[flake8-blind-expect] Allow raise from in BLE001 #11131

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

autinerd
Copy link
Contributor

Summary

This allows raise from in BLE001.

try:
    ...
except Exception as e:
    raise ValueError from e

Fixes #10806

Test Plan

Test case added.

@charliermarsh charliermarsh added the bug Something isn't working label Apr 24, 2024
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+10 -12 violations, +0 -0 fixes in 4 projects; 40 projects unchanged)

PlasmaPy/PlasmaPy (+5 -0 violations, +0 -0 fixes)

+ src/plasmapy/formulary/collisions/helio/collisional_analysis.py:355:29: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/dispersion/test_dispersion_functions.py:122:35: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/particles/conftest.py:19:31: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/particles/test_particle_class.py:530:31: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/particles/test_particle_class.py:912:31: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)

apache/airflow (+0 -11 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

- airflow/kubernetes/pre_7_4_0_compatibility/pod_generator.py:464:16: BLE001 Do not catch blind exception: `Exception`
- airflow/kubernetes/pre_7_4_0_compatibility/pod_generator.py:472:20: BLE001 Do not catch blind exception: `Exception`
- airflow/operators/python.py:782:20: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:104:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:126:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:143:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:160:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:179:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:192:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/cncf/kubernetes/pod_generator.py:454:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/cncf/kubernetes/pod_generator.py:462:20: BLE001 Do not catch blind exception: `Exception`

ibis-project/ibis (+3 -0 violations, +0 -0 fixes)

+ ibis/backends/__init__.py:54:35: RUF100 Unused `noqa` directive (unused: `BLE001`)
+ ibis/backends/__init__.py:62:35: RUF100 Unused `noqa` directive (unused: `BLE001`)
+ ibis/examples/__init__.py:171:29: RUF100 Unused `noqa` directive (unused: `BLE001`)

zulip/zulip (+2 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ scripts/lib/setup_venv.py:344:16: BLE001 Do not catch blind exception: `BaseException`
+ tools/lib/provision.py:385:20: BLE001 Do not catch blind exception: `BaseException`
- zproject/backends.py:1031:16: BLE001 Do not catch blind exception: `Exception`

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
BLE001 14 2 12 0 0
RUF100 8 8 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+11 -13 violations, +0 -0 fixes in 4 projects; 40 projects unchanged)

PlasmaPy/PlasmaPy (+6 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ src/plasmapy/formulary/collisions/helio/collisional_analysis.py:238:9: PLR0917 Too many positional arguments (12/5)
- src/plasmapy/formulary/collisions/helio/collisional_analysis.py:238:9: PLR0917 Too many positional arguments (12/5)
+ src/plasmapy/formulary/collisions/helio/collisional_analysis.py:355:29: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/dispersion/test_dispersion_functions.py:122:35: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/particles/conftest.py:19:31: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/particles/test_particle_class.py:530:31: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)
+ tests/particles/test_particle_class.py:912:31: RUF100 [*] Unused `noqa` directive (unused: `BLE001`)

apache/airflow (+0 -11 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

- airflow/kubernetes/pre_7_4_0_compatibility/pod_generator.py:464:16: BLE001 Do not catch blind exception: `Exception`
- airflow/kubernetes/pre_7_4_0_compatibility/pod_generator.py:472:20: BLE001 Do not catch blind exception: `Exception`
- airflow/operators/python.py:782:20: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:104:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:126:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:143:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:160:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:179:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:192:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/cncf/kubernetes/pod_generator.py:454:16: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/cncf/kubernetes/pod_generator.py:462:20: BLE001 Do not catch blind exception: `Exception`

ibis-project/ibis (+3 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ ibis/backends/__init__.py:54:35: RUF100 Unused `noqa` directive (unused: `BLE001`)
+ ibis/backends/__init__.py:62:35: RUF100 Unused `noqa` directive (unused: `BLE001`)
+ ibis/examples/__init__.py:171:29: RUF100 Unused `noqa` directive (unused: `BLE001`)

zulip/zulip (+2 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ scripts/lib/setup_venv.py:344:16: BLE001 Do not catch blind exception: `BaseException`
+ tools/lib/provision.py:385:20: BLE001 Do not catch blind exception: `BaseException`
- zproject/backends.py:1031:16: BLE001 Do not catch blind exception: `Exception`

Changes by rule (3 rules affected)

code total + violation - violation + fix - fix
BLE001 14 2 12 0 0
RUF100 8 8 0 0 0
PLR0917 2 1 1 0 0

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@charliermarsh charliermarsh changed the title [flake8-blind-expect] Allow raise from in BLE001 [flake8-blind-expect] Allow raise from in BLE001 Apr 24, 2024
@charliermarsh charliermarsh merged commit cee38f3 into astral-sh:main Apr 24, 2024
18 checks passed
@autinerd autinerd deleted the ble001-raise-from branch April 24, 2024 15:59
wilbrdt added a commit to openfun/ralph that referenced this pull request Apr 29, 2024
`flake8-blind-except` from Ruff now allows to raise from a broad exception,
making the escapes unused directives (see
astral-sh/ruff#11131).
Removing unused directives.
wilbrdt added a commit to openfun/ralph that referenced this pull request Apr 30, 2024
`flake8-blind-except` from Ruff now allows to raise from a broad exception,
making the escapes unused directives (see
astral-sh/ruff#11131).
Removing unused directives.
wilbrdt added a commit to openfun/ralph that referenced this pull request Apr 30, 2024
`flake8-blind-except` from Ruff now allows to raise from a broad exception,
making the escapes unused directives (see
astral-sh/ruff#11131).
Removing unused directives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[flake8-blind-expect] Allow raise ... from ex in except Exception as ex in BLE001
2 participants