Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines keeplist parsing so !rename is recognized as a directive only when it appears as a standalone token (followed by whitespace or end-of-line), preventing literal filenames like !rename_backup.dll from being misinterpreted as rename directives.
Changes:
- Update
parseKeeplistto detect!renamedirectives with a token-boundary regex (/^!rename(\s|$)/). - Add tests ensuring
!rename-prefixed literals are treated as keep rules and that malformed true!renamedirectives still raise the existing parse error.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| logic.ts | Tightens !rename directive detection to require a token boundary, preventing false-positive directive parsing. |
| logic_test.ts | Adds regression tests covering !rename-prefixed literals and directive parsing error behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Motivation
!rename(e.g.!rename_backup.dll) from being misinterpreted as rename directives by making directive detection token-aware.Description
parseKeeplistinlogic.tsto detect rename directives only when the line matches the token boundary!renameusing/^!rename(\s|$)/, preserving existing parse/validation behavior for true!renamedirectives.logic_test.tsto verify that a literal like!rename_backup.dllis treated as a keep rule and that malformed true!renamedirectives (missing->) still trigger the existing parse error.Testing
deno fmt logic.ts logic_test.tswhich passed formatting checks.deno task testbut it failed in this environment due to inability to fetch the JSR metadata for@std/assert(external network manifest retrieval error), so test suite could not be completed here.Codex Task