Is there a simple command to check if each file ha...
# general
f
Is there a simple command to check if each file has only one owner?
h
You can do
./pants list path/to/file.py
and make sure
wc -l
is 1. That is slow if you need to check every file because invoking Pants N times is slow So, you could then use
peek
and inspect the JSON I guess, but that's complicated If you want to do this check in CI, the simplest thing may be to develop a new goal
check-single-owners
. Request
AllTargets
and probably get
SourcesPaths
for each target -- make sure they is no overlpa
👍🏻 1
f
thanks ... something like
Copy code
sources_paths = await MultiGet(
        Get(SourcesPaths, SourcesPathsRequest(tgt.get(SourcesField))) for tgt in targets
    )

    counter = Counter(file for sp in sources_paths for file in sp.files)
seems to do the trick, although it might be useful to find owners too to help with output, i'll iterate on this
👍 1