feat: promote extensionless unresolved paths from silent skip to [UNRESOLVED]
Paths without file extensions that don't exist as files or directories are now flagged as [UNRESOLVED] — a distinct tag from [BROKEN] (which means a file with a known extension wasn't found). Both count toward the broken reference total and appear in CI annotations. This catches real bugs like wrong directory names in installed_path metadata and dead invoke-workflow references to removed workflows. Extensionless paths that DO exist as directories are still [OK-DIR].
This commit is contained in:
parent
3f5d059c42
commit
1ac25c2a7a
|
|
@ -444,11 +444,14 @@ if (require.main === module) {
|
|||
if (fs.existsSync(resolved)) {
|
||||
ok.push({ ref, tag: 'OK-DIR' });
|
||||
} else {
|
||||
ok.push({ ref, tag: 'SKIP', note: 'no extension, target not found' });
|
||||
// No extension and nothing exists — not a file, not a directory.
|
||||
// Flag as UNRESOLVED (distinct from BROKEN which means "file with extension not found").
|
||||
broken.push({ ref, resolved: path.relative(PROJECT_ROOT, resolved), kind: 'unresolved' });
|
||||
brokenRefs++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
broken.push({ ref, resolved: path.relative(PROJECT_ROOT, resolved) });
|
||||
broken.push({ ref, resolved: path.relative(PROJECT_ROOT, resolved), kind: 'broken' });
|
||||
brokenRefs++;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -476,14 +479,19 @@ if (require.main === module) {
|
|||
}
|
||||
}
|
||||
|
||||
for (const { ref, resolved } of broken) {
|
||||
for (const { ref, resolved, kind } of broken) {
|
||||
const location = ref.line ? `line ${ref.line}` : ref.key ? `key: ${ref.key}` : '';
|
||||
console.log(` [BROKEN] ${ref.raw}${location ? ` (${location})` : ''}`);
|
||||
console.log(` Target not found: ${resolved}`);
|
||||
allIssues.push({ file: relativePath, line: ref.line || 1, ref: ref.raw, issue: 'broken ref' });
|
||||
const tag = kind === 'unresolved' ? 'UNRESOLVED' : 'BROKEN';
|
||||
const detail = kind === 'unresolved' ? 'Not found as file or directory' : 'Target not found';
|
||||
const issueType = kind === 'unresolved' ? 'unresolved path' : 'broken ref';
|
||||
console.log(` [${tag}] ${ref.raw}${location ? ` (${location})` : ''}`);
|
||||
console.log(` ${detail}: ${resolved}`);
|
||||
allIssues.push({ file: relativePath, line: ref.line || 1, ref: ref.raw, issue: issueType });
|
||||
if (process.env.GITHUB_ACTIONS) {
|
||||
const line = ref.line || 1;
|
||||
console.log(`::warning file=${relativePath},line=${line}::${escapeAnnotation(`Broken reference: ${ref.raw} → ${resolved}`)}`);
|
||||
console.log(
|
||||
`::warning file=${relativePath},line=${line}::${escapeAnnotation(`${tag === 'UNRESOLVED' ? 'Unresolved path' : 'Broken reference'}: ${ref.raw} → ${resolved}`)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue