Repository navigation
Pre Commit Quality Gate
Josemalyson Oliveira edited this page Jun 27, 2026
·
1 revision
Auto-generated 14-step pre-commit pipelines for any tech stack.
Shift-left quality gate that fingerprints a project's stack and generates a fail-fast pipeline with 14 ordered steps (cheap to expensive).
- Setting up pre-commit hooks
- Enforcing code quality
- Automating code review
- Standardizing workflows
- "Set up pre-commit hooks"
- "Add quality gate"
- "Enforce code standards"
- "Automate code review"
Scan working directory for:
- Manifests (go.mod, package.json, pom.xml, pyproject.toml)
- Configs (tsconfig.json, .eslintrc, etc.)
- Conventions (existing hooks, CI pipelines)
- Lock files (go.sum, package-lock.json)
Match language-specific tool mappings:
-
go.md— Go tools -
python.md— Python tools -
nodejs.md— Node.js tools -
java.md— Java tools
Fill template.sh with concrete tools from fingerprint + reference.
# Create hooks directory
mkdir -p .githooks
# Make executable
chmod +x .githooks/pre-commit
# Set git hooks path
git config core.hooksPath .githooks
# Dry run
.git/hooks/pre-commit --dry-run| # | Category | Purpose | Mode |
|---|---|---|---|
| -1 | Secret scanner | Gitleaks — credential leak prevention | fail |
| 0 | Branch name | Git Flow / trunk-based validation | fail |
| 1 | Formatter | Style normalization (gofmt, ruff, prettier) | fail |
| 2 | Linter | Static quality (golangci-lint, ruff, eslint) | fail |
| 3 | Security scan | Dependency vulnerabilities | fail |
| 4 | Dead code | Unreachable code detection | fail |
| 5 | Modernizer | Modern idioms (report-only) | warn |
| 6 | Convention guards | Team architectural rules | fail |
| 7 | Module hygiene | Lock files and manifest integrity | fail |
| 8 | Tests + coverage | Unit suite + threshold (90% default) | fail |
| 9 | Race/concurrency | Data races, async bugs | fail |
| 10 | Integration tests | End-to-end flows | fail |
| 11 | Mutation tests | Test suite quality | fail |
| 12 | Performance tests | Latency/throughput | fail |
| 13 | Schema pipeline | Stub regeneration | fail |
| 14 | Build validation | Production Dockerfile (OFF by default) | fail |
| Category | Tool |
|---|---|
| Formatter | gofmt |
| Linter | golangci-lint |
| Security | govulncheck |
| Dead code | deadcode |
| Modernizer | modernize |
| Tests | go test |
| Race | go test -race |
| Performance | k6 |
| Category | Tool |
|---|---|
| Formatter | ruff format |
| Linter | ruff + mypy |
| Security | bandit + safety |
| Dead code | vulture |
| Modernizer | pyupgrade |
| Tests | pytest |
| Mutation | mutmut |
| Performance | locust |
| Category | Tool |
|---|---|
| Formatter | prettier |
| Linter | eslint + tsc |
| Security | npm audit |
| Dead code | knip |
| Modernizer | -- |
| Tests | jest/vitest |
| Mutation | stryker |
| Performance | k6 |
| Category | Tool |
|---|---|
| Formatter | google-java-format/spotless |
| Linter | checkstyle |
| Security | OWASP dependency-check |
| Dead code | spotbugs |
| Modernizer | -- |
| Tests | JaCoCo |
| Mutation | pitest |
| Performance | gatling |
# Skip specific steps
SKIP=5,11 git commit -m "feat: add feature"
# Skip all tests
SKIP=8,9,10 git commit -m "wip: work in progress"# Coverage threshold
export COVERAGE_THRESHOLD=80
# Mutation score threshold
export MUTATION_THRESHOLD=70Edit pre-commit-quality-gate-doc.md to add custom rules:
# Step 6: Convention guards
echo "Checking architectural rules..."
if ! grep -r "TODO" src/; then
echo "❌ Found TODO comments"
exit 1
fiEdit template.sh to reorder steps based on your needs.
- Pre-Commit-Go — Go tool mappings
- Pre-Commit-Python — Python tool mappings
- Pre-Commit-Nodejs — Node.js tool mappings
- Pre-Commit-Java — Java tool mappings
- Pre-Commit-Template — Pipeline template
- Pre-Commit-Documentation — Detailed documentation
Last updated: June 2026