You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Making a change in a BUILD file and then running on changed targets has differing behavior depending on whether you use --changed-since as a goal filter or if you save the result into a file via list and use --spec-files on the lint goal.
Steps to reproduce:
git clone https://github.com/pantsbuild/example-python
cd example-python
echo"">> helloworld/BUILD
# This correctly fails black because the BUILD file format has an extra new line in the end
pants --changed-since=HEAD lint
# runs linter only on source mapped inside changed BUILD FILE, but not the BUILD file itself so black passes.
pants --changed-since=HEAD list > changed_targets.txt
pants --spec-files=changed_targets.txt lint
Lists all targets matching the file or target arguments.
I think the list & --spec-files might be working as intended, since BUILD files are not targets. I'm actually a little surprised that pants --changed-since=HEAD lint includes the BUILD file. I thought it would only be linted with pants update-build-files --check. So maybe the --changed-since is incorrect.
Is there a reason there is no build_source target automatically generated for each BUILD file?
I agree that list specifically mentions outputting only targets, while --spec-files works with both targets and files, so the current behavior makes sense from a functional standpoint. From a practical standpoint we probably would want to have a way to run all relevant linters on changed (similar to how pants --changed-since=HEAD lint does it), but with a deferred saved list targets.
Keep in mind that pants lint :: also lints BUILD files, so update-build-files is not the only way to run linters on BUILD files currently.
Describe the bug
Making a change in a BUILD file and then running on changed targets has differing behavior depending on whether you use
--changed-since
as a goal filter or if you save the result into a file vialist
and use--spec-files
on the lint goal.Steps to reproduce:
With the contents of
changed_targets.txt
:Pants version
2.23.0
OS
MacOS
Additional info
The text was updated successfully, but these errors were encountered: