bazel-contrib / bazel-contrib/buildtools
Buildifier shouldn't break up blocks of constants with newlines
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 471
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 13
Description
```python
UBUNTU_MAIN = "http://mirrors.kernel.org/ubuntu/pool/main/"
UBUNTU_UNIVERSE = "http://mirrors.kernel.org/ubuntu/pool/universe/"
NODEJS = "http://deb.nodesource.com/node_6.x/pool/main/"
```
becomes
```python
UBUNTU_MAIN = "http://mirrors.kernel.org/ubuntu/pool/main/"
UBUNTU_UNIVERSE = "http://mirrors.kernel.org/ubuntu/pool/universe/"
NODEJS = "http://deb.nodesource.com/node_6.x/pool/main/"
```
This is not ideal because a `BUILD` file with blocks of related constants can become very "fluffy" and difficult to scan over.
Copying the `gofmt` logic of aligning equals signs in blocks of assignments would be nicer:
```python
UBUNTU_MAIN = "http://mirrors.kernel.org/ubuntu/pool/main/"
UBUNTU_UNIVERSE = "http://mirrors.kernel.org/ubuntu/pool/universe/"
NODEJS = "http://deb.nodesource.com/node_6.x/pool/main/"
```
Or, alternatively, just don't add newlines.
Contributor guide
Research direction
The issue does not name a source file or test. Reproduce the shown constants with Buildifier and trace the formatter path that inserts blank lines between assignments. Compare aligned equals signs with preserving the block, then add coverage for the chosen behavior; done means related constants are no longer split unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100