@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.
@@ -15,7 +15,7 @@ import {
15
15
  palette,
16
16
  registerAdapters,
17
17
  resolve
18
- } from "../chunk-74VJKZ7N.js";
18
+ } from "../chunk-K3UHYGVE.js";
19
19
  import {
20
20
  resolveContext
21
21
  } from "../chunk-HCKUWKF4.js";
@@ -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
- const family = familyOf(finding.metric);
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 version = report.settings.find((setting) => setting.key === "sentinel")?.value;
6061
- const present = new Set(report.rows.map((row) => row.metric));
6062
- const rows = FAMILIES.filter(
6063
- (family) => family.metrics.some((metric) => present.has(metric)) || places.has(family.label)
6064
- ).map((family) => {
6065
- const row = report.rows.find((candidate) => candidate.metric === family.headline);
6066
- const marker = row?.status === void 0 ? "" : ` (${row.status})`;
6067
- const shown = row?.unit.split(";")[0] ?? "";
6068
- const unit = shown === "" ? "" : `${shown.startsWith("%") ? "" : " "}${shown}`;
6069
- const value = row === void 0 ? "--" : `${figure(row)}${unit}${marker}`;
6070
- const label = helpFor(family.headline)?.label ?? family.label;
6071
- return `| ${label} | ${value} | ${places.get(family.label) ?? 0} |`;
6072
- });
6073
- const notes = report.notes.length === 0 ? "" : `
6074
- ${report.notes.map((note) => `- ${note.split(". ")[0] ?? note}`).join("\n")}
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
- // "in this family" and not "to look", because the count is the family's and the label on its
6080
- // left is one figure of it: 51 complexity places sit beside the worst function, not under it.
6081
- "| | Figure | Places in this family |",
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
- "> `(ok)` or `(exceed)` is where a figure sits against a PUBLISHED reference; a figure with no",
6087
- "> marker has none, which is a decision and not a gap. A file breaching several rules counts",
6088
- "> once per rule. The code behind every place is in the `static-analysis.html` artifact.",
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 summaryLine(report) {
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
- const parts = [
6287
- withReference.length === 0 ? "No figure here has a published reference" : `<b>${above} of ${withReference.length}</b> figures with a published reference are above it`,
6288
- `<b>${grouped(inProduct)}</b> places in product code`,
6289
- ...inTests === 0 ? [] : [`<b>${grouped(inTests)}</b> clones in tests`]
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
- return parts.join(" &middot; ");
6290
+ }
6291
+ function summaryLine(report) {
6292
+ return summaryParts(report, (text) => `<b>${text}</b>`).join(" &middot; ");
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
@@ -6,7 +6,7 @@ import {
6
6
  registerAdapters,
7
7
  resolve,
8
8
  setDefaultRunner
9
- } from "./chunk-74VJKZ7N.js";
9
+ } from "./chunk-K3UHYGVE.js";
10
10
  import {
11
11
  BaseAdapter
12
12
  } from "./chunk-HCKUWKF4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.5.0-alpha.29",
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",