MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / formatValidationResult

Function formatValidationResult

lib/properties-validator.ts:659–693  ·  view source on GitHub ↗
(filename: string, result: RawFileValidationResult)

Source from the content-addressed store, hash-verified

657 * Format validation results for display.
658 */
659export function formatValidationResult(filename: string, result: RawFileValidationResult): string {
660 const lines: string[] = [];
661
662 const formatIssues = (name: string, issues: ValidationIssue[]) => {
663 if (issues.length === 0) return;
664 lines.push(`${name}:`);
665 for (const issue of issues.sort((a, b) => a.line - b.line)) {
666 lines.push(` Line ${issue.line}: ${issue.text}`);
667 }
668 };
669
670 lines.push(`## ${filename}`);
671 formatIssues('Duplicate keys', result.duplicateKeys);
672 formatIssues('Empty list elements', result.emptyListElements);
673 formatIssues('Typo compilers', result.typoCompilers);
674 formatIssues('Invalid property format', result.invalidPropertyFormat);
675 formatIssues('Suspicious paths', result.suspiciousPaths);
676 formatIssues('Duplicated compiler refs', result.duplicatedCompilerRefs);
677 formatIssues('Duplicated group refs', result.duplicatedGroupRefs);
678 formatIssues('Orphaned compiler .exe', result.orphanedCompilerExe);
679 formatIssues('Orphaned compiler ID', result.orphanedCompilerId);
680 formatIssues('Orphaned groups', result.orphanedGroups);
681 formatIssues('Orphaned formatter .exe', result.orphanedFormatterExe);
682 formatIssues('Orphaned formatter ID', result.orphanedFormatterId);
683 formatIssues('Orphaned tool .exe', result.orphanedToolExe);
684 formatIssues('Orphaned tool ID', result.orphanedToolId);
685 formatIssues('Orphaned lib IDs', result.orphanedLibIds);
686 formatIssues('Orphaned lib versions', result.orphanedLibVersions);
687 formatIssues('Invalid default compiler', result.invalidDefaultCompiler);
688 if (result.noCompilersList) {
689 lines.push('No compilers list: File defines compilers but has no compilers= or group definitions');
690 }
691
692 return lines.join('\n');
693}
694
695export interface CrossFileValidationResult {
696 duplicateCompilerIds: Map<string, Array<{filename: string; line: number}>>;

Callers

nothing calls this directly

Calls 2

formatIssuesFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected