spotless icon indicating copy to clipboard operation
spotless copied to clipboard

Is it possible to limit yaml formatting to just indentation and preserving empty lines

Open aldex32 opened this issue 2 years ago • 3 comments

Hello, my question is whether it is possible to limit yaml formatting to just indentation and preserving empty lines. In other words if it's possible to avoid using jackson and sneakyaml, since they have some limitations as mentioned https://github.com/diffplug/spotless/pull/1478#issuecomment-1378634351

Thanks!

aldex32 avatar Oct 08 '23 12:10 aldex32

Jackson has indeed limitation, amongst which comments removal (https://github.com/diffplug/spotless/issues/1795).

SnakeYAML might be the way to go for this need. (I suspect indentation-only is not that simple, and preserving empty-lines would be an option).

blacelle avatar Sep 10 '24 16:09 blacelle

@aldex32 where did you find any SnakeYAML limitations? The above mentioned issue does not contain any limitations for SnakeYAML

asomov avatar Sep 10 '24 16:09 asomov

https://github.com/google/yamlfmt may also be the way to go to circumvent current Jackson limitations.


@asomov I believe the only limitation is the lack of contribution around SnakeYAML into Spotless. Such a formatter would circumvent many of current issues around Jackson (even it is based on SnakeYAML).

blacelle avatar Sep 10 '24 17:09 blacelle