-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Unexpected behaviour with quote_representation = '"'
#252
Comments
Hi @sid-maddy thanks for taking the time to open an issue, I reproduced the bug myself but after a quick look I haven't found a quick way to fix this issue as You can try with the next test (to be added to @pytest.mark.parametrize("quote_representation", quote_representations)
def test_quote_values_without_quote_basic_values(self, quote_representation: str) -> None:
"""Quote only scalar values with configurable quote representation."""
source = dedent(
"""\
port: '80'
"""
)
quote = quote_representation
fixed_source = dedent(
f"""\
---
port: {quote}80{quote}
"""
)
config = YamlfixConfig()
config.quote_representation = quote_representation
result = fix_code(source, config)
assert result == fixed_source And inspire yourself on |
@lyz-code maybe remove the config until the feature is fixed? I just ran into this today and it would have saved me time if the option simply wasn't available and/or it was documented that this is a known gap. |
That was a fun. How about adding a note to the documentation that this feature doesn't work? |
I took the liberty to open an issue in ruyaml. The problem is that I don't have any insight in the inner working and relation between yamlfix and ruyaml. I hope someone (*poke* @lyz-code) could fill in the missing details so we could get this thing rolling ;) |
Description
Even with
quote_representation = '"'
set in the config file,yamlfix
quotes already double-quoted values with single quotes.Steps to reproduce
.yamlfix.toml
file_with_double_quoted_integer_value.yaml
Current behavior
yamlfix
quotes theport
value with single quotes.file_with_double_quoted_integer_value.yaml
FWIW, with
quote_basic_values = true
also set in the config file, it exhibits the desired behaviour.Desired behaviour
yamlfix
keeps theport
value quoted with double quotes (even without settingquote_basic_values = true
.)Environment
The text was updated successfully, but these errors were encountered: