Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a JVM-based YAML formatter #910

Closed
jamietanna opened this issue Aug 10, 2021 · 2 comments
Closed

Add a JVM-based YAML formatter #910

jamietanna opened this issue Aug 10, 2021 · 2 comments

Comments

@jamietanna
Copy link
Contributor

jamietanna commented Aug 10, 2021

Similar to #853, there'd ideally be a YAML formatter for Spotless. I've not yet investigated options, but a simple() version maybe using Jackson's YAML mapper may be sufficient for a first option

Edit: looking at it, and the various formats for YAML it may not be as easy as I thought, given it needs to parse and then pretty-print, which can change the formats substantially (and do things like exclude comments):

---
hr:
  - Mark McGwire
  # Following node labeled SS
  - &SS Sammy Sosa
rbi:
  - *SS # Subsequent occurrence
  - Ken Griffey

vs

hr: [Mark McGwire, Sammy Sosa]
rbi: [Sammy Sosa, Ken Griffey]
@blacelle
Copy link
Contributor

A Jackson-based YAML formatter has been added, but it comes with various limitations (e.g. stripping away comments).

One may consider adding a SnakeYML formatter (which is Jackson own underlying YAML parser).

FasterXML/jackson-dataformats-text#372

@blacelle
Copy link
Contributor

blacelle commented Mar 9, 2023

Are we OK to close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants