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

feat: Add pre-commit hooks for automated code quality checks #3001

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

akagami-harsh
Copy link
Contributor

@akagami-harsh akagami-harsh commented Feb 17, 2025

Pull Request Template for Kubeflow Manifests

✏️ Summary of Changes

  • Added pre-commit configuration for code quality checks

  • Integrated existing linters into pre-commit:

    • black for Python formatting
    • yamllint for YAML validation
    • shellcheck for shell script analysis
  • Fixed shellcheck some warnings

  • To use these checks locally:

    • Install pre-commit: pip install pre-commit
    • Set up the git hooks: pre-commit install

The checks will now run automatically on git commit, or you can run manually:

📦 Dependencies

List any dependencies or related PRs (e.g., "Depends on #123").

🐛 Related Issues

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

Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
@juliusvonkohout
Copy link
Member

@akagami-harsh
Copy link
Contributor Author

Why do you want this instead of https://github.com/kubeflow/manifests/blob/master/.github/workflows/linting_bash_python_yaml_files.yaml ?

With this setup we can run checks locally: pre-commit run, and it was also mention in the issue #2797 (comment)

Additionally, we could start using some nice utilities like pre-commit to automatically run some actions like linters, formatters, check if commit is signed and potentially more. Then, such a pre-commit configuration could be used both from the GH Actions and from the Developer Environment. These are the GH Actions that could benefit from this pattern:

@juliusvonkohout
Copy link
Member

juliusvonkohout commented Feb 18, 2025

Then lets try it out

/lgtm
/approve

maybe add some documentation to the main readme as well.

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 88c6722 into kubeflow:master Feb 18, 2025
10 checks passed
@akagami-harsh akagami-harsh deleted the add-pre-commit branch February 19, 2025 07:01
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.

2 participants