chore: ruff auto-fix F541 — f-string-missing-placeholders - #42034
Closed
wesleysimplicio wants to merge 1 commit into
Closed
wesleysimplicio wants to merge 1 commit into
wesleysimplicio wants to merge 1 commit into
Conversation
Contributor
|
Clean auto-fix pass. The |
Collaborator
|
See consolidation note on #42036 — these four ruff PRs overlap and should be combined into one before merging. |
Contributor
Author
|
Closing in favor of consolidated PR (per austinpickett's request on #42036 — combining all four ruff PRs into one.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds the
F541rule to pyproject.toml and applies auto-fix across 63 files.Converts f-strings with no placeholder expressions —
f"hello"→"hello"— since they execute the placeholder-expansion machinery for nothing.Root cause
F-strings without
{...}placeholders are syntactically valid but waste a format-call and are invisible bugs waiting to happen: a future editor adding{var}where thefprefix is missing gets a plain string instead of the expected interpolation. Making them an error keeps the codebase consistent.Fix
F541to[tool.ruff.lint] selectinpyproject.toml.ruff check --select F541 --preview --fix .— 198 errors fixed across 63 files.Why this shape
This is the same per-rule pattern used in the existing ruff PRs (#31825–#32027): enable one rule, auto-fix, commit. Separating rules keeps the diff focused and the blame history clean.
Tests
ruff checkpasses with zero errors after the fix (rule is active in config).Related PRs / issues