-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[pyupgrade
] Allow fixes for f-string rule regardless of line length (UP032
)
#10263
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
UP032 | 452 | 0 | 0 | 452 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -0 violations, +452 -0 fixes in 12 projects; 31 projects unchanged)
apache/airflow (+0 -0 violations, +2 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- tests/conftest.py:492:13: UP032 Use f-string instead of `format` call + tests/conftest.py:492:13: UP032 [*] Use f-string instead of `format` call
demisto/content (+0 -0 violations, +134 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- Packs/Active_Directory_Query/Integrations/Active_Directory_Query/Active_Directory_Query.py:865:17: UP032 Use f-string instead of `format` call + Packs/Active_Directory_Query/Integrations/Active_Directory_Query/Active_Directory_Query.py:865:17: UP032 [*] Use f-string instead of `format` call - Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:562:13: UP032 Use f-string instead of `format` call + Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:562:13: UP032 [*] Use f-string instead of `format` call - Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:737:22: UP032 Use f-string instead of `format` call + Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:737:22: UP032 [*] Use f-string instead of `format` call - Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:809:13: UP032 Use f-string instead of `format` call + Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:809:13: UP032 [*] Use f-string instead of `format` call - Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:887:26: UP032 Use f-string instead of `format` call + Packs/ArcSightESM/Integrations/ArcSightESMv2/ArcSightESMv2.py:887:26: UP032 [*] Use f-string instead of `format` call - Packs/AttivoBotsink/Integrations/AttivoBotsink/AttivoBotsink.py:752:25: UP032 Use f-string instead of `format` call + Packs/AttivoBotsink/Integrations/AttivoBotsink/AttivoBotsink.py:752:25: UP032 [*] Use f-string instead of `format` call - Packs/Base/Scripts/DBotPreprocessTextData/DBotPreprocessTextData.py:429:26: UP032 Use f-string instead of `format` call + Packs/Base/Scripts/DBotPreprocessTextData/DBotPreprocessTextData.py:429:26: UP032 [*] Use f-string instead of `format` call ... 120 additional changes omitted for project
docker/docker-py (+0 -0 violations, +6 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- tests/unit/api_exec_test.py:14:51: UP032 Use f-string instead of `format` call + tests/unit/api_exec_test.py:14:51: UP032 [*] Use f-string instead of `format` call - tests/unit/errors_test.py:128:15: UP032 Use f-string instead of `format` call + tests/unit/errors_test.py:128:15: UP032 [*] Use f-string instead of `format` call - tests/unit/errors_test.py:142:15: UP032 Use f-string instead of `format` call + tests/unit/errors_test.py:142:15: UP032 [*] Use f-string instead of `format` call
freedomofpress/securedrop (+0 -0 violations, +52 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- install_files/ansible-base/roles/restore/files/compare_torrc.py:56:9: UP032 Use f-string instead of `format` call + install_files/ansible-base/roles/restore/files/compare_torrc.py:56:9: UP032 [*] Use f-string instead of `format` call - molecule/testinfra/app-code/test_securedrop_rqrequeue.py:20:13: UP032 Use f-string instead of `format` call + molecule/testinfra/app-code/test_securedrop_rqrequeue.py:20:13: UP032 [*] Use f-string instead of `format` call - molecule/testinfra/app-code/test_securedrop_rqrequeue.py:24:13: UP032 Use f-string instead of `format` call + molecule/testinfra/app-code/test_securedrop_rqrequeue.py:24:13: UP032 [*] Use f-string instead of `format` call - molecule/testinfra/app-code/test_securedrop_rqworker.py:22:13: UP032 Use f-string instead of `format` call + molecule/testinfra/app-code/test_securedrop_rqworker.py:22:13: UP032 [*] Use f-string instead of `format` call - molecule/testinfra/app-code/test_securedrop_shredder_configuration.py:19:13: UP032 Use f-string instead of `format` call + molecule/testinfra/app-code/test_securedrop_shredder_configuration.py:19:13: UP032 [*] Use f-string instead of `format` call ... 42 additional changes omitted for project
ibis-project/ibis (+0 -0 violations, +14 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- ibis/backends/bigquery/udf/core.py:390:16: UP032 Use f-string instead of `format` call + ibis/backends/bigquery/udf/core.py:390:16: UP032 [*] Use f-string instead of `format` call - ibis/backends/bigquery/udf/core.py:440:16: UP032 Use f-string instead of `format` call + ibis/backends/bigquery/udf/core.py:440:16: UP032 [*] Use f-string instead of `format` call - ibis/backends/dask/__init__.py:83:17: UP032 Use f-string instead of `format` call + ibis/backends/dask/__init__.py:83:17: UP032 [*] Use f-string instead of `format` call - ibis/backends/impala/ddl.py:470:16: UP032 Use f-string instead of `format` call + ibis/backends/impala/ddl.py:470:16: UP032 [*] Use f-string instead of `format` call - ibis/backends/pandas/__init__.py:320:17: UP032 Use f-string instead of `format` call + ibis/backends/pandas/__init__.py:320:17: UP032 [*] Use f-string instead of `format` call ... 4 additional changes omitted for project
milvus-io/pymilvus (+0 -0 violations, +6 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- examples/example_bulkinsert_json.py:256:11: UP032 Use f-string instead of `format` call + examples/example_bulkinsert_json.py:256:11: UP032 [*] Use f-string instead of `format` call - examples/example_bulkinsert_numpy.py:258:11: UP032 Use f-string instead of `format` call + examples/example_bulkinsert_numpy.py:258:11: UP032 [*] Use f-string instead of `format` call - pymilvus/bulk_writer/buffer.py:112:21: UP032 Use f-string instead of `format` call + pymilvus/bulk_writer/buffer.py:112:21: UP032 [*] Use f-string instead of `format` call
mlflow/mlflow (+0 -0 violations, +74 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- examples/multistep_workflow/main.py:43:17: UP032 Use f-string instead of `format` call + examples/multistep_workflow/main.py:43:17: UP032 [*] Use f-string instead of `format` call - examples/pytorch/mnist_tensorboard_artifact.py:153:17: UP032 Use f-string instead of `format` call + examples/pytorch/mnist_tensorboard_artifact.py:153:17: UP032 [*] Use f-string instead of `format` call - examples/pytorch/mnist_tensorboard_artifact.py:184:9: UP032 Use f-string instead of `format` call + examples/pytorch/mnist_tensorboard_artifact.py:184:9: UP032 [*] Use f-string instead of `format` call - examples/pytorch/torchscript/MNIST/mnist_torchscript.py:50:17: UP032 Use f-string instead of `format` call + examples/pytorch/torchscript/MNIST/mnist_torchscript.py:50:17: UP032 [*] Use f-string instead of `format` call - examples/pytorch/torchscript/MNIST/mnist_torchscript.py:77:9: UP032 Use f-string instead of `format` call + examples/pytorch/torchscript/MNIST/mnist_torchscript.py:77:9: UP032 [*] Use f-string instead of `format` call ... 64 additional changes omitted for project
pypa/pip (+0 -0 violations, +34 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- src/pip/__pip-runner__.py:21:9: UP032 Use f-string instead of `format` call + src/pip/__pip-runner__.py:21:9: UP032 [*] Use f-string instead of `format` call - src/pip/_internal/commands/search.py:78:23: UP032 Use f-string instead of `format` call + src/pip/_internal/commands/search.py:78:23: UP032 [*] Use f-string instead of `format` call - src/pip/_internal/models/candidate.py:23:16: UP032 Use f-string instead of `format` call + src/pip/_internal/models/candidate.py:23:16: UP032 [*] Use f-string instead of `format` call - src/pip/_internal/operations/install/wheel.py:507:27: UP032 Use f-string instead of `format` call + src/pip/_internal/operations/install/wheel.py:507:27: UP032 [*] Use f-string instead of `format` call - src/pip/_internal/operations/install/wheel.py:517:27: UP032 Use f-string instead of `format` call + src/pip/_internal/operations/install/wheel.py:517:27: UP032 [*] Use f-string instead of `format` call ... 24 additional changes omitted for project
rotki/rotki (+0 -0 violations, +12 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- rotkehlchen/chain/ethereum/abi.py:77:36: UP032 Use f-string instead of `format` call + rotkehlchen/chain/ethereum/abi.py:77:36: UP032 [*] Use f-string instead of `format` call - rotkehlchen/exchanges/binance.py:398:25: UP032 Use f-string instead of `format` call + rotkehlchen/exchanges/binance.py:398:25: UP032 [*] Use f-string instead of `format` call - rotkehlchen/exchanges/bitcoinde.py:236:17: UP032 Use f-string instead of `format` call + rotkehlchen/exchanges/bitcoinde.py:236:17: UP032 [*] Use f-string instead of `format` call - rotkehlchen/exchanges/bitmex.py:207:17: UP032 Use f-string instead of `format` call + rotkehlchen/exchanges/bitmex.py:207:17: UP032 [*] Use f-string instead of `format` call - rotkehlchen/exchanges/iconomi.py:187:17: UP032 Use f-string instead of `format` call + rotkehlchen/exchanges/iconomi.py:187:17: UP032 [*] Use f-string instead of `format` call ... 2 additional changes omitted for project
... Truncated remaining completed project reports due to GitHub comment length restrictions
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
UP032 | 452 | 0 | 0 | 452 | 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the motivation for changing this and am sorry for the frustration that it has caused.
What I worry is that this now is a selective view. People agreeing with fixing code that increases the line length aren't represented. For example, this comment which seems a fair concern.
To me, it seems that we should decide and change this holistically rather than on a rule-by-rule basis, especially because we should avoid switching between the two paradigms.
I'm okay moving forward with this because I share the sentiment that we shouldn't gate our fixes based on line-length. But I worry that we leave a group of people underrepresented.
That's a fair position! But from that perspective, we likely shouldn't have changed this rule in the first place, right? Since we didn't establish a clear policy or poll users on both ends of the spectrum? In my view, adding the diagnostic but not the fix just creates more work for users. It's more work to address the violation themselves than to fix-up the fix. |
Thank you! |
… (`UP032`) (astral-sh#10263) ## Summary This is a follow-up to astral-sh#10238 to offer fixes for the f-string rule regardless of the line length of the resulting fix. To quote Alex in the linked PR: > Yes, from the user's perspective I'd rather have a fix that may lead to line length issues than have to fix them myself :-) Cleaning up line lengths is easier than changing from `"".format()` to `f""` I agree with this position, which is that if we're going to offer a diagnostic, we should really be offering the user the ability to fix it -- otherwise, we're just inconveniencing them.
Summary
This is a follow-up to #10238 to offer fixes for the f-string rule regardless of the line length of the resulting fix. To quote Alex in the linked PR:
I agree with this position, which is that if we're going to offer a diagnostic, we should really be offering the user the ability to fix it -- otherwise, we're just inconveniencing them.