-
-
Notifications
You must be signed in to change notification settings - Fork 632
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
Warn/error for unmatched glob patterns #5430
Comments
illicitonion
pushed a commit
that referenced
this issue
May 31, 2018
### Problem Pants gives no indication when a file specified in the `sources` kwarg of a target doesn't exist, or if a glob pattern doesn't match anything. This is often an error. See #5430, as well as [this longstanding TODO in `wrapped_globs.py`](https://github.com/cosmicexplorer/pants/blob/58e902ee5381aa845002f27358d20b065c95abb3/src/python/pants/source/wrapped_globs.py#L264). ### Solution - Add the `--glob-expansion-failure` global option (defaulting to `warn`). - Warn or raise an error if any of the arguments to `globs`, `rglobs`, `zglobs`, or a literal file list doesn't expand to any existing source files. ### Result There are now warning messages emitted *(warnings don't work yet, see #5863)* when a glob doesn't match in a `sources` or `bundles` argument in a target. Setting the global option `--error-on-glob-match-failure` will cause an exception to be raised if any glob fails to match a file. Error messages contain a representation of the `globs`/`rglobs`/etc call from the BUILD file to aid in debugging. ## Followup Issues 1. #5863 2. #5864 3. #5871
Fixed by @cosmicexplorer in #5769! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There has been a long-standing TODO to warn or error (depending on an option) for unmatched globs, and since we now control the implementation of glob matching, we no longer have a great excuse not to. This would also help make the proposal from #5427 less error prone.
The implementation would be to warn/error for each entry (whether pattern or literal) which did not match anything. This would mean that you would get a warning/error for a glob like
*.scala
that didn't catch any files, and also forMispeeled.scala
which indicated a non-existent file.The text was updated successfully, but these errors were encountered: