fix(validator): tokenize gh-list-no-limit's flag check instead of substring match - #1147
Open
AmirF194 wants to merge 1 commit into
Open
fix(validator): tokenize gh-list-no-limit's flag check instead of substring match#1147AmirF194 wants to merge 1 commit into
AmirF194 wants to merge 1 commit into
Conversation
…string match validate_gh_list_limit tested for the literal substring "--limit" anywhere on the logical line, so a trailing shell comment or a quoted argument that merely mentions "--limit" silently defeated the check even when the command had no such flag. Tokenize with shlex.split(comments=True) and match an actual --limit / --limit=N token instead. Fixes apache#1146 Generated-by: Claude Code (Sonnet 5)
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.
Summary
validate_gh_list_limitdecides whether agh issue list/gh pr listcall is missing--limitby testing whether the literal substring--limitoccurs anywhere on thelogical line, so a trailing shell comment or a quoted argument that merely mentions
--limitsilently suppresses the warning even when the command has no such flag.shlex.split(..., comments=True)and checking for anactual
--limit(or--limit=N) token instead of a bare substring match.Type of change
tools/*/withpyproject.toml)Test plan
prek run --all-filespassesuv run pytest/ruff check/mypypassesTestGhListLimit: a trailing comment containing--limit, a quotedargument containing
--limit, and the--limit=100equals-form (control, must staysilent). The first two fail on
mainand pass on this branch, verified both ways onPython 3.12. Full
tests/test_validator.py(466 cases) still passes.--limitspellingghitself accepts, only--limit Nand--limit=N.RFC-AI-0004 compliance
Linked issues
Self-discovered while reading the validator surface; no existing issue.
Notes for reviewers (optional)
_GH_LIST_REmatching and the fenced-block boundary are unchanged. The only touchedfunction is
validate_gh_list_limit, single call site.