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

Added missing 'truthy' setting in YAMLLINT_CONFIG #1954

Closed
wants to merge 1 commit into from
Closed

Added missing 'truthy' setting in YAMLLINT_CONFIG #1954

wants to merge 1 commit into from

Conversation

ggustafsson
Copy link

By default yamllint does not consider "yes" and "no" to be valid truthy values (only "true" or "false" is allowed by default). Since "yes" and "no" is very common in Ansible playbooks (e.g "become: yes") it should be allowed in the default yamllint config used by ansible-lint.

Alternative solution to extending the "truthy" setting would be to disable it completely but I figured just adding the missing common values is a little bit nicer.

Extended yamllint's truthy setting to be compatible with Ansible
playbooks. Allow [tT]rue/[fF]alse/yes/no instead of only true/false.
@ggustafsson ggustafsson requested a review from a team as a code owner March 5, 2022 15:44
@ggustafsson ggustafsson requested review from relrod, ssbarnea and ganeshrn and removed request for a team March 5, 2022 15:44
Copy link
Member

@ssbarnea ssbarnea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid that I will be against this change. While Ansible is very relaxed regarding what kind of booleans it accepts, the linter is not and allows only the YAML 1.2-compatible forms, as one of its goals is to normalize the code and make it future proof.

At some point in the future Ansible will allow or even require YAML 1.2, so using pure booleans is the right path.

There were talks about updating Ansible docs and to popularize pure boolean values true and false but I am not sure exactly when this will happen.

@ggustafsson
Copy link
Author

Oh, I thought it was just yamllint that was opinionated about it and that it didn't matter in YAML. If the YAML spec says true/false is the way to go then I am all for it. It's unfortunate that Ansible/YAML/documentation is not consistent at the moment.

Anyways thanks for the info. Let's close this thing and get on with our lives! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants