Skip to content

Consider with blocks as single-item branches#12311

Merged
charliermarsh merged 1 commit intomainfrom
charlie/with
Jul 13, 2024
Merged

Consider with blocks as single-item branches#12311
charliermarsh merged 1 commit intomainfrom
charlie/with

Conversation

@charliermarsh
Copy link
Copy Markdown
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
@github-actions
Copy link
Copy Markdown
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
@charliermarsh charliermarsh deleted the charlie/with branch July 13, 2024 19:22
@charliermarsh
Copy link
Copy Markdown
Member Author

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

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.

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

1 participant