Repository navigation
fix(cli): reject an open range missing its end instead of scanning zero targets - #773
Merged
Merged
Conversation
…ro targets Added error handling for missing range end in lenset parsing.
Add test for error when open range is missing end.
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.
Problem
Length-set syntax supports closed ranges like
{2-4}. Two incomplete forms are mishandled today:test[a-c]{2-}— the dash is consumed but the range has no end. The lenset silently comes out empty, so the pattern expands to zero permutations and the scan runs on no targets without any error (it just reports nothing found). The mirror form{-2}already raises a parse error, so{2-}slipping through quietly is inconsistent.{2-;3}— the malformed part is silently dropped and only{3}is scanned.Fix
In
_parse_lenset, when the-was consumed but no range end follows, raiseValueError('Missing range end after "-" in lenset')instead of continuing with an empty/partial lenset. This is the same error class as the existing{-2}rejection. All finite forms ({3},{2-4}, mixed lists) parse exactly as before.Testing
test_error_open_range_missing_end: on main the expression expands to zero permutations silently; with the fix it raises the ValueError.mcp<2, ReportLab present. An independent second environment observed 511 passed / 4 skipped → 512 passed / 4 skipped (the 4 skips are ReportLab-absenttest_pdf_generator.pyskips), the same +1 delta. No real handles were scanned and no network calls were made; the test exercises the pure pattern expander.ruff check: the repo carries pre-existing findings on main; the two changed files introduce zero new ones.