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

Introduce proper formatting on python ,bash and yaml files #2774

Conversation

hansinikarunarathne
Copy link
Member

@hansinikarunarathne hansinikarunarathne commented Jun 28, 2024

Pull Request Template for Kubeflow manifests Issues

  • Please include a summary of changes and the related issue.
  • List any dependencies that are required for this change.
  • Please delete the options that are not relevant.
  • The following checklist will help you to satisfy the requirements.

✏️ A brief description of the changes

  1. I add black GitHub action to format the python files

  2. I used yamllint to format the YAML files. Created a GitHub pipeline to automate finding format errors in YAML files.

  3. I used shellcheck to format the bash files. Created a Github pipeline out of it

🐛 If this PR is related to an issue, please put the link of the issue here.

#2773

✅ Contributor checklist


You can join the CNCF Slack and access our meetings at the Kubeflow Community website. Our channel on the CNCF Slack is here #kubeflow-platform.

@juliusvonkohout
Copy link
Member

Please rebase to master to fix the conflict with trivy_scan.sh and please only scan files that are changed in pull requests and are in the folders /common and /example for now.

@juliusvonkohout
Copy link
Member

The error messages should also guide developers on how to fix it in their branch to pass the test.

@hansinikarunarathne hansinikarunarathne force-pushed the feature-workflow-to-formatting-python-and-yml-files branch from a3e448d to 6456723 Compare July 1, 2024 08:42
@juliusvonkohout
Copy link
Member

I think you can fix the python and bash scripts in this PR.

@hansinikarunarathne
Copy link
Member Author

I think you can fix the python and bash scripts in this PR.

did not understand what you meant?

@juliusvonkohout
Copy link
Member

juliusvonkohout commented Jul 1, 2024

I think you can fix the python and bash scripts in this PR.

did not understand what you meant?

There are a lot of warnings about bash and python files. Most of them are maintained directly in this repository. So you can just fix them with the formatting/linting changes and add them here to this PR. Everything in /hack should be fixed for example.

@hansinikarunarathne
Copy link
Member Author

I think you can fix the python and bash scripts in this PR.

did not understand what you meant?

There are a lot of warnings about bash and python files. Most of them are maintained directly in this repository. So you can just fix them with the formatting/linting changes and add them here to this PR. Everything in /hack should be fixed for example.

Okay I will do that. And Do I need to run this action only in the files change during the PR ?

@juliusvonkohout
Copy link
Member

juliusvonkohout commented Jul 1, 2024

Yes we should only check files that are changed in the PR. So PR by PR stuff will be cleaned up.

And I think we should exclude /apps in general.

Do you have something to check markdown as well?

@hansinikarunarathne hansinikarunarathne force-pushed the feature-workflow-to-formatting-python-and-yml-files branch 2 times, most recently from ce6f35e to a3ea293 Compare July 1, 2024 21:57
@hansinikarunarathne
Copy link
Member Author

hansinikarunarathne commented Jul 1, 2024

Yes we should only check files that are changed in the PR. So PR by PR stuff will be cleaned up.

And I think we should exclude /apps in general.

Do you have something to check markdown as well?

Yes we should only check files that are changed in the PR. So PR by PR stuff will be cleaned up.

And I think we should exclude /apps in general.

Do you have something to check markdown as well?

Yes we should only check files that are changed in the PR. So PR by PR stuff will be cleaned up.

And I think we should exclude /apps in general.

Do you have something to check markdown as well?

I di the requested changes. After the check, I will add guidelines to find respective errors in the workflow. Can you give me update regarding the state ? @juliusvonkohout

There are linters for markdowns as well. markdown_linters

@juliusvonkohout juliusvonkohout self-assigned this Jul 2, 2024
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
… sh files to address the formattings according to shellcheck

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
…matter

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
@hansinikarunarathne hansinikarunarathne force-pushed the feature-workflow-to-formatting-python-and-yml-files branch from ee3415d to 9ae743f Compare July 7, 2024 08:33
@juliusvonkohout
Copy link
Member

/lgtm
/approve

we have to test this in practice

@google-oss-prow google-oss-prow bot added the lgtm label Jul 9, 2024
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: juliusvonkohout

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 9b22cdc into kubeflow:master Jul 9, 2024
8 checks passed
@juliusvonkohout juliusvonkohout linked an issue Jul 10, 2024 that may be closed by this pull request
7 tasks
hansinikarunarathne added a commit to hansinikarunarathne/kubeflow-manifests that referenced this pull request Jul 22, 2024
…2774)

* Add balck github action to format python files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Formatted python files from the balck formatter

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add github action to format yaml files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add step YAML Formatting Guidelines to yaml_formatter.yaml file

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* made chnages to run next steps although the previous step fail

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* switch steps

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* added shellCheck for bash formatting

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Changed code only to lint yaml files inside the common and example folder

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Changed main to master

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Run yamllint on files which is chnaged in PR only

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Changed 'Proper formatting on python files' github workflow only to run for python files in common and example folder

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add shellcheckrc file

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Disable SC1017,SC2086,SC2070 rules when shellcheck and did changes in sh files to address the formattings according to shellcheck

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* made chnages in sh files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* made chnages in sh files to address formattings

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* made chnages in sh files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* disable SC2046 rule

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* disable SC2006 and SC2155 rule

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Change shellcheck only to run for PR chnaged files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Address a issue with bash_formatter.yaml

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Changed origin/main to origin/master

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Formatted python files from the balck formatter

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add github action to format yaml files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add step YAML Formatting Guidelines to yaml_formatter.yaml file

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* made chnages to run next steps although the previous step fail

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* switch steps

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add shellcheckrc file

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Disable SC1017,SC2086,SC2070 rules when shellcheck and did changes in sh files to address the formattings according to shellcheck

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* made chnages in sh files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Change shellcheck only to run for PR chnaged files

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Ensure the full history is fetched

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Ensure the full history is fetched in bash_formatter

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* fix SC2148 (error)

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* remove commented lines in bash_formatter.yaml

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* remove formatting chnages done to app folder content

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add guidlines to how to format python files according to black formatter

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

* Add guidlines to how to format bash files according to shellcheck formatter

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>

---------

Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enforce proper formatting on python, bash and yaml files
2 participants