bazel-contrib / bazel-contrib/buildtools
Feature request: config-driven attribute-policy linting (attr-policy)
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 471
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 13
Description
## Summary
Request a generalized, config-driven buildifier warning — `attr-policy` — that enforces declarative rules about BUILD attribute values without adding new Go code per policy.
Policies would live in `.buildifier.json` and cover constraints such as:
- forbidding specific scalar values (e.g. `timeout = "eternal"`) unless allow-listed
- list membership (e.g. no `exclusive` in test `tags`)
- boolean literals (e.g. `local = True`)
- dict entries (e.g. `execution_requirements = {"no-cache": "1"}`)
- numeric bounds (e.g. `shard_count` ≤ 50)
A related but separate tool (`testpolicy`) would read test-execution metrics and emit `buildozer` commands for timeout/flaky tuning; buildifier stays purely static. (similar to Google's http://go/attt )
## Design doc
Draft design (Workstream A: `attr-policy` in buildifier; Workstream B: empirical `testpolicy` tool):
https://github.com/alexeagle/buildtools/blob/docs/attr-policy-test-tuning-design/docs/attribute-policy-and-test-tuning-design.md
Happy to upstream this if there is interest.
Contributor guide
Research direction
Start with docs/attribute-policy-and-test-tuning-design.md and review the proposed Workstream A scope for buildifier. Define completion as static attr-policy rules being configured through .buildifier.json for the listed scalar, list, boolean, dictionary, and numeric constraints, while the separate testpolicy work remains outside buildifier.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100