-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit-hook.ps1
More file actions
31 lines (26 loc) · 1.17 KB
/
pre-commit-hook.ps1
File metadata and controls
31 lines (26 loc) · 1.17 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
# Pre-commit hook for Windows PowerShell
# 사용법: .git\hooks\pre-commit.ps1 에 복사
Write-Host "🔍 Running pre-commit checks..." -ForegroundColor Cyan
# 1. Kotlin 컴파일 체크
Write-Host "📦 Compiling Kotlin..." -ForegroundColor Yellow
& .\gradlew.bat compileKotlin compileTestKotlin --no-daemon --console=plain
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Compilation failed! Please fix errors before committing." -ForegroundColor Red
exit 1
}
# 2. Detekt 정적 분석
Write-Host "🔎 Running Detekt..." -ForegroundColor Yellow
& .\gradlew.bat detekt --no-daemon --console=plain
if ($LASTEXITCODE -ne 0) {
Write-Host "⚠️ Detekt found issues. Check the report at build/reports/detekt/detekt.html" -ForegroundColor Yellow
# Warning only, not blocking
}
# 3. 테스트 실행 (빠른 테스트만)
Write-Host "🧪 Running quick tests..." -ForegroundColor Yellow
& .\gradlew.bat test --tests "*Unit*" --no-daemon --console=plain
if ($LASTEXITCODE -ne 0) {
Write-Host "⚠️ Some tests failed. Consider fixing them." -ForegroundColor Yellow
# Warning only, not blocking
}
Write-Host "✅ Pre-commit checks passed!" -ForegroundColor Green
exit 0