bazel-contrib / bazel-contrib/buildtools

[buildifier] Proper handling of scientific notation in arguments

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

Description

Currently,
```
tolerance = 5e-3
```

gets formatted to
```
tolerance = 5e - 3
```

as if the numbers were being subtracted. This is less clear than keeping the characters all adjacent to each other.

To reproduce the issue, clone the repo. Then run:
```
$ echo 'filegroup(name="foo", tolerance = 5e-3)' > BUILD.bazel
$ cat BUILD.bazel
filegroup(name="foo", tolerance = 5e-3)
$ buildifier BUILD.bazel
$ cat BUILD.bazel
filegroup(
name = "foo",
tolerance = 5e - 3,
)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the BUILD.bazel example and the `buildifier BUILD.bazel` command from the report. Then trace how buildifier formats scientific-notation arguments; done means `5e-3` remains adjacent after formatting rather than becoming `5e - 3`, with the existing formatting behavior preserved elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.