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

[pyupgrade] Show violations without auto-fix for UP031 #11229

Merged
merged 6 commits into from
Aug 14, 2024

Conversation

autinerd
Copy link
Contributor

@autinerd autinerd commented May 1, 2024

Summary

This shows violations of the UP031 rule which can't be auto-fixed, so that they can be fixed manually (similar to the pylint consider-using-f-strings rule)

Test Plan

Updated fixtures.

Copy link
Contributor

github-actions bot commented May 1, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+134 -0 violations, +0 -0 fixes in 10 projects; 44 projects unchanged)

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

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

+ examples/models/widgets.py:84:37: UP031 Use format specifiers instead of percent format
+ examples/models/widgets.py:86:37: UP031 Use format specifiers instead of percent format
+ src/bokeh/command/subcommands/file_output.py:154:17: UP031 Use format specifiers instead of percent format
+ src/bokeh/command/subcommands/serve.py:984:26: UP031 Use format specifiers instead of percent format
+ src/bokeh/models/sources.py:678:42: UP031 Use format specifiers instead of percent format
+ src/bokeh/models/sources.py:684:42: UP031 Use format specifiers instead of percent format
+ src/bokeh/models/sources.py:699:42: UP031 Use format specifiers instead of percent format
+ src/bokeh/models/sources.py:710:46: UP031 Use format specifiers instead of percent format
+ tests/support/util/selenium.py:379:49: UP031 Use format specifiers instead of percent format

freedomofpress/securedrop (+12 -0 violations, +0 -0 fixes)

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

+ securedrop/pretty_bad_protocol/_meta.py:684:23: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_meta.py:689:19: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_meta.py:92:31: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_parsers.py:1388:18: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_parsers.py:1390:22: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_parsers.py:1454:16: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_parsers.py:903:25: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_util.py:142:19: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/_util.py:95:19: UP031 Use format specifiers instead of percent format
+ securedrop/pretty_bad_protocol/gnupg.py:559:17: UP031 Use format specifiers instead of percent format
... 2 additional changes omitted for project

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

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

+ ibis/backends/impala/tests/test_exprs.py:135:29: UP031 Use format specifiers instead of percent format
+ ibis/backends/impala/tests/test_exprs.py:421:29: UP031 Use format specifiers instead of percent format
+ ibis/backends/impala/tests/test_exprs.py:477:26: UP031 Use format specifiers instead of percent format
+ ibis/backends/impala/tests/test_exprs.py:514:29: UP031 Use format specifiers instead of percent format
+ ibis/tests/expr/test_window_functions.py:41:24: UP031 Use format specifiers instead of percent format

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

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

+ mlflow/cli.py:600:17: UP031 Use format specifiers instead of percent format
+ mlflow/store/tracking/file_store.py:494:17: UP031 Use format specifiers instead of percent format
+ mlflow/utils/autologging_utils/events.py:66:17: UP031 Use format specifiers instead of percent format

python/mypy (+57 -0 violations, +0 -0 fixes)

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

+ misc/incremental_checker.py:358:15: UP031 Use format specifiers instead of percent format
+ mypy/build.py:1180:36: UP031 Use format specifiers instead of percent format
+ mypy/build.py:281:13: UP031 Use format specifiers instead of percent format
+ mypy/build.py:2979:24: UP031 Use format specifiers instead of percent format
+ mypy/build.py:3219:17: UP031 Use format specifiers instead of percent format
+ mypy/build.py:3247:25: UP031 Use format specifiers instead of percent format
+ mypy/build.py:3294:35: UP031 Use format specifiers instead of percent format
+ mypy/build.py:3347:29: UP031 Use format specifiers instead of percent format
+ mypy/dmypy/client.py:597:19: UP031 Use format specifiers instead of percent format
+ mypy/dmypy/client.py:599:15: UP031 Use format specifiers instead of percent format
+ mypy/main.py:42:13: UP031 Use format specifiers instead of percent format
+ mypy/memprofile.py:78:11: UP031 Use format specifiers instead of percent format
+ mypy/memprofile.py:85:19: UP031 Use format specifiers instead of percent format
+ mypy/messages.py:3077:16: UP031 Use format specifiers instead of percent format
+ mypy/nodes.py:2866:16: UP031 Use format specifiers instead of percent format
+ mypy/report.py:900:15: UP031 Use format specifiers instead of percent format
+ mypy/semanal.py:5711:23: UP031 Use format specifiers instead of percent format
+ mypy/server/mergecheck.py:55:19: UP031 Use format specifiers instead of percent format
+ mypy/server/mergecheck.py:56:19: UP031 Use format specifiers instead of percent format
+ mypy/server/update.py:854:32: UP031 Use format specifiers instead of percent format
+ mypy/stats.py:372:22: UP031 Use format specifiers instead of percent format
... 36 additional changes omitted for project

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

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

