yamlfixer
yamlfixer copied to clipboard
Feature request > Fix `quoted-strings`
❔ Context
Fix quoted-strings
. Docs:
https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.quoted_strings
💡 Proposed solution
- Change
quote-type
to double or single accordingly; - Remove unnecessary quotes when
required
is set toonly-when-needed
; - Add quotes when
required
is set to true; - Remove quoted quotes when
allow-quoted-quotes
is false.
Hi @tamere-allo-peter , what's your opinion about this feature request ?
@adriens very complex. Currently we don't use yamllint's configuration file, we only pass it as-is to yamllint when needed, and we "fix" by doing what yamllint suggests, whenever it does suggest something, and do our best the remaining of the time. Closing this one is very hard work because if we begin to parse yamllint's configuration file, this opens the door to a number of other fixes we should do according to this file that we don't right now.
So should we flag this as a wontfix
because of lack of time ?
@adriens we'll leave it open for now, maybe I'll have more time for this at the end of the year.
So it will stay on :
⏸️
this opens the door to a number of other fixes we should do according to this file that we don't right now.
Perhaps that it opens the door to different fixes, but the scope of the current github issue would remain "to automatically fix quoted-strings
" and so the other fixes that could be made can be put in a backlog for future contributions.
This said, another issue would need to be created & resolved first (i.e. Adding a yamllint configuration parser
)
ps: thanks for this package, it's really great!
Re-reading my previous comment, it might be something that yamllint
can fix on their end (i.e. they could write a better message when reporting a quoted-strings
error)
On my end, I see this message from yamllint
:
>>> cat .yamllint
rules:
quoted-strings:
quote-type: double
required: true
allow-quoted-quotes: true
>>> yamllint --format parsable .
./path/to/file/config.yaml:31:11: [error] string value is not quoted with double quotes (quoted-strings)
And I am wondering if this message is informative enough to be actionable? it seems to suggest to replace the single quotes by double quotes or to add double-quotes.
Yes it seems to be informative enough in the general case, however unfortunately I don't have the time to work on this project at the moment.