technical-debt-radar 1.13.0 → 1.14.0
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/dist/index.js +24 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21962,7 +21962,8 @@ var import_chalk4 = __toESM(require("chalk"));
|
|
|
21962
21962
|
var import_inquirer2 = __toESM(require("inquirer"));
|
|
21963
21963
|
var import_analyzers3 = __toESM(require_dist3());
|
|
21964
21964
|
function applyFix(filePath, fix) {
|
|
21965
|
-
const
|
|
21965
|
+
const fullPath = path5.isAbsolute(filePath) ? filePath : path5.resolve(filePath);
|
|
21966
|
+
const content = fsSync2.readFileSync(fullPath, "utf-8");
|
|
21966
21967
|
const lines = content.split("\n");
|
|
21967
21968
|
const fixedLines = fix.fixedCode.split("\n");
|
|
21968
21969
|
const start = fix.startLine - 1;
|
|
@@ -21982,7 +21983,7 @@ function applyFix(filePath, fix) {
|
|
|
21982
21983
|
}
|
|
21983
21984
|
}
|
|
21984
21985
|
}
|
|
21985
|
-
fsSync2.writeFileSync(
|
|
21986
|
+
fsSync2.writeFileSync(fullPath, lines.join("\n"), "utf-8");
|
|
21986
21987
|
}
|
|
21987
21988
|
async function runScan(targetPath, options) {
|
|
21988
21989
|
const { compiled: policy } = await loadPolicy(options.config, options.rules);
|
|
@@ -22329,6 +22330,27 @@ ${relativePath} (${fileViolations.length} violations)
|
|
|
22329
22330
|
if (options.dryRun) {
|
|
22330
22331
|
console.log(import_chalk4.default.dim(" [dry-run] Would apply this fix"));
|
|
22331
22332
|
totalSkipped += lineViolations.length;
|
|
22333
|
+
} else if ((applyAll || options.auto) && fix.multiFile && fix.filesToChange?.length) {
|
|
22334
|
+
console.log(import_chalk4.default.magenta(` Auto multi-file fix (${fix.filesToChange.length + 1} files)...`));
|
|
22335
|
+
try {
|
|
22336
|
+
await handleMultiFileFix(
|
|
22337
|
+
client,
|
|
22338
|
+
lineViolations[0],
|
|
22339
|
+
absPath,
|
|
22340
|
+
projectRoot,
|
|
22341
|
+
framework,
|
|
22342
|
+
scanResult.config?.architecture,
|
|
22343
|
+
fix.filesToChange,
|
|
22344
|
+
options
|
|
22345
|
+
);
|
|
22346
|
+
totalFixed += lineViolations.length;
|
|
22347
|
+
} catch (e) {
|
|
22348
|
+
console.log(import_chalk4.default.red(` Multi-file fix failed: ${e instanceof Error ? e.message : e}`));
|
|
22349
|
+
totalFailed += lineViolations.length;
|
|
22350
|
+
}
|
|
22351
|
+
fileContent = await fs5.readFile(absPath, "utf-8");
|
|
22352
|
+
lines = fileContent.split("\n");
|
|
22353
|
+
continue;
|
|
22332
22354
|
} else if (applyAll || options.auto) {
|
|
22333
22355
|
shouldApply = true;
|
|
22334
22356
|
if (!options.auto) console.log(import_chalk4.default.green(" Auto-applying (all)..."));
|