-
Notifications
You must be signed in to change notification settings - Fork 264
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
quoted-strings
only-when-needed incorrectly detecting strings with redundant quotes
#242
Comments
Hi @RealOrangeOne (cc @ruipinge), thanks for the report and sorry about that. There are actually 2 problems:
I believe using yamllint/yamllint/rules/quoted_strings.py Lines 80 to 81 in 1a13837
and checking token.value[0] in START_TOKENS is not a good way to do, because we can't ensure the need for quotes using only the first character.
Could an alternative solution be to drop |
Perhaps, although there are complexities. For example, given Perhaps attempting to parse the value, and if it results in a complex type (ie list, object, parse error, whatever), then raise? I'd be interested in knowing if there's a solution for the simpler data types (int, bool etc), but I can't think of one. |
From a user perspective, I'm not sure I understand what you mean by "then raise". To be clearer about my idea on |
Change implementation of `required: only-when-needed`, because maintaining a list of `START_TOKENS` and just looking at the first character of string values has proven to be partially broken. Cf. discussion at #246 (comment). Fixes #242.
Change implementation of `required: only-when-needed`, because maintaining a list of `START_TOKENS` and just looking at the first character of string values has proven to be partially broken. Cf. discussion at #246 (comment). Fixes #242 and #244.
Change implementation of `required: only-when-needed`, because maintaining a list of `START_TOKENS` and just looking at the first character of string values has proven to be partially broken. Cf. discussion at #246 (comment). Fixes #242 and #244.
Change implementation of `required: only-when-needed`, because maintaining a list of `START_TOKENS` and just looking at the first character of string values has proven to be partially broken. Cf. discussion at #246 (comment). Fixes #242 and #244.
Since upgrading to 1.21.0, I enabled the following config:
Unfortunately, seems there's some strings which it believes don't need quoting, when in fact they do:
aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman
%H:%M:%S
'Mac' in ansible_facts.product_name
It seems to be something around when a string either contains or starts with a special character, but isn't entirely a special character?
The text was updated successfully, but these errors were encountered: