MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / parseLineColMessage

Function parseLineColMessage

src/tools/diagnostics/parsers.ts:110–128  ·  view source on GitHub ↗
(output: string, defaultSeverity: Severity = 'error')

Source from the content-addressed store, hash-verified

108
109/** `go vet` / generic compiler output: path/file.go:12:5: message (col optional). */
110export function parseLineColMessage(output: string, defaultSeverity: Severity = 'error'): Diagnostic[] {
111 const out: Diagnostic[] = [];
112 const withCol = /^(.+?):(\d+):(\d+):\s+(.*)$/;
113 const noCol = /^(.+?):(\d+):\s+(.*)$/;
114 for (const raw of output.split('\n')) {
115 const line = raw.trim();
116 if (!line || line.startsWith('#') || line.startsWith('vet:')) continue;
117 let m = withCol.exec(line);
118 if (m) {
119 out.push({ file: m[1]!, line: parseInt(m[2]!, 10), col: parseInt(m[3]!, 10), severity: defaultSeverity, message: m[4]!.trim() });
120 continue;
121 }
122 m = noCol.exec(line);
123 if (m) {
124 out.push({ file: m[1]!, line: parseInt(m[2]!, 10), severity: defaultSeverity, message: m[3]!.trim() });
125 }
126 }
127 return out;
128}
129
130/** Render diagnostics into a compact, model-friendly report grouped by file. */
131export function formatDiagnostics(diags: Diagnostic[], opts: { checker: string; maxResults: number }): string {

Callers 2

checkers.tsFile · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected