Skip to content

feat: Implement Lefthook for automated pre-commit checks and DCO sign…#766

Open
marwan562 wants to merge 1 commit intogoharbor:mainfrom
marwan562:feat-lefthook
Open

feat: Implement Lefthook for automated pre-commit checks and DCO sign…#766
marwan562 wants to merge 1 commit intogoharbor:mainfrom
marwan562:feat-lefthook

Conversation

@marwan562
Copy link
Copy Markdown
Contributor

Description

This PR introduces Lefthook, a fast and native Go Git hooks manager, to enforce strict pre-commit and commit-msg quality checks locally before code is even pushed to CI.

By running gofmt, golangci-lint, tests, builds, and a DCO sign-off check directly on the developer's machine, this setup catches trivial errors early, speeds up the feedback loop, and prevents broken or incorrectly formatted code from failing in GitHub Actions.

Type of Change

Please select the relevant type.

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Added lefthook.yml configuring pre-commit hooks for gofmt, golangci-lint, go build, and go test on staged files.
  • Added a commit-msg hook to enforce the DCO (Signed-off-by) standard on all commits.
  • Updated CONTRIBUTING.md with instructions for contributors on how to install and activate Lefthook locally.
  • Ignored the local .lefthook/ state directory in .gitignore.

…-off, updating and accordingly.

Signed-off-by: marwan562 <mixing.gamer546@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 7.79%. Comparing base (60ad0bd) to head (7f4d9b6).
⚠️ Report is 119 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #766      +/-   ##
=========================================
- Coverage   10.99%   7.79%   -3.20%     
=========================================
  Files         173     270      +97     
  Lines        8671   13169    +4498     
=========================================
+ Hits          953    1027      +74     
- Misses       7612   12029    +4417     
- Partials      106     113       +7     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Add Lefthook to enforce local pre-commit checks

1 participant