Skip to content

Conversation

marcusburghardt
Copy link
Member

@marcusburghardt marcusburghardt commented Jun 19, 2025

Description:

The project is now checking YAML lint issues in CI tests and contributors may need to fix these issues when changing specific files. This commit provides hints to make this task much easier and simpler.

Rationale:

  • YAML files are not standardized and many upcoming PRs changing control files and profiles may be affected.
  • This PR provides hints to make things easier and simpler, not harder and complex.
  • CPLYTM-876

Review Hints:

You can try the command from the doc and see the outcomes.
Here is the yamlfix documentation:

I used this tool to fix the lint issues in #13592

The project is now checking YAML lint issues in CI tests and
contributors may need to fix these issues when changing specific files.
This commit provides hints to make this task much easier and simpler.

Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
@marcusburghardt marcusburghardt changed the title Include documentation and hints for YAML linting CPLYTM-876 - Include documentation and hints for YAML linting Jun 19, 2025
* Shall use the `.yml` vs `.yaml` for the file extension
* Shall have one blank line between sections

<details>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: I would refrain from using the <details>, I feel that it makes the content quite hidden or less visible.

Copy link
Member Author

Choose a reason for hiding this comment

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

My intention was to not create noise in the Style Guide style, which is expected to be the first documentation a contributor will check once hitting the CI Lint test. I also considered to move this somewhere else, but it is a small content and a reference in Style Guide would still be necessary. Maybe we can make the summary more intuitive. For example: Hint: Linting Tools to check and fix lint issues. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I included the suggestion in the last commit. It would looks like this:
Hint for linting tools

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, thanks!


Use `yamlfix` to automatically fix lint issues
```bash
yamlfix -c yamlfix.toml <file>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have tried it on multiple control files and it works great.

@jan-cerny jan-cerny self-assigned this Jun 20, 2025
@jan-cerny jan-cerny added this to the 0.1.78 milestone Jun 20, 2025
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
Copy link

Code Climate has analyzed commit 0ff044e and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 61.9% (0.0% change).

View more on Code Climate.

@AlexXuan233
Copy link
Contributor

Do you think we need add explicit_start = "False" to config file. https://lyz-code.github.io/yamlfix/#explicit-document-start . Do we need the explicit document start.

Copy link
Contributor

@AlexXuan233 AlexXuan233 left a comment

Choose a reason for hiding this comment

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

LGTM. Tested locally.

@marcusburghardt
Copy link
Member Author

Do you think we need add explicit_start = "False" to config file. https://lyz-code.github.io/yamlfix/#explicit-document-start . Do we need the explicit document start.

Good question. I saw the most of the linters complain about this by default, so I had to explicitly disable this check here, but I think it would be good to gradually introduce it so yaml linters can be use with less customization in the future.

@jan-cerny jan-cerny merged commit cf59980 into ComplianceAsCode:master Jun 20, 2025
131 checks passed
@marcusburghardt marcusburghardt deleted the yamlfix branch June 23, 2025 06:19
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.

3 participants