buildtools
buildtools copied to clipboard
buildifier: Catch broad glob patterns
Would it be possible for buildifier to detect and warn about the use of open ended glob patterns?
filegroup(
name = "sources",
srcs = glob(["src/*"]),
)
I'm finding this pattern in quite a few places and it ends up introducing cache invalidation as local developers unknowingly have temp files rendered there by their IDE or some other process in their workflow, thus causing Bazel to rebuild targets when it shouldn't.
Instead, I'd want developers to add patterns similar to the following:
diff --git a/BUILD b/BUILD
index d88dd2b..77b4d51 100644
--- a/BUILD
+++ b/BUILD
@@ -1,4 +1,8 @@
filegroup(
name = "sources",
- srcs = glob(["src/*"]),
+ srcs = glob([
+ "src/*.rs",
+ "src/*.cc",
+ "src/*.h",
+ ]),
)