MCPcopy Create free account
hub / github.com/microsoft/AI-Engineering-Coach / reportFirstDiff

Function reportFirstDiff

scripts/parse-parity.ts:104–122  ·  view source on GitHub ↗
(branchNdjson: string, mainNdjson: string)

Source from the content-addressed store, hash-verified

102}
103
104function reportFirstDiff(branchNdjson: string, mainNdjson: string): void {
105 const bl = fs.readFileSync(branchNdjson, 'utf8').split('\n');
106 const ml = fs.readFileSync(mainNdjson, 'utf8').split('\n');
107 const n = Math.max(bl.length, ml.length);
108 for (let i = 0; i < n; i++) {
109 if (bl[i] !== ml[i]) {
110 const cut = (s: string | undefined): string => (s === undefined ? '<missing>' : s.slice(0, 400));
111 // eslint-disable-next-line no-console
112 console.log(`\nFirst difference at line ${i + 1}:`);
113 // eslint-disable-next-line no-console
114 console.log(` branch: ${cut(bl[i])}`);
115 // eslint-disable-next-line no-console
116 console.log(` main: ${cut(ml[i])}`);
117 break;
118 }
119 }
120 // eslint-disable-next-line no-console
121 console.log(`\n(branch lines=${bl.length}, main lines=${ml.length})`);
122}
123
124async function run(): Promise<void> {
125 fs.mkdirSync(outDir, { recursive: true });

Callers 1

runFunction · 0.85

Calls 1

cutFunction · 0.85

Tested by

no test coverage detected