+ tools/profiling/sampler.py:44:22: UP031 Use format specifiers instead of percent format

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

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

+ indico/web/http_api/hooks/base.py:118:32: UP031 Use format specifiers instead of percent format

python-trio/trio (+3 -0 violations, +0 -0 fixes)

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

+ notes-to-self/how-does-windows-so-reuseaddr-work.py:52:19: UP031 Use format specifiers instead of percent format
+ notes-to-self/how-does-windows-so-reuseaddr-work.py:57:31: UP031 Use format specifiers instead of percent format
+ notes-to-self/how-does-windows-so-reuseaddr-work.py:75:27: UP031 Use format specifiers instead of percent format

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

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

+ bench/empty.py:5:10: UP031 Use format specifiers instead of percent format
+ src/_pytest/_code/code.py:224:16: UP031 Use format specifiers instead of percent format
+ src/_pytest/_code/code.py:310:16: UP031 Use format specifiers instead of percent format
+ src/_pytest/_io/pprint.py:543:26: UP031 Use format specifiers instead of percent format
+ src/_pytest/_py/error.py:72:48: UP031 Use format specifiers instead of percent format
+ src/_pytest/assertion/util.py:409:17: UP031 Use format specifiers instead of percent format
+ src/_pytest/assertion/util.py:513:13: UP031 Use format specifiers instead of percent format
+ src/_pytest/assertion/util.py:523:13: UP031 Use format specifiers instead of percent format
+ src/_pytest/cacheprovider.py:391:39: UP031 Use format specifiers instead of percent format
+ src/_pytest/compat.py:79:20: UP031 Use format specifiers instead of percent format
+ src/_pytest/compat.py:80:12: UP031 Use format specifiers instead of percent format
+ src/_pytest/doctest.py:355:21: UP031 Use format specifiers instead of percent format
+ src/_pytest/fixtures.py:878:17: UP031 Use format specifiers instead of percent format
+ src/_pytest/main.py:353:13: UP031 Use format specifiers instead of percent format
... 24 additional changes omitted for project

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

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

+ src/pdm/cli/utils.py:100:29: UP031 Use format specifiers instead of percent format
+ src/pdm/cli/utils.py:118:26: UP031 Use format specifiers instead of percent format
+ src/pdm/cli/utils.py:120:30: UP031 Use format specifiers instead of percent format
+ src/pdm/cli/utils.py:89:29: UP031 Use format specifiers instead of percent format
+ src/pdm/cli/utils.py:94:29: UP031 Use format specifiers instead of percent format

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
UP031 134 134 0 0 0

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Aug 14, 2024
@MichaReiser
Copy link
Member

MichaReiser commented Aug 14, 2024

I reverted the change to the diagnostic message because it floods the ecosystem changes, making it difficult to see the results related to unconditionally emitting the diagnostic.

@MichaReiser
Copy link
Member

The changes look reasonable to me but I would like a second opinion, especially if we should gate this behind preview first. @AlexWaygood wdyt?

@AlexWaygood
Copy link
Member

This seems reasonable to me too. For a stylistic/modernisation rule like this, it can be annoying if it has lots of complaints that can't be autofixed. However, the unfixable complaints here are relatively small in number: most complaints from this rule are still autofixed.

I'd also prefer if this was a preview-only change first, though, just to be on the safe side.

@MichaReiser MichaReiser added the preview Related to preview mode features label Aug 14, 2024
@MichaReiser MichaReiser enabled auto-merge (squash) August 14, 2024 11:20
@MichaReiser MichaReiser merged commit 3898d73 into astral-sh:main Aug 14, 2024
17 checks passed
@autinerd autinerd deleted the up031-more-violations branch August 15, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants