is there an easy way to write BUILD file lint rule...
# general
m
is there an easy way to write BUILD file lint rules? my use case (simplified) is I have a codebase like
src/scala/models/*
and
src/scala/services/*
. I want to make sure no BUILD file in a services subfolder depends on anything from any other services subfolder
w
this sounds related to the dep banning work that @red-balloon-89377 is working on
r
Yes, there is an open PR that is being worked on intermittently: https://github.com/pantsbuild/pants/pull/6541
The way you’d implement it when it’s merged is that you can declare things like
Copy code
scala_library(..., dependency_constraints=DependencyConstraints([TargetName("a_banned_target"), Tag("a_banned_tag")])
If you can think of other types of constraints you’d like, feel free to comment on the PR with feedback
m
interesting cool will check it out. are there other ways to write BUILD lint rules in general? for example another one that would be useful for us is discouraging use of
exports
in library rules
w
A custom task, probably, depending on how general/specific you want it to be.