tedivm / dapperdata

An opinionated formatter for configuration files
https://pypi.org/project/dapperdata/
MIT License
3 stars 0 forks source link

Incorrect yaml formatting #2

Open rbroderi opened 5 months ago

rbroderi commented 5 months ago

Dapperdata incorrectly fixes yaml files when a list is at the root level of a document

-   id: trailing-whitespace
    name: Trim Trailing Whitespace
    description: This hook trims trailing whitespace.
    entry: trailing-whitespace-fixer
    language: python
    types: [text]

to

- id: trailing-whitespace
    name: Trim Trailing Whitespace
    description: This hook trims trailing whitespace.
    entry: trailing-whitespace-fixer
    language: python
    types: [text]
rbroderi commented 5 months ago

this appears to be related to yaml.indent(mapping=2, sequence=4, offset=2), if i change it to yaml.indent(mapping=2, sequence=2, offset=0) dapperdata (ruamel) correctly formats the above yaml. Looking into ruamel to see if there is an open bug.

rbroderi commented 5 months ago

opened ticket https://sourceforge.net/p/ruamel-yaml/tickets/516/

tedivm commented 5 months ago

Applying the (mapping=2, sequence=2, offset=0) breaks other tests, so that's not going to work. I'm going to wait on the upstream library to see if they make any fixes.