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

Limit commutative non-augmented-assignments to primitive data types #10912

Merged
merged 1 commit into from Apr 12, 2024

Conversation

charliermarsh
Copy link
Member

Summary

I think this is the best we can do without type inference. At least it will still catch some common cases.

Closes #10911.

@charliermarsh charliermarsh added the bug Something isn't working label Apr 12, 2024
Copy link

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -109 violations, +0 -0 fixes in 8 projects; 36 projects unchanged)

aiven/aiven-client (+0 -1 violations, +0 -0 fixes)

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

- aiven/client/client.py:159:9: PLR6104 Use `+=` to perform an augmented assignment directly

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

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

- airflow/providers/apache/hive/hooks/hive.py:346:21: PLR6104 Use `+=` to perform an augmented assignment directly
- airflow/providers/apache/hive/hooks/hive.py:348:21: PLR6104 Use `+=` to perform an augmented assignment directly
- airflow/providers/elasticsearch/log/es_task_handler.py:207:13: PLR6104 Use `+=` to perform an augmented assignment directly
- airflow/providers/microsoft/azure/utils.py:184:9: PLR6104 Use `+=` to perform an augmented assignment directly
- airflow/utils/operator_helpers.py:112:17: PLR6104 Use `+=` to perform an augmented assignment directly
- dev/breeze/src/airflow_breeze/commands/release_management_commands.py:3196:5: PLR6104 Use `+=` to perform an augmented assignment directly
- dev/breeze/src/airflow_breeze/utils/kubernetes_utils.py:257:5: PLR6104 Use `+=` to perform an augmented assignment directly
- dev/breeze/src/airflow_breeze/utils/kubernetes_utils.py:419:5: PLR6104 Use `+=` to perform an augmented assignment directly
- docs/exts/redirects.py:70:13: PLR6104 Use `+=` to perform an augmented assignment directly

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

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

- src/bokeh/embed/server.py:294:9: PLR6104 Use `+=` to perform an augmented assignment directly
- src/bokeh/server/tornado.py:307:13: PLR6104 Use `+=` to perform an augmented assignment directly
- src/bokeh/server/tornado.py:422:17: PLR6104 Use `+=` to perform an augmented assignment directly

ibis-project/ibis (+0 -4 violations, +0 -0 fixes)

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

- ibis/backends/druid/__init__.py:61:9: PLR6104 Use `|=` to perform an augmented assignment directly
- ibis/backends/exasol/__init__.py:100:9: PLR6104 Use `|=` to perform an augmented assignment directly
- ibis/common/annotations.py:287:13: PLR6104 Use `+=` to perform an augmented assignment directly
- ibis/common/annotations.py:289:13: PLR6104 Use `+=` to perform an augmented assignment directly

pandas-dev/pandas (+0 -39 violations, +0 -0 fixes)

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

- pandas/_testing/contexts.py:113:5: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/compat/numpy/function.py:107:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/compat/numpy/function.py:168:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/compat/numpy/function.py:200:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/compat/numpy/function.py:229:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/core/arrays/masked.py:693:13: PLR6104 Use `|=` to perform an augmented assignment directly
- pandas/core/indexes/datetimes.py:665:13: PLR6104 Use `&=` to perform an augmented assignment directly
- pandas/core/indexes/multi.py:3590:13: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/core/window/numba_.py:152:29: PLR6104 Use `*=` to perform an augmented assignment directly
- pandas/core/window/numba_.py:327:29: PLR6104 Use `*=` to perform an augmented assignment directly
- pandas/core/window/rolling.py:827:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/core/window/rolling.py:828:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/core/window/rolling.py:829:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/io/formats/format.py:344:13: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/io/formats/printing.py:61:9: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/io/formats/xml.py:231:13: PLR6104 Use `+=` to perform an augmented assignment directly
- pandas/io/formats/xml.py:234:13: PLR6104 Use `+=` to perform an augmented assignment directly
... 22 additional changes omitted for project

rotki/rotki (+0 -28 violations, +0 -0 fixes)

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

- rotkehlchen/chain/bitcoin/bch/utils.py:132:13: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/chain/bitcoin/bch/utils.py:58:9: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/chain/ethereum/graph.py:71:9: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/chain/ethereum/modules/eth2/beacon.py:76:9: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/chain/evm/node_inquirer.py:301:13: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/db/accounting_rules.py:268:13: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/db/addressbook.py:59:9: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/db/addressbook.py:63:9: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/db/custom_assets.py:25:9: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/db/custom_assets.py:42:13: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/db/dbhandler.py:2054:13: PLR6104 Use `+=` to perform an augmented assignment directly
- rotkehlchen/db/dbhandler.py:2070:13: PLR6104 Use `+=` to perform an augmented assignment directly
... 16 additional changes omitted for project

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

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

- analytics/lib/fixtures.py:77:13: PLR6104 Use `+=` to perform an augmented assignment directly
- tools/lib/pretty_print.py:134:13: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/cache.py:185:9: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/ccache.py:43:9: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/ccache.py:45:5: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/ccache.py:70:9: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/email_mirror.py:170:9: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/generate_test_data.py:163:5: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/url_encoding.py:108:5: PLR6104 Use `+=` to perform an augmented assignment directly
- zerver/lib/webhooks/common.py:168:13: PLR6104 Use `+=` to perform an augmented assignment directly
... 1 additional changes omitted for project

indico/indico (+0 -14 violations, +0 -0 fixes)

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

- indico/core/logger.py:122:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/attachments/blueprint.py:100:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/attachments/blueprint.py:59:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/attachments/blueprint.py:61:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/attachments/blueprint.py:98:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/events/management/blueprint.py:79:9: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/events/views.py:318:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/users/ext.py:41:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/modules/users/ext.py:61:13: PLR6104 Use `+=` to perform an augmented assignment directly
- indico/web/flask/util.py:191:9: PLR6104 Use `+=` to perform an augmented assignment directly
... 4 additional changes omitted for project

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLR6104 109 0 109 0 0

@charliermarsh charliermarsh merged commit c242106 into main Apr 12, 2024
17 checks passed
@charliermarsh charliermarsh deleted the charlie/comm branch April 12, 2024 19:02
@charliermarsh
Copy link
Member Author

Ecosystem checks are good changes.

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.

PLR6104 has false positive for non-commutative additions
1 participant