Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider with blocks as single-item branches #12311

Merged
merged 1 commit into from
Jul 13, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

Ensures that, e.g., the following is not considered a redefinition-without-use:

import contextlib

foo = None
with contextlib.suppress(ImportError):
    from some_module import foo

Closes #12309.

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

ruff-ecosystem results

Linter (stable)

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

fronzbot/blinkpy (+0 -2 violations, +0 -0 fixes)

- blinksync/blinksync.py:58:53: F811 Redefinition of unused `working` from line 55
- blinksync/blinksync.py:81:53: F811 Redefinition of unused `working` from line 78

prefecthq/prefect (+0 -1 violations, +0 -0 fixes)

- src/prefect/cli/cloud/__init__.py:266:42: F811 Redefinition of unused `timeout_scope` from line 241

encode/httpx (+0 -1 violations, +0 -0 fixes)

- tests/client/test_auth.py:371:73: F811 Redefinition of unused `client` from line 366

mesonbuild/meson-python (+1 -0 violations, +0 -0 fixes)

+ tests/test_editable.py:287:30: RUF100 [*] Unused `noqa` directive (unused: `F811`)

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
F811 4 0 4 0 0
RUF100 1 1 0 0 0

Linter (preview)

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

fronzbot/blinkpy (+0 -2 violations, +0 -0 fixes)

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

- blinksync/blinksync.py:58:53: F811 Redefinition of unused `working` from line 55
- blinksync/blinksync.py:81:53: F811 Redefinition of unused `working` from line 78

prefecthq/prefect (+0 -1 violations, +0 -0 fixes)

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

- src/prefect/cli/cloud/__init__.py:266:42: F811 Redefinition of unused `timeout_scope` from line 241

encode/httpx (+0 -1 violations, +0 -0 fixes)

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

- tests/client/test_auth.py:371:73: F811 Redefinition of unused `client` from line 366

mesonbuild/meson-python (+1 -0 violations, +0 -0 fixes)

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

+ tests/test_editable.py:287:30: RUF100 [*] Unused `noqa` directive (unused: `F811`)

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
F811 4 0 4 0 0
RUF100 1 1 0 0 0

@charliermarsh charliermarsh merged commit 456d6a2 into main Jul 13, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/with branch July 13, 2024 19:22
@charliermarsh
Copy link
Member Author

Ecosystem checks are generally improvements. This one is debatable though.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive on F811 "Redefinition of unused" when using contextlib.suppress
1 participant