bazelbuild / bazelbuild/bazel

Implement `.append()` on `select()`

Open
#14,157 26 comments 5 reactions 0 assignees View on GitHub
P3 team-Configurability type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

Many Starlark macros use `.append()` on attributes like `deps` to inject additional dependencies. Buildifier also emits a lint warning when a single element is added to a list via `+=` rather than `.append()`.

This can be problematic for users of the macros as it silently makes the attribute non-configurable: `select()` only supports concatenation, not `.append()`.

Changing that by implenting `.append()` on `SelectorValue` and `SelectorList` would thus make many existing macros more useful as well as resolve the tension between the linter and configurability. If this is deemed useful, I would be willing to send a PR.

Contributor guide

Open the contributing guide

Research direction

Locate the SelectorValue and SelectorList entry points and read how select() currently supports concatenation. Check existing tests for selector operations, then add coverage showing the intended .append() behavior for both types and confirming that configurable attributes remain usable.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.