google / google/yamlfmt

Request: `indent` being respected beyond top level

Open
#142 1 comment 2 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

The below:

```yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-byte-order-marker
- id: check-docstring-first
- id: requirements-txt-fixer
description: >-
Sorts entries in requirements.txt and removes incorrect entry
for `pkg-resources==0.0.0`.
```

With `-formatter=indent=4,scan_folded_as_literal=true` being passed to `yamlfmt` gets corrected to:

```yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-byte-order-marker
- id: check-docstring-first
- id: requirements-txt-fixer
description: >-
Sorts entries in requirements.txt and removes incorrect entry
for `pkg-resources==0.0.0`.
```

We can see the top level 4-space indent was preserved, but not the nested levels beyond that.

Can we make `indent` be recursive?

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.