Skip to content

Comments

[ruff-0.8] [ruff] Stabilise parenthesize-chained-operators (RUF021)#14450

Merged
AlexWaygood merged 1 commit intoruff-0.8from
alex/stabilise-ruf021
Nov 19, 2024
Merged

[ruff-0.8] [ruff] Stabilise parenthesize-chained-operators (RUF021)#14450
AlexWaygood merged 1 commit intoruff-0.8from
alex/stabilise-ruf021

Conversation

@AlexWaygood
Copy link
Member

Summary

This rule has been in preview for a long time and its implementation has been stable for a long time. There are no open issues about the rule and no known issues in the implementation. The documentation seems clear.

It's an opinionated stylistic rule, but also probably a change that most people would agree with (in our subjective opinion).

Test Plan

We'll wait to see what the ecosystem check says!

@AlexWaygood AlexWaygood added the rule Implementing or modifying a lint rule label Nov 19, 2024
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+63 -0 violations, +0 -0 fixes in 9 projects; 45 projects unchanged)

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

+ disnake/ext/commands/converter.py:1190:12: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ disnake/ext/tasks/__init__.py:278:14: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ disnake/interactions/base.py:1919:21: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ disnake/interactions/base.py:224:17: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ disnake/state.py:2104:13: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear

RasaHQ/rasa (+6 -0 violations, +0 -0 fixes)

+ rasa/cli/utils.py:74:27: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ rasa/core/processor.py:587:17: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ rasa/shared/core/training_data/structures.py:619:17: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ rasa/shared/core/training_data/structures.py:621:20: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ rasa/utils/train_utils.py:534:9: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ rasa/utils/train_utils.py:536:12: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear

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

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

+ airflow/api_internal/internal_api_call.py:129:13: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ airflow/metrics/validators.py:241:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ airflow/models/dagrun.py:1327:20: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ airflow/serialization/serde.py:230:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ airflow/www/utils.py:818:20: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ airflow/www/utils.py:831:20: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ airflow/www/validators.py:52:32: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ dev/breeze/src/airflow_breeze/commands/developer_commands.py:372:25: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ dev/breeze/src/airflow_breeze/utils/kubernetes_utils.py:272:25: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ providers/src/airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py:359:17: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ providers/src/airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py:361:20: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ providers/src/airflow/providers/cncf/kubernetes/operators/job.py:127:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ providers/src/airflow/providers/cncf/kubernetes/operators/pod.py:414:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ providers/src/airflow/providers/cncf/kubernetes/triggers/pod.py:192:19: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ providers/src/airflow/providers/google/common/hooks/base_google.py:411:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
... 5 additional changes omitted for project

apache/superset (+3 -0 violations, +0 -0 fixes)

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

+ superset/migrations/shared/utils.py:167:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ superset/security/manager.py:2195:12: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ superset/sql_parse.py:835:21: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear

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

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

+ src/bokeh/core/property/dataspec.py:334:35: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/bokeh/plotting/_graph.py:74:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear

milvus-io/pymilvus (+1 -0 violations, +0 -0 fixes)

+ pymilvus/client/check.py:226:26: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear

scikit-build/scikit-build-core (+1 -0 violations, +0 -0 fixes)

+ src/scikit_build_core/builder/get_requires.py:108:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear

pytest-dev/pytest (+13 -0 violations, +0 -0 fixes)

+ src/_pytest/_code/code.py:1174:24: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/_code/code.py:1353:18: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/_code/code.py:943:27: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/assertion/rewrite.py:484:26: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/assertion/rewrite.py:56:20: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/capture.py:363:13: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/capture.py:372:13: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/mark/expression.py:243:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/mark/structures.py:589:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/_pytest/python.py:435:15: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
... 3 additional changes omitted for project

pdm-project/pdm (+12 -0 violations, +0 -0 fixes)

+ src/pdm/cli/commands/add.py:125:34: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/cli/commands/list.py:341:24: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/cli/commands/venv/backends.py:44:20: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/environments/local.py:21:23: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/installers/base.py:184:36: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/installers/synchronizers.py:211:24: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/models/candidates.py:430:33: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/models/repositories/base.py:290:37: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/models/repositories/base.py:313:43: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
+ src/pdm/models/requirements.py:105:40: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
... 2 additional changes omitted for project

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF021 63 63 0 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood
Copy link
Member Author

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+63 -0 violations, +0 -0 fixes in 9 projects; 45 projects unchanged)

As expected, this impacts quite a few projects. But from a quick skim, these all look like "true positives", and I think changing the code to conform to the rule would result in more readable code in all places.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

I'm not concerned that it impacts many projects, considering that there are only very few violations for each project

@AlexWaygood AlexWaygood merged commit 5879b37 into ruff-0.8 Nov 19, 2024
@AlexWaygood AlexWaygood deleted the alex/stabilise-ruf021 branch November 19, 2024 14:43
@AlexWaygood AlexWaygood mentioned this pull request Nov 19, 2024
@AlexWaygood AlexWaygood added this to the v0.8 milestone Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants