()
| 63 | import { checkRouteFilesHaveTests } from "./rules/testing/routes-require-test-sibling"; |
| 64 | import { checkSkippedTestsHaveTracking } from "./rules/testing/skipped-tests-need-tracking"; |
| 65 | import { checkTouchedTests } from "./rules/testing/touch-tests-too"; |
| 66 | |
| 67 | const ROOT = resolve(process.cwd()); |
| 68 | |
| 69 | async function main(): Promise<void> { |
| 70 | if (process.argv.includes("--list-rules")) { |
| 71 | printRuleCatalog(META_RULES); |
| 72 | |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | const verifyMode = process.argv.includes("--verify"); |
| 77 | const ctx = buildContext(ROOT); |
| 78 | const syncViolations = runMetaRules(META_RULES, ctx); |
| 79 | |
| 80 | if (verifyMode) { |
| 81 | console.log("[lint:meta] Verifying action SHAs against github.com…"); |
| 82 | } |
| 83 | |
| 84 | const violations = [ |
| 85 | ...syncViolations, |
| 86 | ...(verifyMode ? await runMetaRulesAsync(META_RULES, ctx) : []), |
| 87 | ]; |
| 88 | |
| 89 | if (violations.length === 0) { |
| 90 | console.log( |
| 91 | verifyMode |
| 92 | ? "[lint:meta] No violations. All action SHAs resolve." |
| 93 | : "[lint:meta] No violations." |
| 94 | ); |
| 95 | |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | console.error(`[lint:meta] ${String(violations.length)} violation(s):\n`); |
| 100 | |
| 101 | for (const v of violations) { |
| 102 | console.error(` ${v.file}`); |
| 103 | console.error(` ${v.rule}: ${v.message}\n`); |
| 104 | } |
| 105 | |
| 106 | process.exit(1); |
no test coverage detected