-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-pre-commit.sh
More file actions
executable file
·72 lines (60 loc) · 1.56 KB
/
setup-pre-commit.sh
File metadata and controls
executable file
·72 lines (60 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Setup script for pre-commit hooks
set -e
echo "=========================================="
echo "Setting up pre-commit hooks"
echo "=========================================="
echo
# Check if venv exists
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
fi
# Activate venv
source venv/bin/activate
# Install dependencies
echo "Installing dependencies..."
pip install -q --upgrade pip
pip install -q homeassistant aiohttp voluptuous pillow numpy
# Install pre-commit
echo "Installing pre-commit..."
pip install -q pre-commit
# Install git hooks
echo "Installing git hooks..."
pre-commit install
# Run tests once to verify
echo
echo "=========================================="
echo "Running initial tests..."
echo "=========================================="
echo
echo "Test 1: Integration tests"
python test_integration.py
echo
echo "Test 2: API flow tests"
python test_api_flow.py
echo
echo "Test 3: Frontend validation"
python test_frontend.py
echo
echo "=========================================="
echo "✅ Pre-commit setup complete!"
echo "=========================================="
echo
echo "Hooks installed:"
echo " - Black (code formatting)"
echo " - isort (import sorting)"
echo " - flake8 (linting)"
echo " - Integration tests"
echo " - API flow tests"
echo " - Frontend validation"
echo " - File checks"
echo
echo "These will run automatically on every commit."
echo
echo "To run manually:"
echo " pre-commit run --all-files"
echo
echo "To skip hooks (not recommended):"
echo " git commit --no-verify"
echo