Allow custom rules to overide default values for built-in attributes.
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
The case I'm running into is a `foo_test` rule that should basically always be used with `size="small", timeout="short"` (in fact, the expected resource usage even in extreme cases is likely 10x smaller then that).
What I'd like to do is pass something to `rule()` picking a different default for those attributes so that consumers don't by default get a `There were tests whose specified size is too big.` warning.
A somewhat more general feature would also be nice; I can think of cases where several other attributes listed under ["common definitions" ](https://bazel.build/reference/be/common-definitions) where the author of a rule could give better default than the global ones provided by Bazel.
### What underlying problem are you trying to solve with this feature?
Decrease the number of warnings that a custom rule causes bazel to generate "out of the box".
### Which operating system are you running Bazel on?
n/a
### What is the output of `bazel info release`?
release 6.0.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?
```text
n/a
```
### Have you found anything relevant by searching the web?
no
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
The issue does not name a source file, test, or entry point. Start by tracing how Bazel handles common attribute defaults for custom rules and how rule() accepts rule-specific metadata. Done means custom rules can override selected built-in attribute defaults and the resulting warnings are reduced without changing global defaults.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100