-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Use PathBuf for paths in flag parsing and whitelists #3955
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch seems reasonable except for the glob part where I comment below...
What is the goal of this patch? does this fix something?
@bartlomieju PTAL
check: bool, | ||
) -> Result<(), ErrBox> { | ||
// TODO: improve glob to look for tsx?/jsx? files only | ||
let glob_paths = maybe_files.unwrap_or_else(|| vec!["**/*".to_string()]); | ||
let glob_paths = maybe_files.unwrap_or_else(|| vec![PathBuf::from("**/*")]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems odd/wrong PathBuf::from("**/*")
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @ry - it'd be better to rename field on Subcommand::Format
to globs
and keep Vec<String>
type.
Otherwise +1 from me, stricter types are always good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I've seen it's normal for glob patterns to be stored as "paths". They have distinctly separated segments (since any special syntax is limited to a segment), absoluteness, parent paths, it's useful to join()
them, normalize()
them, etc. Are you sure this is a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, makes sense, I've seen glob
/globset
crate do that. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @nayeemrmn
denoland#3955)" This reverts commit 701ce9b.
Follows from #3714.