bazel-contrib / bazel-contrib/buildtools

[buildozer] `set` on unknown list name sets string as value

Open
#987 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
1.2k
Forks
471
Avg merge
2d 22h
Merged PRs (30d)
13

Description

If you have a rule that has a list attr that isn't known (or at least isn't just `deps`) like this:

```bzl
some_rule(
name = "foo",
something = [
"foo",
],
)
```

and you run:

```
buildozer 'set something a b' :foo
```

You end up with:

```bzl
cc_library(
name = "foo",
something = a,
)
```

Instead of:

```bzl
cc_library(
name = "foo",
something = [
"a",
"b",
],
)
```

One potential workaround to this is to do:

```
buildozer 'remove something' 'add something a b' :foo
```

But it seems like this should work, or that there should be a `set_list` to do this

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown buildozer `set something a b` command on a rule whose list attribute is not `deps`, then trace the command's handling of unknown attributes. Done means the command preserves list syntax with both values, with regression coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.