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

Function parseIssues

src/tools/ast/syntax-check.ts:157–171  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

155 if (!p) return null; // grammar unavailable → fail-open
156
157 const parseIssues = (text: string): SyntaxIssue[] | null => {
158 let tree: any = null;
159 try {
160 tree = p.parser.parse(text);
161 if (!tree?.rootNode) return null;
162 return findIssuesInTree(tree.rootNode as TSNodeLike, text);
163 } catch (e: any) {
164 // Fail-open (never block the write), but surface that the parser could
165 // not run so a silently-broken parser isn't mistaken for "clean file".
166 console.warn(`[syntax-check] parser could not run for ${absPath}; skipping syntax gate: ${e?.message ?? String(e)}`);
167 return null; // parser hiccup → fail-open
168 } finally {
169 try { tree?.delete?.(); } catch { /* wasm cleanup best-effort */ }
170 }
171 };
172
173 const after = parseIssues(afterContent);
174 if (after === null || after.length === 0) return null;

Callers 1

checkSyntaxForWriteFunction · 0.85

Calls 3

findIssuesInTreeFunction · 0.85
warnMethod · 0.80
deleteMethod · 0.80

Tested by

no test coverage detected