-
Notifications
You must be signed in to change notification settings - Fork 531
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
readme: recommend double rather than single quotes in YAML files #513
Comments
Hello @mcandre , |
Hi @mcandre 👋,
The choice between single and double quotes depends on the specific use case. If you need to include escape sequences in your string, you should use double quotes. If you want your string to be interpreted exactly as it is, you should use single quotes. Single quoted strings work for all scenarios In general. Both quoting styles are widely accepted and used in YAML files. The choice between them often comes down to personal preference and the specific needs of your project. Therefore, there is nothing incorrect about the usage in the README file. |
Anything other than double quote syntax for YAML strings is hazardous and unintuitive. The spec should deprecate non-double quote syntax in the interest of safety. |
Thank you for sharing your perspective, but I’d like to clarify that the YAML specification does not deprecate single quote syntax, and both single and double quotes are valid for string values, depending on the use case. That said, I’m curious—is there a broader consensus or any official documentation suggesting that non-double quote syntax should be deprecated for safety reasons or that it’s generally hazardous? I’d really appreciate any resources or documentation you can provide on this. |
The YAML spec doesn't recommend any particular file extension, either. It's an important document but does not answer every question about ideal YAML usage. Just because the spec offers a jumpable bridge does not mean we should apply it. |
Description:
YAML breaks conventions for escape characters in at least one of its three string syntaxes. For this reason, recommend using double quotes (
"test"
) for string values, rather than single quotes ('test'
) or bare, unquoted strings (test
).Action version:
N/A
Platform:
N/A
Runner type:
N/A
Tools version:
N/A
https://yaml.org/spec/
The text was updated successfully, but these errors were encountered: