@hublo/sentinel 1.5.0-alpha.29 → 1.5.0-alpha.30
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/bin/sentinel.js
CHANGED
|
@@ -6052,44 +6052,43 @@ function renderJson(report) {
|
|
|
6052
6052
|
`;
|
|
6053
6053
|
}
|
|
6054
6054
|
function renderMarkdown(report) {
|
|
6055
|
+
const version = report.settings.find((setting) => setting.key === "sentinel")?.value;
|
|
6055
6056
|
const places = /* @__PURE__ */ new Map();
|
|
6056
6057
|
for (const finding of report.findings) {
|
|
6057
|
-
|
|
6058
|
-
if (family !== void 0) places.set(family, (places.get(family) ?? 0) + 1);
|
|
6058
|
+
places.set(finding.metric, (places.get(finding.metric) ?? 0) + 1);
|
|
6059
6059
|
}
|
|
6060
|
-
const
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
const
|
|
6066
|
-
const
|
|
6067
|
-
const
|
|
6068
|
-
const
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6060
|
+
const figureLine = (row) => {
|
|
6061
|
+
const help = helpFor(row.metric);
|
|
6062
|
+
const label = help?.label ?? row.metric;
|
|
6063
|
+
const VERDICT = { ok: "ok", near: "near", exceed: "exceeds" };
|
|
6064
|
+
const mark = row.status === void 0 ? "" : ` **${VERDICT[row.status] ?? row.status}**`;
|
|
6065
|
+
const unit = row.unit === "" ? "" : `${row.unit.startsWith("%") ? "" : " "}${row.unit}`;
|
|
6066
|
+
const count = places.get(row.metric) ?? 0;
|
|
6067
|
+
const found = count === 0 ? "" : ` \xB7 ${count} ${count === 1 ? "place" : "places"}`;
|
|
6068
|
+
const line = `**${label}** \xB7 ${figure(row)}${mark}${unit}${found}`;
|
|
6069
|
+
return help?.fix === void 0 ? [line, ""] : [line, `> **What to do.** ${help.fix}`, ""];
|
|
6070
|
+
};
|
|
6071
|
+
const byLabel = byFamily(report.rows);
|
|
6072
|
+
const families = [
|
|
6073
|
+
...byLabel.filter((family) => family.label === "Bundle"),
|
|
6074
|
+
...byLabel.filter((family) => family.label !== "Bundle")
|
|
6075
|
+
].flatMap((family) => [`##### ${family.label}`, "", ...family.rows.flatMap(figureLine)]);
|
|
6076
|
+
const notes = report.notes.length === 0 ? [] : ["", ...report.notes.map((note) => `- ${note.split(". ")[0] ?? note}`)];
|
|
6076
6077
|
return [
|
|
6077
6078
|
`#### \`${report.module}\``,
|
|
6078
6079
|
"",
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
"
|
|
6082
|
-
|
|
6083
|
-
...rows,
|
|
6084
|
-
notes,
|
|
6080
|
+
summaryText(report),
|
|
6081
|
+
...notes,
|
|
6082
|
+
"",
|
|
6083
|
+
...families,
|
|
6085
6084
|
"> Measured on this branch and **not compared with `main`**. No figure here refuses anything.",
|
|
6086
|
-
">
|
|
6087
|
-
">
|
|
6088
|
-
"> once per rule. The code behind every place
|
|
6085
|
+
"> **ok**, **near** or **exceeds** is where a figure sits against a PUBLISHED reference; a",
|
|
6086
|
+
"> figure with no verdict has none, which is a decision and not a gap. A file breaching several",
|
|
6087
|
+
"> rules counts once per rule. The code behind every place, and the drawing of the import",
|
|
6088
|
+
"> graph, are in the `static-analysis.html` the artifact carries.",
|
|
6089
6089
|
// ⭐ The version that produced these numbers, because the thresholds a module cannot override
|
|
6090
6090
|
// live in the tool: nine gauge limits, the complexity bands, the bundle budgets. Two recaps
|
|
6091
6091
|
// from two versions are not comparable, and without this nothing on the comment would say so.
|
|
6092
|
-
// Read from the settings the report already carries rather than from the package a second time.
|
|
6093
6092
|
...version === void 0 ? [] : [`> Measured by sentinel ${version}.`],
|
|
6094
6093
|
""
|
|
6095
6094
|
].join("\n");
|
|
@@ -6277,18 +6276,23 @@ function grouped(count) {
|
|
|
6277
6276
|
if (!Number.isInteger(count)) return String(count);
|
|
6278
6277
|
return String(count).replace(/\B(?=(\d{3})+(?!\d))/g, "\u202F");
|
|
6279
6278
|
}
|
|
6280
|
-
function
|
|
6279
|
+
function summaryParts(report, bold) {
|
|
6281
6280
|
const withReference = report.rows.filter((row) => row.status !== void 0);
|
|
6282
6281
|
const above = withReference.filter((row) => row.status === "exceed").length;
|
|
6283
6282
|
const findings = report.findings ?? [];
|
|
6284
6283
|
const inTests = findings.filter((finding) => finding.metric === "clonesTests").length;
|
|
6285
6284
|
const inProduct = findings.length - inTests;
|
|
6286
|
-
|
|
6287
|
-
withReference.length === 0 ? "No figure here has a published reference" :
|
|
6288
|
-
|
|
6289
|
-
...inTests === 0 ? [] : [
|
|
6285
|
+
return [
|
|
6286
|
+
withReference.length === 0 ? "No figure here has a published reference" : `${bold(`${above} of ${withReference.length}`)} figures with a published reference are above it`,
|
|
6287
|
+
`${bold(grouped(inProduct))} places in product code`,
|
|
6288
|
+
...inTests === 0 ? [] : [`${bold(grouped(inTests))} clones in tests`]
|
|
6290
6289
|
];
|
|
6291
|
-
|
|
6290
|
+
}
|
|
6291
|
+
function summaryLine(report) {
|
|
6292
|
+
return summaryParts(report, (text) => `<b>${text}</b>`).join(" · ");
|
|
6293
|
+
}
|
|
6294
|
+
function summaryText(report) {
|
|
6295
|
+
return summaryParts(report, (text) => `**${text}**`).join(" \xB7 ");
|
|
6292
6296
|
}
|
|
6293
6297
|
function populationsLine(report) {
|
|
6294
6298
|
const of = (metric) => {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hublo/sentinel",
|
|
3
|
-
"version": "1.5.0-alpha.
|
|
3
|
+
"version": "1.5.0-alpha.30",
|
|
4
4
|
"description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|