Repository navigation
Conversation
rjgoyln
marked this pull request as ready for review
September 28, 2026 07:57
rjgoyln
requested review from
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
jason810496,
jscheffl and
potiuk
as code owners
September 28, 2026 07:57
Contributor
|
Thanks for the work! Look nice to me. |
fat-catTW
approved these changes
Sep 29, 2026
Contributor
Author
Thanks for the review! |
eladkal
reviewed
Oct 3, 2026
Exception constructors do not interpolate their arguments the way logger calls do, so a logging-style copy-paste leaves the placeholders in the message and the values stranded in args. Where the exception forwards only the message to super(), as google.api_core's does, the values are dropped outright and the identifier the message exists to carry never reaches the user. Nothing in ruff covers this shape, and the existing 44 occurrences make it easy for a reviewer to read as house style.
Eight of the recorded files no longer contain the pattern, the google.api_core call sites among them, so leaving their counts in place would let the same messages come back unnoticed. Twenty-eight occurrences across five distributions remain.
These raises handed their values to the exception constructor as extra
arguments, the way a logger call takes them, so the message never got
interpolated and rendered as a tuple with a literal placeholder, e.g.
('File %s not found', 'job.yaml'). With none left, the new hook can block
every occurrence rather than carry an allowlist of them.
…them No occurrences remain, so a per-file allowlist would only serve as an escape hatch, and its net-count ratchet let a new occurrence slip in whenever an old one in the same file was fixed.
rjgoyln
force-pushed
the
feat/prek-exception-format-args
branch
from
October 3, 2026 06:14
138cc70 to
5253c46
Compare
rjgoyln
requested review from
XD-DENG,
ephraimbuddy,
hussein-awala,
jedcunningham,
o-nikolas and
shahar1
as code owners
October 3, 2026 06:14
This branch has not been deployed
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.
Replaces #73076, closed under the open pull request limit.
Summary
Exception constructors do not interpolate.
raise AirflowException("TaskInstance %s is not found", ti.task_id)reads like a logger call, butstr(e)renders as('TaskInstance %s is not found', 'my_task'). Exceptions that forward only the message tosuper(), like google.api_core'sGoogleAPICallErrorfamily, drop the identifier entirely.Twenty-eight of these were on main, and they keep arriving: eight came in with the Gemini operators in January 2026. Ruff does not catch this shape — its logging rules only inspect logging calls, and
EM101's suggested fix leaves the swallowed arguments in place.Change
check-no-exception-format-args, failing on any raise whose%placeholder count matches its trailing positional arguments.The exact-count rule trades recall for precision: several call sites pass a literal message alongside unrelated positional parameters, such as
TypeError("Could not parse hits.", response), which a looser check would flag.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines