abapgit-agent 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/inspect.js +71 -1
- package/src/config.js +2 -0
package/package.json
CHANGED
package/src/commands/inspect.js
CHANGED
|
@@ -285,7 +285,7 @@ Examples:
|
|
|
285
285
|
process.exit(1);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
let filesSyntaxCheck = args[filesArgIndex + 1].split(',').map(f => f.trim());
|
|
289
289
|
|
|
290
290
|
// Parse optional --variant parameter; fall back to project config
|
|
291
291
|
const variantArgIndex = args.indexOf('--variant');
|
|
@@ -293,6 +293,31 @@ Examples:
|
|
|
293
293
|
const inspectConfig = getInspectConfig();
|
|
294
294
|
const variant = variantArg || inspectConfig.variant || null;
|
|
295
295
|
|
|
296
|
+
// Filter out files matching inspect.exclude patterns from project config
|
|
297
|
+
const excludePatterns = inspectConfig.exclude || [];
|
|
298
|
+
if (excludePatterns.length > 0) {
|
|
299
|
+
const before = filesSyntaxCheck.length;
|
|
300
|
+
filesSyntaxCheck = filesSyntaxCheck.filter(f => {
|
|
301
|
+
const objName = pathModule.basename(f).split('.')[0].toUpperCase();
|
|
302
|
+
return !excludePatterns.some(pattern => {
|
|
303
|
+
const re = new RegExp('^' + pattern.toUpperCase().replace(/\*/g, '.*') + '$');
|
|
304
|
+
return re.test(objName);
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
const skipped = before - filesSyntaxCheck.length;
|
|
308
|
+
if (skipped > 0 && !args.includes('--json')) {
|
|
309
|
+
console.log(` Skipped ${skipped} file(s) excluded by inspect config`);
|
|
310
|
+
}
|
|
311
|
+
if (filesSyntaxCheck.length === 0) {
|
|
312
|
+
if (args.includes('--json')) {
|
|
313
|
+
console.log(JSON.stringify([]));
|
|
314
|
+
} else {
|
|
315
|
+
console.log('\n All files excluded by inspect config — nothing to check.\n');
|
|
316
|
+
}
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
296
321
|
// Parse optional --junit-output parameter
|
|
297
322
|
const junitArgIndex = args.indexOf('--junit-output');
|
|
298
323
|
const junitOutput = junitArgIndex !== -1 ? args[junitArgIndex + 1] : null;
|
|
@@ -316,6 +341,51 @@ Examples:
|
|
|
316
341
|
// Send all files in one request
|
|
317
342
|
const results = await inspectAllFiles(filesSyntaxCheck, csrfToken, config, variant, http, verbose);
|
|
318
343
|
|
|
344
|
+
// Apply inspect.suppress rules — downgrade matching errors/warnings to infos
|
|
345
|
+
const suppressRules = inspectConfig.suppress || [];
|
|
346
|
+
if (suppressRules.length > 0) {
|
|
347
|
+
for (const result of results) {
|
|
348
|
+
const objName = (result.OBJECT_NAME || result.object_name || '').toUpperCase();
|
|
349
|
+
for (const rule of suppressRules) {
|
|
350
|
+
const objPattern = new RegExp('^' + (rule.object || '*').toUpperCase().replace(/\*/g, '.*') + '$');
|
|
351
|
+
if (!objPattern.test(objName)) continue;
|
|
352
|
+
const msgPattern = new RegExp((rule.message || '*').replace(/\*/g, '.*'), 'i');
|
|
353
|
+
|
|
354
|
+
// Downgrade matching errors → infos
|
|
355
|
+
const errors = result.ERRORS || result.errors || [];
|
|
356
|
+
const kept = [];
|
|
357
|
+
for (const err of errors) {
|
|
358
|
+
const text = err.TEXT || err.text || '';
|
|
359
|
+
if (msgPattern.test(text)) {
|
|
360
|
+
const infos = result.INFOS || result.infos || [];
|
|
361
|
+
infos.push({ ...err, MESSAGE: `[suppressed] ${text}`, message: `[suppressed] ${text}` });
|
|
362
|
+
if (result.INFOS !== undefined) result.INFOS = infos; else result.infos = infos;
|
|
363
|
+
const ec = result.ERROR_COUNT !== undefined ? 'ERROR_COUNT' : 'error_count';
|
|
364
|
+
result[ec] = Math.max(0, (result[ec] || 0) - 1);
|
|
365
|
+
} else {
|
|
366
|
+
kept.push(err);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (result.ERRORS !== undefined) result.ERRORS = kept; else result.errors = kept;
|
|
370
|
+
|
|
371
|
+
// Downgrade matching warnings → infos
|
|
372
|
+
const warnings = result.WARNINGS || result.warnings || [];
|
|
373
|
+
const keptW = [];
|
|
374
|
+
for (const warn of warnings) {
|
|
375
|
+
const text = warn.MESSAGE || warn.message || '';
|
|
376
|
+
if (msgPattern.test(text)) {
|
|
377
|
+
const infos = result.INFOS || result.infos || [];
|
|
378
|
+
infos.push({ ...warn, MESSAGE: `[suppressed] ${text}`, message: `[suppressed] ${text}` });
|
|
379
|
+
if (result.INFOS !== undefined) result.INFOS = infos; else result.infos = infos;
|
|
380
|
+
} else {
|
|
381
|
+
keptW.push(warn);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (result.WARNINGS !== undefined) result.WARNINGS = keptW; else result.warnings = keptW;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
319
389
|
// JUnit output mode — write XML file, then continue to normal output
|
|
320
390
|
if (junitOutput) {
|
|
321
391
|
const xml = buildInspectJUnit(results);
|
package/src/config.js
CHANGED
|
@@ -255,6 +255,8 @@ function getInspectConfig() {
|
|
|
255
255
|
const projectConfig = loadProjectConfig();
|
|
256
256
|
return {
|
|
257
257
|
variant: projectConfig?.inspect?.variant || null,
|
|
258
|
+
exclude: projectConfig?.inspect?.exclude || [],
|
|
259
|
+
suppress: projectConfig?.inspect?.suppress || [],
|
|
258
260
|
};
|
|
259
261
|
}
|
|
260
262
|
|