better recon info in certain (nested) situations
All checks were successful
port-to-omp / port (push) Successful in 6s

This commit is contained in:
2026-08-12 21:59:49 -04:00
parent 3fd386a637
commit 63c2f73a5e
7 changed files with 84 additions and 41 deletions

View File

@@ -41,14 +41,13 @@
* @module pygienium/checks/defensive-guards
*/
import { readdirSync } from "node:fs";
import { join } from "node:path";
import {
registerCheck,
type CheckDefinition,
type CheckScope,
} from "./registry.js";
import { isScopeSource, scopeRulesMarkdown } from "./scope.js";
import { hasScopeSources, scopeRulesMarkdown } from "./scope.js";
/** Output directory for this check's persistent reports. */
export function defensiveGuardsOutputDir(cwd: string): string {
@@ -70,23 +69,13 @@ export function changesPath(cwd: string): string {
* with zero source files gives the scanner nothing to analyse.
*/
function defensiveGuardsGate(cwd: string): string | undefined {
let found = false;
try {
const entries = readdirSync(cwd);
for (const entry of entries) {
if (isScopeSource(entry)) {
found = true;
break;
}
}
if (hasScopeSources(cwd)) return undefined;
} catch {
// unreadable cwd → let the agent decide; don't block.
return undefined;
}
if (!found) {
return "no source files found to inspect";
}
return undefined;
return "no source files found to inspect";
}
/**