fix: pre-commit hooks for monorepo (golangci-lint cd, web deps, branch skip)
This commit is contained in:
@@ -13,15 +13,15 @@ repos:
|
||||
- id: no-commit-to-branch
|
||||
args: ['--branch', 'main']
|
||||
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v2.1.6
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
files: ^backend/
|
||||
args: ['--config', 'backend/.golangci.yml']
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
name: golangci-lint
|
||||
entry: bash -c 'cd backend && golangci-lint run --config .golangci.yml ./...'
|
||||
language: system
|
||||
files: ^backend/.*\.go$
|
||||
pass_filenames: false
|
||||
|
||||
- id: go-fmt
|
||||
name: go fmt
|
||||
entry: bash -c 'cd backend && gofmt -w .'
|
||||
|
||||
7
Justfile
7
Justfile
@@ -74,10 +74,11 @@ test: backend-test
|
||||
# Run all formatters
|
||||
fmt: backend-fmt web-fmt
|
||||
|
||||
# Install pre-commit hooks
|
||||
# Install pre-commit hooks and ensure web deps are present
|
||||
hooks-install:
|
||||
pre-commit install
|
||||
pnpm --dir web install --frozen-lockfile
|
||||
|
||||
# Run all pre-commit hooks against all files
|
||||
# Run all pre-commit hooks against all files (skips branch protection — use feature branches for commits)
|
||||
hooks-run:
|
||||
pre-commit run --all-files
|
||||
SKIP=no-commit-to-branch pre-commit run --all-files
|
||||
|
||||
Reference in New Issue
Block a user