Skip to content

Respect logged and re-raised expressions in nested statements#11301

Merged
charliermarsh merged 1 commit intomainfrom
charlie/ble
May 6, 2024
Merged

Respect logged and re-raised expressions in nested statements#11301
charliermarsh merged 1 commit intomainfrom
charlie/ble

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

Historically, we only ignored flake8-blind-except if you re-raised or logged the exception as a direct child statement; but it could be nested somewhere. This was just a known limitation at the time of adding the previous logic.

Closes #11289.

@charliermarsh charliermarsh added the bug Something isn't working label May 6, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 6, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -15 violations, +0 -0 fixes in 3 projects; 41 projects unchanged)

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

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

- airflow/cli/cli_parser.py:78:8: BLE001 Do not catch blind exception: `Exception`
- airflow/cli/commands/task_command.py:691:12: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/amazon/aws/log/s3_task_handler.py:193:20: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/google/cloud/hooks/datafusion.py:578:24: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/weaviate/hooks/weaviate.py:240:20: BLE001 Do not catch blind exception: `Exception`
- airflow/sensors/base.py:289:20: BLE001 Do not catch blind exception: `Exception`
- airflow/utils/log/file_task_handler.py:576:16: BLE001 Do not catch blind exception: `Exception`
- tests/cli/commands/_common_cli_classes.py:102:20: BLE001 Do not catch blind exception: `Exception`
- tests/sensors/test_external_task_sensor.py:531:16: BLE001 Do not catch blind exception: `Exception`

bokeh/bokeh (+0 -3 violations, +0 -0 fixes)

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

- src/bokeh/application/handlers/function.py:141:16: BLE001 Do not catch blind exception: `Exception`
- src/bokeh/command/bootstrap.py:110:12: BLE001 Do not catch blind exception: `Exception`
- tests/support/util/filesystem.py:67:16: BLE001 Do not catch blind exception: `Exception`

zulip/zulip (+0 -3 violations, +0 -0 fixes)

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

- corporate/lib/stripe.py:1199:16: BLE001 Do not catch blind exception: `Exception`
- zerver/actions/scheduled_messages.py:385:16: BLE001 Do not catch blind exception: `Exception`
- zerver/tornado/handlers.py:80:12: BLE001 Do not catch blind exception: `Exception`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
BLE001 15 0 15 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -15 violations, +0 -0 fixes in 3 projects; 41 projects unchanged)

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

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

- airflow/cli/cli_parser.py:78:8: BLE001 Do not catch blind exception: `Exception`
- airflow/cli/commands/task_command.py:691:12: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/amazon/aws/log/s3_task_handler.py:193:20: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/google/cloud/hooks/datafusion.py:578:24: BLE001 Do not catch blind exception: `Exception`
- airflow/providers/weaviate/hooks/weaviate.py:240:20: BLE001 Do not catch blind exception: `Exception`
- airflow/sensors/base.py:289:20: BLE001 Do not catch blind exception: `Exception`
- airflow/utils/log/file_task_handler.py:576:16: BLE001 Do not catch blind exception: `Exception`
- tests/cli/commands/_common_cli_classes.py:102:20: BLE001 Do not catch blind exception: `Exception`
- tests/sensors/test_external_task_sensor.py:531:16: BLE001 Do not catch blind exception: `Exception`

bokeh/bokeh (+0 -3 violations, +0 -0 fixes)

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

- src/bokeh/application/handlers/function.py:141:16: BLE001 Do not catch blind exception: `Exception`
- src/bokeh/command/bootstrap.py:110:12: BLE001 Do not catch blind exception: `Exception`
- tests/support/util/filesystem.py:67:16: BLE001 Do not catch blind exception: `Exception`

zulip/zulip (+0 -3 violations, +0 -0 fixes)

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

- corporate/lib/stripe.py:1199:16: BLE001 Do not catch blind exception: `Exception`
- zerver/actions/scheduled_messages.py:385:16: BLE001 Do not catch blind exception: `Exception`
- zerver/tornado/handlers.py:80:12: BLE001 Do not catch blind exception: `Exception`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
BLE001 15 0 15 0 0

@charliermarsh charliermarsh merged commit 1bb61ba into main May 6, 2024
@charliermarsh charliermarsh deleted the charlie/ble branch May 6, 2024 01:52
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.

BLE001: conditional handling of errors not detected

1 participant