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

Turn --preserve-quotes on by default #23

Open
Samathy opened this issue Mar 16, 2021 · 3 comments
Open

Turn --preserve-quotes on by default #23

Samathy opened this issue Mar 16, 2021 · 3 comments

Comments

@Samathy
Copy link

Samathy commented Mar 16, 2021

I ran yamlfmt with it's default settings over a codebase with a lot of YAML config.
It removes quotation marks from strings by default. This changes the semantic meaning of the files being formatted in the following ways:

Booleans:
"yes" and "no" are strings, but without quotes, they are parsed as booleans. Docker-compose in particular wants strings and chokes when given booleans.

Integers:
"10" is a string, but without quotes it is parsed as a number. This can cause problems.

This formatter should only be moving text around, not changing the meaning of it.
The --preserve-quotes flag should be on by default to avoid these issues.

@iranzo
Copy link

iranzo commented Sep 21, 2022

Had this same issue with Ansible playbooks, they got completely messed up, when enabled, apparently everything worked fine

@hofbi
Copy link

hofbi commented Jan 2, 2023

I also think it would make sense to have this by default.

@danielhollas
Copy link

Sorry to pile on, but I was hit by this many times (and just right now). Would be good to have a safer default.

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

No branches or pull requests

4 participants