google / google/yamlfmt

Multiline syntax with pipe (`|`) not retained

Open
#185 13 comments 17 reactions 0 assignees View on GitHub
yaml_v3_problem
Dominant language
Go
Stars
1.8k
Forks
75
PR merge metrics
No merged PRs in 30d

Description

I see this diff:
```diff
steps:
- name: Start PostgreSQL
# We start PostgreSQL as a docker step instead of the GH `services` because it allows us to pass in custom flags (and seems to be faster to spin up?)
- run: |
- set -euo pipefail
- args=(
- -d
- --name postgres
- --env POSTGRES_USER=postgres
- --env POSTGRES_PASSWORD=postgres
- --publish 5432:5432
- --health-cmd pg_isready
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
- public.ecr.aws/docker/library/postgres:16-alpine
-
- # This is to allow many connections from xdist - we run as many DBs in parallel as CPUs on the box
- -c max_locks_per_transaction=1000
- -c max_connections=1000
- )
- docker run "${args[@]}"
-
+ run: "set -euo pipefail\nargs=(\n -d\n --name postgres \n --env POSTGRES_USER=postgres \n --env POSTGRES_PASSWORD=postgres \n --publish 5432:5432 \n --health-cmd pg_isready \n --health-interval 10s \n --health-timeout 5s \n --health-retries 5 \n public.ecr.aws/docker/library/postgres:16-alpine \n #magic___^_^___line\n # This is to allow many connections from xdist - we run as many DBs in parallel as CPUs on the box\n -c max_locks_per_transaction=1000 \n -c max_connections=1000\n)\ndocker run \"${args[@]}\"\n #magic___^_^___line\n"

```

This was previously discussed in https://github.com/google/yamlfmt/issues/62#issuecomment-1282779834.

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.