$ErrorActionPreference = "Stop"
$extensions = @(".rs", ".md", ".toml", ".yml", ".yaml", ".ps1")
$failed = @()
git ls-files | ForEach-Object {
if ($extensions -contains [IO.Path]::GetExtension($_)) {
$count = (Get-Content -LiteralPath $_).Count
if ($count -gt 300) {
$failed += "$_ ($count lines)"
}
}
}
if ($failed.Count -gt 0) {
throw "Files exceed 300 lines: $($failed -join ', ')"
}