roast-my-codebase 1.3.1 → 1.3.2
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 +51 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8733,6 +8733,34 @@ function renderReport(report, options) {
|
|
|
8733
8733
|
` ${chalk4.cyan("Dev Dependencies")} ${report.stats.devDependencies}`
|
|
8734
8734
|
);
|
|
8735
8735
|
sections.push("");
|
|
8736
|
+
const FINDING_TO_ROAST_CATEGORY = {
|
|
8737
|
+
"unused-deps": "dependencies",
|
|
8738
|
+
"nextjs-metadata": "framework",
|
|
8739
|
+
"nextjs-client-server": "framework",
|
|
8740
|
+
"react-error-boundary": "framework",
|
|
8741
|
+
"secrets": "security",
|
|
8742
|
+
"env-in-git": "security",
|
|
8743
|
+
"eval-usage": "security",
|
|
8744
|
+
"npm-audit": "npm-audit",
|
|
8745
|
+
"dep-outdated": "dep-outdated",
|
|
8746
|
+
"ruby-style": "ruby-issues",
|
|
8747
|
+
"php-smell": "php-issues",
|
|
8748
|
+
"swift-async": "swift-issues",
|
|
8749
|
+
"kotlin-coroutine": "kotlin-issues",
|
|
8750
|
+
"db-n-plus-one": "database",
|
|
8751
|
+
"db-sql-injection": "database",
|
|
8752
|
+
"db-over-fetch": "database",
|
|
8753
|
+
"db-destructive": "database"
|
|
8754
|
+
};
|
|
8755
|
+
const roastByFile = /* @__PURE__ */ new Map();
|
|
8756
|
+
const roastByCategory = /* @__PURE__ */ new Map();
|
|
8757
|
+
for (const roast of report.roasts) {
|
|
8758
|
+
if (roast.target === "codebase") continue;
|
|
8759
|
+
roastByCategory.set(roast.category, roast.message);
|
|
8760
|
+
if (roast.target.includes("/") || roast.target.includes(".") && !roast.target.includes(" ")) {
|
|
8761
|
+
roastByFile.set(roast.target, roast.message);
|
|
8762
|
+
}
|
|
8763
|
+
}
|
|
8736
8764
|
const warnings = report.findings.filter((f) => f.severity === "warning");
|
|
8737
8765
|
const criticals = report.findings.filter((f) => f.severity === "critical");
|
|
8738
8766
|
const infos = report.findings.filter((f) => f.severity === "info");
|
|
@@ -8753,27 +8781,37 @@ function renderReport(report, options) {
|
|
|
8753
8781
|
sections.push(` ${chalk4.blue("\u25CF")} ${chalk4.blue(`${infos.length} info`)}`);
|
|
8754
8782
|
}
|
|
8755
8783
|
sections.push("");
|
|
8784
|
+
const shownRoastKeys = /* @__PURE__ */ new Set();
|
|
8756
8785
|
const keyFindings = [...criticals, ...warnings].slice(0, 8);
|
|
8757
8786
|
for (const finding of keyFindings) {
|
|
8758
8787
|
const icon = finding.severity === "critical" ? chalk4.red("\u2717") : chalk4.yellow("\u26A0");
|
|
8759
8788
|
sections.push(` ${icon} ${chalk4.white(finding.message)}`);
|
|
8789
|
+
let roastMsg;
|
|
8790
|
+
let roastKey;
|
|
8791
|
+
if (finding.file && roastByFile.has(finding.file)) {
|
|
8792
|
+
roastKey = `file:${finding.file}`;
|
|
8793
|
+
if (!shownRoastKeys.has(roastKey)) {
|
|
8794
|
+
roastMsg = roastByFile.get(finding.file);
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8797
|
+
if (!roastMsg) {
|
|
8798
|
+
const resolvedCategory = FINDING_TO_ROAST_CATEGORY[finding.category] ?? finding.category;
|
|
8799
|
+
roastKey = `cat:${resolvedCategory}`;
|
|
8800
|
+
if (!shownRoastKeys.has(roastKey)) {
|
|
8801
|
+
roastMsg = roastByCategory.get(resolvedCategory);
|
|
8802
|
+
}
|
|
8803
|
+
}
|
|
8804
|
+
if (roastMsg && roastKey) {
|
|
8805
|
+
sections.push(` ${chalk4.italic.dim(roastMsg)}`);
|
|
8806
|
+
shownRoastKeys.add(roastKey);
|
|
8807
|
+
}
|
|
8760
8808
|
}
|
|
8761
8809
|
sections.push("");
|
|
8762
8810
|
}
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
|
8767
|
-
borderStyle: "round",
|
|
8768
|
-
borderColor: "yellow"
|
|
8769
|
-
})
|
|
8770
|
-
);
|
|
8811
|
+
const comboRoast = report.roasts.find((r) => r.target === "codebase");
|
|
8812
|
+
if (comboRoast) {
|
|
8813
|
+
sections.push(chalk4.italic.yellow(` ${comboRoast.message}`));
|
|
8771
8814
|
sections.push("");
|
|
8772
|
-
for (const roast of report.roasts) {
|
|
8773
|
-
sections.push(` ${chalk4.bold.white(roast.target)}`);
|
|
8774
|
-
sections.push(` ${chalk4.yellow(roast.message)}`);
|
|
8775
|
-
sections.push("");
|
|
8776
|
-
}
|
|
8777
8815
|
}
|
|
8778
8816
|
if (report.fixes && report.fixes.length > 0) {
|
|
8779
8817
|
sections.push(
|
package/package.json
CHANGED