google / google/jsonnet

Consider adding one more indentation after if

Open
#490 6 comments 0 reactions 0 assignees View on GitHub
enhancement formatter
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

Please consider the following different ways of writing if

```
{
replicas: {
build: if isCanary then 0
else 1,

dev: if isCanary then
0
else
1,

prod: if isCanary
then 0
else 1,

perf: if isCanary
then
0
else
1,

},
}
```
`jsonnet fmt` aligns `then` and `else` with the key name.

Did you consider adding one more indent to the blocks starting with `then` and `else`.
How about the following indentation assuming `--indent 4` is passed to `jsonnet fmt`

```
{
replicas: {
build: if isCanary then 0
else 1,

dev: if isCanary then
0
else
1,

prod: if isCanary
then 0
else 1,

perf: if isCanary
then
0
else
1,
},
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.