POSA_Copyrighter/verify.ps1
changukyu bc14cd2177 chore: 단일 verify 게이트 신설 (pytest.ini + ruff.toml + verify.ps1)
린트와 테스트가 각각 수동 실행이었고, 어느 조합이 커밋 게이트인지 코드에
기록된 곳이 없었다. ruff 는 dev 의존성에도 없어 전역 환경에서만 돌고 있었다.

- verify.ps1: ruff -> pytest 순서로 도는 단일 명령. -SkipLint / -Coverage
- pytest.ini: testpaths, pythonpath(. src) 로 맨 pytest 도 동작, 300s 행 가드
- ruff.toml: py313 / line-length 120 / 기본 룰셋 명시 (ruff 업그레이드가
  게이트를 조용히 넓히거나 좁히지 못하게)
- requirements-dev.txt 에 ruff==0.12.0 핀

린트 18건 정리 (전부 무해하지만 게이트가 통과해야 하므로):
- env_clients.py / store_enrichment.py: logger 정의를 임포트 아래로 (E402 15건)
- test_sqlite_store.py: lambda 할당 -> def (E731 2건)
- test_store_workflow.py: 미사용 임포트 제거 (F401)
2026-08-08 09:47:57 +09:00

57 lines
1.4 KiB
PowerShell

<#
.SYNOPSIS
The single verification gate for POSA Copyrighter. Run this before commit,
before a delivery build, and from CI — same command, same result everywhere.
.DESCRIPTION
Runs, in order:
1. ruff — lint (config: ruff.toml)
2. pytest — full suite incl. operator-GUI E2E (config: pytest.ini)
Browser (Playwright) specs skip cleanly when Chromium is absent, so this
works on a host that has not run `playwright install chromium`.
.PARAMETER SkipLint
Run tests only. For a fast inner loop; the commit gate runs both.
.PARAMETER Coverage
Add a coverage report over src/.
.EXAMPLE
.\verify.ps1
.EXAMPLE
.\verify.ps1 -Coverage
#>
[CmdletBinding()]
param(
[switch]$SkipLint,
[switch]$Coverage
)
$ErrorActionPreference = 'Stop'
Set-Location -LiteralPath $PSScriptRoot
$failures = @()
if (-not $SkipLint) {
Write-Host "`n=== ruff check ===" -ForegroundColor Cyan
& python -m ruff check src tests
if ($LASTEXITCODE -ne 0) { $failures += 'ruff' }
}
Write-Host "`n=== pytest ===" -ForegroundColor Cyan
$pytestArgs = @()
if ($Coverage) {
$pytestArgs += @('--cov=src/rights_filter', '--cov-report=term-missing')
}
& python -m pytest @pytestArgs
if ($LASTEXITCODE -ne 0) { $failures += 'pytest' }
Write-Host ''
if ($failures.Count -gt 0) {
Write-Host "VERIFY FAILED: $($failures -join ', ')" -ForegroundColor Red
exit 1
}
Write-Host 'VERIFY OK' -ForegroundColor Green
exit 0