<#10824 parse BUILD file addresses with a regex an...
# github-notifications
q
#10824 parse BUILD file addresses with a regex and error early on invalid specs Issue created by cosmicexplorer While helping someone in the slack today, they got over their first error, but then received the message:
ResolveError: Directory ":" does not contain any BUILD files.
This was because their BUILD file contained:
Copy code
python_library(
        dependencies = [
        "//:pytz",
        "//:python-dateutil",
        "//:requests",
        "//::PyYAML",
        "ns/core",
        "ns/config",
        "ns/bar",
    ]
)
where
//::PyYAML
was a typo. I believe in this case, the
ResolveError
didn't even show the directory where the address was erroring in, which would make this very difficult to diagnose in a larger repo. I think that when we parse BUILD files, we should be able to validate dependency addresses against the regex:
(//)?([^:]+(:[^/:]+)?|:[^/:]+)
and if it fails, spit out an error message either with just that regex, or with a nicer subroutine that detects which part of the address was invalid, along with the path to the specific BUILD file with the error. pantsbuild/pants