kubernetes-sigs/image-builder

YAML formatting should be cleaned up to linter standards

mboersma opened this issue · 5 comments

What steps did you take and what happened:

Run make -C images/capi lint and see that there are numerous warnings from ansible-lint that the project is ignoring.

In particular, there are many formatting warnings. Many of these boil down to what the linter considers basic YAML linting (removing unnecessary quotes, ensuring document separators ---, and so on). It would be helpful to fix just those separately.

What did you expect to happen:

Running make -C images/capi lint shouldn't result in any basic formatting warnings.

Anything else you would like to add:

One way to accomplish this:

ansible-lint --fix=none images/capi/ansible
make -C images/capi lint-ignore
git add images/capi
git commit -m "Format YAML files for ansible-lint"

These commands:

  • Tell the linter not to fix a specific type of warning, so it just does its basic formatting
  • Regenerate the .ansible-lint-ignore file so these warnings won't be ignored in the future
  • Add all the changed files to version control and commit them.

Then run make -C images/capi lint to ensure it's passing, and create a PR.

Environment:

N/A

/kind bug
/help
/good-first-issue

@mboersma:
This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

What steps did you take and what happened:

Run make -C images/capi lint and see that there are numerous warnings from ansible-lint that the project is ignoring.

In particular, there are many formatting warnings. Many of these boil down to what the linter considers basic YAML linting (removing unnecessary quotes, ensuring document separators ---, and so on). It would be helpful to fix just those separately.

What did you expect to happen:

Running make -C images/capi lint shouldn't result in any basic formatting warnings.

Anything else you would like to add:

One way to accomplish this:

ansible-lint --fix=none images/capi/ansible
make -C images/capi lint-ignore
git add images/capi
git commit -m "Ansible actions use fully-qualified collection names"

These commands:

  • Tell the linter not to fix a specific type of warning, so it just does its basic formatting
  • Regenerate the .ansible-lint-ignore file so these warnings won't be ignored in the future
  • Add all the changed files to version control and commit them.

Then run make -C images/capi lint to ensure it's passing, and create a PR.

Environment:

N/A

/kind bug
/help
/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Hello @mboersma I would like to work on this issue. Please assign

Thanks @FaithKovi!

Please ask here or on the image-builder Slack channel if you have any questions. This issue blocks #1312, so we should try to fix it soon.

@mboersma
After running the command make -C images/capi lint-ignore
When I run make -C images/capi again, I get an output like this:

fqcn[action]: Use FQCN for module actions, such `ansible.windows.win_shell`. (warning) # ignored
ansible/windows/roles/systemprep/tasks/ssh-feature.yml:18 Action `win_shell` is not FQCN.

Note: A short part of the output.
Does this mean it is up to linter standards?

If the command make -C images/capi lint passes but you generated a lot of changes, then I think it's fine. We're not trying to fix the "fqcn"-type errors in this change, so it will still complain about them, but it shouldn't count them as actual errors.