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

YAML formatting should be cleaned up to linter standards #1313

Closed
mboersma opened this issue Sep 27, 2023 · 5 comments · Fixed by #1328
Closed

YAML formatting should be cleaned up to linter standards #1313

mboersma opened this issue Sep 27, 2023 · 5 comments · Fixed by #1328
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.

Comments

@mboersma
Copy link
Contributor

mboersma commented Sep 27, 2023

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

@k8s-ci-robot
Copy link
Contributor

@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.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Sep 27, 2023
@FaithKovi
Copy link
Contributor

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

@mboersma
Copy link
Contributor Author

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.

@FaithKovi
Copy link
Contributor

@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?

@mboersma
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
3 participants