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

[ruff_linter] ignore function call as default value for immutable annotation (RUF009) #15845

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BKCF
Copy link

@BKCF BKCF commented Jan 31, 2025

Summary

Resolves #15772 to sync the behavior of RUF009 and B008. When defining

Test Plan

explicit test for the minimal example provided in the issue
cargo run -p ruff -- check .\crates\ruff_linter\resources\test\fixtures\ruff\RUF009*.py --preview --no-cache --select RUF009
cargo nextest run
cargo insta test

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

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

DisnakeDev/disnake (+0 -0 violations, +0 -0 fixes)


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

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

- airflow/models/dag.py:430:25: RUF009 Do not perform function call in dataclass defaults
- airflow/models/dag.py:431:24: RUF009 Do not perform function call `airflow_conf.get_mandatory_value` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/common_build_params.py:61:31: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/common_build_params.py:62:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/common_build_params.py:64:25: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/shell_params.py:151:31: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/shell_params.py:164:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/shell_params.py:166:25: RUF009 Do not perform function call `os.environ.get` in dataclass defaults

latchbio/latch (+0 -4 violations, +0 -0 fixes)

- src/latch_cli/exceptions/handler.py:23:23: RUF009 Do not perform function call `platform.version` in dataclass defaults
- src/latch_cli/exceptions/handler.py:24:26: RUF009 Do not perform function call `get_local_package_version` in dataclass defaults
- src/latch_cli/exceptions/handler.py:26:21: RUF009 Do not perform function call `platform.platform` in dataclass defaults
- src/latch_sdk_config/latch.py:86:22: RUF009 Do not perform function call `urljoin` in dataclass defaults

lnbits/lnbits (+0 -0 violations, +0 -0 fixes)


Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF009 12 0 12 0 0

Linter (preview)

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

DisnakeDev/disnake (+0 -0 violations, +0 -0 fixes)

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


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

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

- airflow/models/dag.py:430:25: RUF009 Do not perform function call in dataclass defaults
- airflow/models/dag.py:431:24: RUF009 Do not perform function call `airflow_conf.get_mandatory_value` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/common_build_params.py:61:31: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/common_build_params.py:62:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/common_build_params.py:64:25: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/shell_params.py:151:31: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/shell_params.py:164:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
- dev/breeze/src/airflow_breeze/params/shell_params.py:166:25: RUF009 Do not perform function call `os.environ.get` in dataclass defaults

latchbio/latch (+0 -4 violations, +0 -0 fixes)

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

- src/latch_cli/exceptions/handler.py:23:23: RUF009 Do not perform function call `platform.version` in dataclass defaults
- src/latch_cli/exceptions/handler.py:24:26: RUF009 Do not perform function call `get_local_package_version` in dataclass defaults
- src/latch_cli/exceptions/handler.py:26:21: RUF009 Do not perform function call `platform.platform` in dataclass defaults
- src/latch_sdk_config/latch.py:86:22: RUF009 Do not perform function call `urljoin` in dataclass defaults

lnbits/lnbits (+0 -0 violations, +0 -0 fixes)

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


Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF009 12 0 12 0 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

B008 doesn't report when the annotation refers to an immutable type, but RUF009 does
1 participant