test(M00): 增加状态文档门禁
This commit is contained in:
@@ -23,6 +23,7 @@ $requiredPaths = @(
|
||||
"scripts/dev/windows/check-large-files.ps1",
|
||||
"scripts/dev/windows/check-line-endings.ps1",
|
||||
"scripts/dev/windows/check-release-manifest.ps1",
|
||||
"scripts/dev/windows/check-status-docs.ps1",
|
||||
"scripts/dev/wsl/check-env.sh",
|
||||
"scripts/dev/wsl/check-emqx.sh",
|
||||
"scripts/dev/wsl/start-emqx.sh",
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$allowedStatuses = @(
|
||||
"TODO",
|
||||
"DOING",
|
||||
"PARTIAL",
|
||||
"BLOCKED_INTERNAL",
|
||||
"BLOCKED_EXTERNAL",
|
||||
"DONE"
|
||||
)
|
||||
$statusHeader = [regex]::Unescape("\u72b6\u6001")
|
||||
|
||||
$statusDocs = @(
|
||||
"docs/module-status.md",
|
||||
"docs/feature-status.md",
|
||||
"docs/deployment-status.md",
|
||||
"docs/repository-completeness.md",
|
||||
"docs/release-manifest.md",
|
||||
"docs/workspace-status.md",
|
||||
"docs/current-baseline.md"
|
||||
)
|
||||
|
||||
$forbiddenPlaceholders = @(
|
||||
[regex]::Unescape("\u672c\u5730 HEAD"),
|
||||
[regex]::Unescape("push \u540e\u56de\u586b"),
|
||||
[regex]::Unescape("\u5f85\u63a8\u9001\u540e\u56de\u586b"),
|
||||
[regex]::Unescape("\u5f85\u63a8\u9001\u540e\u8fdc\u7aef\u6821\u9a8c")
|
||||
)
|
||||
|
||||
foreach ($path in $statusDocs) {
|
||||
if (-not (Test-Path $path)) {
|
||||
throw "Required status document missing: $path"
|
||||
}
|
||||
|
||||
$content = Get-Content -Raw -Encoding UTF8 $path
|
||||
foreach ($placeholder in $forbiddenPlaceholders) {
|
||||
if ($content.Contains($placeholder)) {
|
||||
throw "Status document contains temporary placeholder '$placeholder': $path"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$featureLines = Get-Content -Encoding UTF8 "docs/feature-status.md" | Where-Object {
|
||||
$_.StartsWith("|") -and
|
||||
-not $_.StartsWith("|---") -and
|
||||
-not $_.StartsWith("| ID ")
|
||||
}
|
||||
|
||||
foreach ($line in $featureLines) {
|
||||
$columns = $line.Trim("|").Split("|") | ForEach-Object { $_.Trim() }
|
||||
if ($columns.Count -lt 4) {
|
||||
throw "Malformed feature status row: $line"
|
||||
}
|
||||
|
||||
$status = $columns[3]
|
||||
if ($allowedStatuses -notcontains $status) {
|
||||
throw "Invalid feature status '$status' in row: $line"
|
||||
}
|
||||
}
|
||||
|
||||
$moduleLines = Get-Content -Encoding UTF8 "docs/module-status.md" | Where-Object {
|
||||
$_.StartsWith("|") -and
|
||||
-not $_.StartsWith("|---")
|
||||
}
|
||||
|
||||
foreach ($line in $moduleLines) {
|
||||
$columns = $line.Trim("|").Split("|") | ForEach-Object { $_.Trim() }
|
||||
if ($columns.Count -lt 2) {
|
||||
throw "Malformed module status row: $line"
|
||||
}
|
||||
|
||||
$status = $columns[1]
|
||||
if ($status -eq $statusHeader) {
|
||||
continue
|
||||
}
|
||||
|
||||
if ($allowedStatuses -notcontains $status) {
|
||||
throw "Invalid module status '$status' in row: $line"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "PASS: status documents use stable placeholders and allowed status values."
|
||||
@@ -6,6 +6,7 @@ $ErrorActionPreference = "Stop"
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-large-files.ps1
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-repo-completeness.ps1
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-release-manifest.ps1
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-status-docs.ps1
|
||||
|
||||
if (Test-Path "package.json") {
|
||||
npm run lint --if-present
|
||||
|
||||
Reference in New Issue
Block a user