-
Notifications
You must be signed in to change notification settings - Fork 12
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
Update our yamllint configuration file #200
Open
mcdonnnj
wants to merge
5
commits into
develop
Choose a base branch
from
improvement/update_yamllint_rules
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+75
−36
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use a specific number of spaces instead of the default of only caring if the number of spaces used is consistent within a file. Ensure that block sequences inside of mappings are indented.
The use of flow sequences and mappings is not as readable as block collections and so should be discouraged. Since it is a cleaner representation for empty collections we will allow those, but if an application otherwise requires flow collections they can be explicitly enabled by disabling the checks per https://yamllint.readthedocs.io/en/stable/disable_with_comments.html
When running ansible-lint it will throw the following warning with our current configuration: WARNING Found incompatible custom yamllint configuration (.yamllint), please either remove the file or edit it to comply with: - comments.min-spaces-from-content must be 1 - braces.max-spaces-inside must be 1 - octal-values.forbid-implicit-octal must be true - octal-values.forbid-explicit-octal must be true. Thus we implement these configuration rules.
Previously we disabled the `truthy` rule due to Ansible's use of `yes`/`no` for boolean values. That is no longer the case and the default configuration used by ansible-lint now has this rule enabled. The use of `on` as a key in GitHub Actions workflow syntax means we needed to add disable-line comments for the truthy rule.
mcdonnnj
added
breaking change
This issue or pull request involves changes to existing functionality
improvement
This issue or pull request will add or improve functionality, maintainability, or ease of use
security
This issue or pull request addresses a security issue
labels
Dec 4, 2024
Add a configuration for the `quoted-strings` rule that matches our best practices. Other files are updated to comply with these new settings.
mcdonnnj
force-pushed
the
improvement/update_yamllint_rules
branch
from
December 4, 2024 21:27
6ed0ef0
to
dc891af
Compare
jsf9k
approved these changes
Dec 5, 2024
jsf9k
approved these changes
Dec 5, 2024
dav3r
approved these changes
Dec 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking change
This issue or pull request involves changes to existing functionality
improvement
This issue or pull request will add or improve functionality, maintainability, or ease of use
security
This issue or pull request addresses a security issue
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🗣 Description
This pull request updates the
.yamllint
configuration file. It does the following:braces
rule.brackets
rule.comments
rule.indentations
rule.octal-values
rule.quoted-strings
rule.truthy
rule.💭 Motivation and context
These changes are a mix of matching the configuration to our existing best practices to ensure compliance and also updating the rules for changes in Ansible/ansible-lint.
Warning
The new
octal-values
rule settings are a breaking change from how we currently use octal values in Ansible (and probably elsewhere). We should probably determine if we prefer the"0xxx"
or"0oxxx"
form🧪 Testing
Automated tests pass. This will need some massaging downstream in repos with a
.yamllint
based on the ansible-lint default, and those.yamllint
files should be updated to reflect the current default configuration as described in the documentation.✅ Pre-approval checklist