-
Notifications
You must be signed in to change notification settings - Fork 2.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
Cargo should warn when "include" doesn't match any files, or filters files from parent directories #9667
Comments
Is this a good "first issue"? If so I can try to take a crack at it this weekend. I assume changes will be similar to the license file PR linked above. I can see that it looks like this will be mostly an addition to the |
I've looked at this a bit more and I think it's unclear exactly what warning behavior we want with glob includes. Is the intent to match against the rule and give a warning if there are no matches? or should we check that the directory up until the wildcard exists and warn only if the folder that the rule identifies is missing? I looked at how these globs are included in |
I'm unsure how difficult this will be. Essentially I think it should give a warning if any particular include rule does not match any files. Since these are gitignore rules, that might be a little tricky. The way I would start is to have a separate code path somewhere around That's at least how I would start and see how it goes. Off the top of my head, I can think of a few tricky parts:
|
I was thinking something similar, but was unsure if we wanted to duplicate out more path walking functionality outside of
|
Problem
It appears that
cargo package
with theinclude
directive does not warn when it does not match a file, or when a file is from a parent directory. While I think the latter case is justifiable, I think it'd make sense to warn when these cases occur. This is similar to #7830 forlicense-file
and #5911 for thereadme
directives.Steps
Say we create a crate with the following steps:
If we then create a package with
cargo package
, cargo will silently ignore the included file from the parent directory:Possible Solution(s)
I think we should match the same "emit a warning" behavior that was implemented for #7830.
Notes
Output of
cargo version
: cargo 1.53.0 (4369396 2021-04-27)The text was updated successfully, but these errors were encountered: