[PR #4925] [MERGED] [ci] Add local lint setup with pre-push hook to catch issues early #21610

Closed
opened 2026-08-05 05:08:43 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/4925
Author: @pappz
Created: 12/7/2025
Status: Merged
Merged: 12/15/2025
Merged by: @pappz

Base: mainHead: feature/pre-push-lint


📝 Commits (5)

📊 Changes

3 files changed (+46 additions, -0 deletions)

View changed files

.githooks/pre-push (+11 -0)
📝 CONTRIBUTING.md (+8 -0)
Makefile (+27 -0)

📄 Description

Developers can now catch lint issues before pushing, reducing CI failures and iteration time. The setup uses golangci-lint locally with the same configuration as CI.

Setup:

  • Run make setup-hooks once after cloning
  • Pre-push hook automatically lints changed files
  • Use make lint to manually check changed files
  • Use make lint-all to run full CI-equivalent lint

The Makefile auto-installs golangci-lint to ./bin/ using go install to match the Go version in go.mod, avoiding version compatibility issues.

Describe your changes

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Chores
    • Implemented automated code quality checks using Git hooks to ensure consistent code standards before pushing changes
    • Added linting configuration and streamlined development environment setup with automatic verification
  • Documentation
    • Updated contribution guide with instructions for setting up the local development environment with automatic code quality enforcement

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/4925 **Author:** [@pappz](https://github.com/pappz) **Created:** 12/7/2025 **Status:** ✅ Merged **Merged:** 12/15/2025 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `feature/pre-push-lint` --- ### 📝 Commits (5) - [`6a9da69`](https://github.com/netbirdio/netbird/commit/6a9da69ecd83dd4970765bd5a14b90af0ca8bcc0) Add local lint setup with pre-push hook to catch issues early - [`3119a00`](https://github.com/netbirdio/netbird/commit/3119a007847311c7c7b3cc05e52c8875c9251861) Add hint - [`51a9497`](https://github.com/netbirdio/netbird/commit/51a9497e6b2cbd34ed298b479017ad695bbdc8e8) Move the doc from README to CONTRIBUTING - [`13ed584`](https://github.com/netbirdio/netbird/commit/13ed584929f58a921b81970490278a351d9d5f54) test - [`10d4ba1`](https://github.com/netbirdio/netbird/commit/10d4ba1441def7f9e6bd7764d00445ce4db36722) revert test ### 📊 Changes **3 files changed** (+46 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `.githooks/pre-push` (+11 -0) 📝 `CONTRIBUTING.md` (+8 -0) ➕ `Makefile` (+27 -0) </details> ### 📄 Description Developers can now catch lint issues before pushing, reducing CI failures and iteration time. The setup uses golangci-lint locally with the same configuration as CI. Setup: - Run `make setup-hooks` once after cloning - Pre-push hook automatically lints changed files - Use `make lint` to manually check changed files - Use `make lint-all` to run full CI-equivalent lint The Makefile auto-installs golangci-lint to ./bin/ using go install to match the Go version in go.mod, avoiding version compatibility issues. ## Describe your changes ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [x] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Implemented automated code quality checks using Git hooks to ensure consistent code standards before pushing changes * Added linting configuration and streamlined development environment setup with automatic verification * **Documentation** * Updated contribution guide with instructions for setting up the local development environment with automatic code quality enforcement <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 05:08:43 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#21610