Skip to content

Feature request: config-driven attribute-policy linting (attr-policy) #1480

Description

@alexeagle

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions