Validate all PowerShell project files
This commit is contained in:
parent
0ba08e53ec
commit
024d25d061
|
|
@ -9,7 +9,7 @@ import re
|
|||
import sys
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
POWERSHELL = sorted((*ROOT.glob("*.ps1"), *ROOT.glob("src/*.ps1"), *ROOT.glob("src/*.psm1")))
|
||||
POWERSHELL = sorted((*ROOT.rglob("*.ps1"), *ROOT.rglob("*.psm1")))
|
||||
|
||||
|
||||
def check_balanced(path: pathlib.Path) -> list[str]:
|
||||
|
|
@ -71,7 +71,7 @@ def main() -> int:
|
|||
for path in POWERSHELL:
|
||||
errors.extend(check_balanced(path))
|
||||
source = path.read_text(encoding="utf-8-sig")
|
||||
if path.name != "bootstrap.ps1" and "Set-StrictMode" not in source:
|
||||
if path.parent.name in {"src", "tools"} and "Set-StrictMode" not in source:
|
||||
errors.append(f"{path.relative_to(ROOT)}: missing Set-StrictMode")
|
||||
|
||||
for relative in ("schemas/profile.schema.json", "schemas/machine.schema.json"):
|
||||
|
|
|
|||
Loading…
Reference in New Issue