do we have a way to validate sources inside the `B...
# general
f
do we have a way to validate sources inside the
BUILD
files to see if they would raise any warnings when target is being used?
Having this target,
Copy code
python_tests(
    name="tests",
    dependencies=[":testdata"],
    sources=[
        "tests/test_*.py",
        "tests/foo.py",
    ],
)
if
foo.py
doesn’t exist, then when running
./pants test
command, we’ll see a warning
Copy code
[WARN] Unmatched glob from project/project:tests's `sources` field:
"project/project/tests/foo.py"
Is it possible OOTB to get warnings about unmatched globs without triggering running tests across all
BUILD
files and then grepping the output for
[WARN] Unmatched glob
?
This would be very handy to have as a repository lint step in CI to avoid failing the testing step (when all tests pass but there are unmatched globs)
1
it’s of course possible to collect the issues and present them later, but it would be very helpful to be able to validate sources as a separate goal
h
You can run this for example:
Copy code
./pants --files-not-found-behavior=error  filedeps ::
And it will error on those unmatching globs
I think it will error on the first one, not collect them all, so you might have to keep running it until it passes
f
this is amazing, just what I needed
🎉 2