https://pantsbuild.org/ logo
#general
Title
# general
b

brash-baker-91190

11/03/2021, 1:38 PM
Is there a built-in way for Pants to give a list of files that it doesn't currently cover? I'm thinking of ways to prevent, say, adding a new shell script that and forgetting to add / modify a BUILD file to make sure that it gets linted, formatted, etc.
👀 1
I can cook up something with
Copy code
comm -13 \
    <(./pants filedeps :: | sort) \
    <(git ls-tree -r HEAD --name-only | sort)
Curious if there's something a tad more elegant I'm overlooking, though.
h

happy-kitchen-89482

11/03/2021, 1:54 PM
Running
./pants tailor
would generate the missing BUILD file targets
And it now (in the latest dev release) has a
--check
mode where it just writes to the console which changes it would have made
So, that maybe?
c

curved-television-6568

11/03/2021, 1:59 PM
You can run
./pants tailor --check
Copy code
$ ./p tailor --check
Would create BUILD:
  - Add python_requirements target requirements.txt

To fix `tailor` failures, run `./pants tailor`.
haha, yeah, Benjy beat me to it.. I found a bug in one of my PR’s while authoring this reply.. 😛
b

brash-baker-91190

11/03/2021, 2:19 PM
🤔 I'll give that a try... thanks!
I've tried 2.8.0rc0 and 2.8.0.dev5, and neither seems to have the
--check
option
would there also be a way to tell Pants to not try and create targets in some cases? I have some things it's trying to create
pex_binary
entries for that I don't really need.
h

hundreds-father-404

11/03/2021, 2:45 PM
The upcoming 2.8 rc will have --check, along with --ignore-paths and --ignore-adding-targets so that you can ignore false positives. Planned to be released today :)
https://github.com/pantsbuild/pants/pull/13422 for an example of the ignore options
b

brash-baker-91190

11/03/2021, 2:48 PM
Nice, I'll make sure to give that a try once it lands! 👍
h

hundreds-father-404

11/03/2021, 2:50 PM
(In case you missed it, 2.8 also has
update-build-files --check
to format build files with black and to fix safe deprecations like renaming target type names. In the future, this will be unified with
tailor
so that you have a single command to make sure your BUILD files are in tip-top shape)
b

brash-baker-91190

11/03/2021, 2:55 PM
I saw that... very nice stuff
❤️ 2
2 Views