refactor: use python instead of javascript

This commit is contained in:
Bjarke Sporring
2026-01-05 12:21:48 +01:00
parent e1b8d8418a
commit f11f5a4646
14 changed files with 550 additions and 735 deletions

View File

@@ -66,21 +66,21 @@ if ($mainCommits -notmatch "security bug|Fix.*bug|security fix") {
exit 1
}
# Check that app.js has been fixed
if (-not (Test-Path "app.js")) {
Write-Host "[FAIL] app.js not found on main branch." -ForegroundColor Red
# Check that app.py has been fixed
if (-not (Test-Path "app.py")) {
Write-Host "[FAIL] app.py not found on main branch." -ForegroundColor Red
git checkout feature-login 2>$null | Out-Null
Set-Location ..
exit 1
}
$appContent = Get-Content "app.js" -Raw
$appContent = Get-Content "app.py" -Raw
# The bug was "return true" in authenticate - it should be fixed now
# We'll check that the buggy comment is gone or the implementation is improved
if ($appContent -match "allows unauthenticated access") {
Write-Host "[FAIL] The security bug comment still exists in app.js." -ForegroundColor Red
Write-Host "Hint: Remove the bug from app.js and commit the fix" -ForegroundColor Yellow
Write-Host "[FAIL] The security bug comment still exists in app.py." -ForegroundColor Red
Write-Host "Hint: Remove the bug from app.py and commit the fix" -ForegroundColor Yellow
git checkout feature-login 2>$null | Out-Null
Set-Location ..
exit 1
@@ -103,26 +103,26 @@ if ($commitCount -lt 3) {
exit 1
}
# Check that login.js exists
if (-not (Test-Path "login.js")) {
Write-Host "[FAIL] login.js not found on feature-login branch." -ForegroundColor Red
# Check that login.py exists
if (-not (Test-Path "login.py")) {
Write-Host "[FAIL] login.py not found on feature-login branch." -ForegroundColor Red
Set-Location ..
exit 1
}
$loginContent = Get-Content "login.js" -Raw
$loginContent = Get-Content "login.py" -Raw
# Check that login method exists and is implemented
if ($loginContent -notmatch "login\(username, password\)") {
Write-Host "[FAIL] login.js should have a login method." -ForegroundColor Red
Write-Host "[FAIL] login.py should have a login method." -ForegroundColor Red
Set-Location ..
exit 1
}
# Check that TODOs are completed (no TODO comments should remain)
if ($loginContent -match "TODO") {
Write-Host "[FAIL] login.js still contains TODO comments." -ForegroundColor Red
Write-Host "Hint: Complete all the TODOs in login.js before committing" -ForegroundColor Yellow
Write-Host "[FAIL] login.py still contains TODO comments." -ForegroundColor Red
Write-Host "Hint: Complete all the TODOs in login.py before committing" -ForegroundColor Yellow
Set-Location ..
exit 1
}
@@ -155,7 +155,7 @@ if ($stashCount -gt 0) {
# Verify the login implementation is complete
if ($loginContent -notmatch "logout|session") {
Write-Host "[PARTIAL] login.js is missing logout or session functionality." -ForegroundColor Yellow
Write-Host "[PARTIAL] login.py is missing logout or session functionality." -ForegroundColor Yellow
Write-Host "Consider adding logout method for a complete implementation" -ForegroundColor Yellow
# Don't fail - this is just a suggestion
}