Skip to content

Conversation

@nawazkh
Copy link
Member

@nawazkh nawazkh commented Oct 25, 2024

What type of PR is this?
/kind cleanup

What this PR does / why we need it:

  • This PR updates .pre-commit config. @nojnhuh had pointed out once that verify job already runs the list of checks I'd configured in .pre-commit. We can remove them.
    • remove lint checks since we have a new linter job running on each PR.
    • remove spellchecks, boilerplate-code checks, tiltfile checks, modules check and codespell check since we already had a verify job running on each PR.
  • This PR also updates some versions of the pre-commit hooks.
  • Pre-commit is now faster :)

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Special notes for your reviewer:

  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Update pre-commit hooks

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 25, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 25, 2024
@codecov
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.98%. Comparing base (ca18c2c) to head (eb8a272).
Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5213   +/-   ##
=======================================
  Coverage   52.98%   52.98%           
=======================================
  Files         273      273           
  Lines       29197    29197           
=======================================
  Hits        15469    15469           
  Misses      12926    12926           
  Partials      802      802           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

- remove lint checks since we run at PRs
- remove lint checks since we run verify job
- switch shellcheck to latest
- update .pre-commit with the latest versions of the binaries
@nawazkh
Copy link
Member Author

nawazkh commented Oct 25, 2024

/cc @mboersma

@k8s-ci-robot k8s-ci-robot requested a review from mboersma October 25, 2024 00:48
@nawazkh nawazkh marked this pull request as ready for review October 25, 2024 00:48
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 25, 2024
@jackfrancis
Copy link
Contributor

/retest

@mboersma
Copy link
Contributor

I don't understand why we're removing these checks. They were also run in CI against PRs when we introduced the pre-commit hooks.

In my opinion, the value of a pre-commit is to force me to run local tests rather than just push my code to GitHub and see what happens. That's expensive and sloppy.

It's always a tradeoff between time and thoroughness. I gather most of the team hasn't been using the pre-commit as is because it takes too long. But for me, if we're not going to run those make verify- type checks, this is less valuable.

@nawazkh
Copy link
Member Author

nawazkh commented Oct 25, 2024

the value of a pre-commit is to force me to run local tests rather than just push my code to GitHub and see what happens.

Good point.

Speaking with the team overtime, I deduced that some folks don't use pre-commit because it slowed down their workflow.
Especially lint that took a really long time.
Removing the redundant make verify- jobs speeds up the pre-commit workflow.
It also encourages adoption since pre-commit runs important hooks like gitleaks.

On the flip side, yes, we will not run the verify jobs (verify-boilerplate, verify-modules, verify-gen, verify-shellcheck, verify-conversions, verify-tiltfile, verify-codespell) in our local. That gets handled by pull-cluster-api-provider-azure-verify job.

To me, I would wanna know about errors from gitleaks, end-of-file-fixer and trailing-whitespace before code gets into GitHub. So pre-commit is acting as the first line of defense before code gets out of my local.
And I want to run verify-boilerplate, verify-modules, verify-gen, verify-shellcheck, verify-conversions, verify-tiltfile, verify-codespell on every code change(handled at PR via job).

That being said, I am happy to revert my changes and just update the pre-commit hook's versions.
Since this really boils down to our preference of developing and commiting code, I dont really have a strong preference.
I am inclined on whichever approach that leads to higher adoption of pre-commit. :)

@mboersma
Copy link
Contributor

I am inclined on whichever approach that leads to higher adoption of pre-commit

I agree with that. 👍🏻

From my point of view, this just means I will need to remember to run make lint verify before committing. But if more of the team prefers a faster, less comprehensive pre-commit, that works for me.

Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @jackfrancis

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 29, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 5055855a37007d48ab7b0cd3c2367065cbb0846a

@jackfrancis
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jackfrancis

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 29, 2024
@k8s-ci-robot k8s-ci-robot merged commit 264cc63 into kubernetes-sigs:main Oct 30, 2024
23 of 25 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Oct 30, 2024
@nawazkh nawazkh deleted the update_pre_commit branch October 30, 2024 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants