Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Don't quote strings that start with 0 when running ansible-lint --fix. #4167

Merged
merged 1 commit into from
May 24, 2024

Conversation

kousu
Copy link
Contributor

@kousu kousu commented May 16, 2024

In order to try to handle the mess that are octals in YAML, some special-case code was added to handle leading-zeros. But it caught too much, and would quote strings like 00-header and 0.0.0.0, even when .yamllint doesn't require them:

quoted-strings:
    required: false

and it generates awkward lists, like

   loop:
     - "00-header"
     - 10-help-text
     - 50-landscape-sysinfo
     - 50-motd-news
     - 88-esm-announce
     - 97-overlayroot

Fixes #4166

@kousu kousu requested a review from a team as a code owner May 16, 2024 00:25
@kousu kousu requested review from Qalthos and shatakshiiii and removed request for a team May 16, 2024 00:25
@kousu kousu force-pushed the protect-leading-0-str branch from 4d71bbe to 8add53b Compare May 16, 2024 00:32
@kousu kousu force-pushed the protect-leading-0-str branch from 8add53b to 7ff873e Compare May 16, 2024 00:48
@kousu kousu force-pushed the protect-leading-0-str branch from 7ff873e to 55eeb05 Compare May 23, 2024 15:08
In order to try to handle [the mess that are octals in YAML](ansible#2965),
some [special-case code was added](ansible#3030)
to handle leading-zeros. But it caught too much, and would force quotes strings
like on 00-header and 0.0.0.0, even when .yamllint doesn't require them:

```
quoted-strings:
    required: false
```

and it generates awkward lists, like

```diff
   loop:
     - "00-header"
     - 10-help-text
     - 50-landscape-sysinfo
     - 50-motd-news
     - 88-esm-announce
     - 97-overlayroot
```
@ssbarnea ssbarnea merged commit 4588273 into ansible:main May 24, 2024
25 of 26 checks passed
@kousu
Copy link
Contributor Author

kousu commented Jun 20, 2024

Thank you for the merge @ssbarnea !
It got lost in my inbox somewhere but I see it now and <3

kousu added a commit to kousu/ansible-lint that referenced this pull request Jun 20, 2024
I left a stray thought in ansible#4167.  Sorry about that!
@kousu kousu mentioned this pull request Jun 20, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Octal-like strings are quoted unnecessarily
2 participants