Files
Jonathan Miller bd5f676e0a
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (push) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: moko-platform CI / CI Summary (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Platform: moko-platform CI / Gate 1: Code Quality (push) Has been cancelled
Merge remote-tracking branch 'origin/dev'
# Conflicts:
#	cli/manifest_licensing.php
2026-06-06 11:49:30 -05:00

60 lines
1.6 KiB
Bash

#!/bin/bash
echo "🔧 Setting up Git hooks for code quality..."
echo "=========================================="
echo ""
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not installed."
exit 1
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is required but not installed."
exit 1
fi
# Install pre-commit
echo "📦 Installing pre-commit..."
pip install pre-commit
# Install Node.js dev dependencies
echo "📦 Installing Node.js linting tools..."
npm install --save-dev eslint prettier
# Install Python linting tools
echo "📦 Installing Python linting tools..."
pip install black flake8 isort
# Install pre-commit hooks
echo "🔗 Installing git hooks..."
pre-commit install
# Create secrets baseline
echo "🔐 Creating secrets baseline..."
pip install detect-secrets
detect-secrets scan > .secrets.baseline
# Run hooks on all files (optional first run)
echo ""
echo "🧪 Testing hooks on existing files..."
pre-commit run --all-files || true
echo ""
echo "✅ Git hooks setup complete!"
echo ""
echo "The following checks will run before each commit:"
echo " ✓ JavaScript syntax checking"
echo " ✓ Python syntax checking"
echo " ✓ ESLint (JavaScript linting)"
echo " ✓ Black (Python formatting)"
echo " ✓ Flake8 (Python linting)"
echo " ✓ Prettier (code formatting)"
echo " ✓ Secret detection"
echo " ✓ Trailing whitespace removal"
echo " ✓ Large file prevention"
echo ""
echo "To skip hooks temporarily: git commit --no-verify"
echo "To run hooks manually: pre-commit run --all-files"