Skip to content
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

Comment at line end prevents conversion from key "yes" to key "true" #261

Open
ltog opened this issue Sep 19, 2023 · 1 comment
Open

Comment at line end prevents conversion from key "yes" to key "true" #261

ltog opened this issue Sep 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ltog
Copy link

ltog commented Sep 19, 2023

Description

I would like keys yes to be converted to true but this is being prevented when there are comments on the same line.

Steps to reproduce

Start with:

---
asdf:
  - check_mode: yes  # asdf

Current behavior

File remains unchanged after running yamlfix myfile.yaml:

---
asdf:
  - check_mode: yes  # asdf

(It works as desired if the comment is being removed.)

Desired behavior

File should be converted to:

---
asdf:
  - check_mode: true  # asdf

Environment

------------------------------------------------------------------
     yamlfix: 1.14.0
     Python: 3.10.12
     Platform: Linux-5.15.0-83-generic-x86_64-with-glibc2.35
------------------------------------------------------------------
@ltog ltog added the bug Something isn't working label Sep 19, 2023
@lyz-code
Copy link
Owner

Hi @ltog, thanks for taking the time to open an issue, I can reproduce the bug, although if I remove the comment I don't get the same behaviour as you:

From:

---
asdf:
  - check_mode: yes 

I get:

---
asdf:
  - check_mode: 'yes'

It looks like yes and no are not recognized by ruyaml as truthy values. I won't have time to debug this issue, if you can, please submit a PR to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants