fix(core): strip surrounding quotes from package-script file tokens#852
Open
BartWaardenburg wants to merge 1 commit into
Open
fix(core): strip surrounding quotes from package-script file tokens#852BartWaardenburg wants to merge 1 commit into
BartWaardenburg wants to merge 1 commit into
Conversation
c42afbd to
889c7ae
Compare
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
Adds a
strip_surrounding_quoteshelper tocrates/core/src/scripts/mod.rsand applies it via.map(strip_surrounding_quotes)when collecting tokens inparse_command_segment. A quoted glob like'src/**/*.test.ts'now has its surrounding single quotes stripped beforelooks_like_file_pathis called, so the token is recognised as a file-path argument and stored without quotes. An internal single quote (e.g.can't) is left unchanged. Three regression tests cover: quoted glob, unquoted glob (unchanged behaviour), and a direct unit test of the strip helper.Review
Verdict: FIX
strip_surrounding_quotesis declaredpub(crate) fninside the privatepub(crate) mod scriptsmodule (crates/core/src/scripts/mod.rs:300). The clippy nursery lintredundant_pub_cratefires, and under the project's-D warningsgate this is a hard compile error. The fix is one character: changepub(crate) fn strip_surrounding_quotestofn strip_surrounding_quotes. The helper has no cross-module caller; the childtestsmodule reaches it viasuper::, which works with private visibility.'foo bar.ts'splits into'fooandbar.ts', neither gets stripped). This is not introduced or worsened by this fix; acceptable to leave for the scoped Quoted globs innode --testscripts are not registered as entry points (surrounding quotes not stripped) #841 case.What remains before merge
pub(crate)visibility qualifier fromstrip_surrounding_quotes(change to barefn) to fix the clippy gate.Closes #841