repometry 0.9.0 → 0.10.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/README.md +1 -1
- package/package.json +1 -1
- package/target/main/resources/report/json/config-v1.schema.json +84 -2
- package/target/main/ts/api/cache/root.d.ts +3 -0
- package/target/main/ts/api/cache/root.js +21 -0
- package/target/main/ts/api/git/blob-batch.js +2 -1
- package/target/main/ts/api/git/blob-history.d.ts +20 -0
- package/target/main/ts/api/git/blob-history.js +54 -0
- package/target/main/ts/api/git/git-churn.js +38 -37
- package/target/main/ts/api/git/git-executable.d.ts +1 -0
- package/target/main/ts/api/git/git-executable.js +31 -0
- package/target/main/ts/api/git/git.d.ts +8 -1
- package/target/main/ts/api/git/git.js +58 -61
- package/target/main/ts/api/git/inspection-source.d.ts +2 -1
- package/target/main/ts/api/git/inspection-source.js +3 -2
- package/target/main/ts/api/git/local-sources.js +3 -2
- package/target/main/ts/api/git/source-cache.d.ts +0 -2
- package/target/main/ts/api/git/source-cache.js +1 -16
- package/target/main/ts/api/process/go-parser-cache.d.ts +1 -0
- package/target/main/ts/api/process/go-parser-cache.js +71 -0
- package/target/main/ts/api/process/go-parser-files.d.ts +5 -0
- package/target/main/ts/api/process/go-parser-files.js +65 -0
- package/target/main/ts/api/process/host-language-runner.d.ts +3 -5
- package/target/main/ts/api/process/host-language-runner.js +21 -66
- package/target/main/ts/api/process/host-tool.d.ts +22 -0
- package/target/main/ts/api/process/host-tool.js +87 -0
- package/target/main/ts/cli/config.d.ts +13 -0
- package/target/main/ts/cli/config.js +7 -4
- package/target/main/ts/cli/main.js +24 -81
- package/target/main/ts/cli/range-inspection.d.ts +28 -0
- package/target/main/ts/cli/range-inspection.js +41 -0
- package/target/main/ts/cli/range-jobs.d.ts +22 -0
- package/target/main/ts/cli/range-jobs.js +152 -0
- package/target/main/ts/cli/range-worker.d.ts +1 -0
- package/target/main/ts/cli/range-worker.js +36 -0
- package/target/main/ts/compose/analysis-report.js +4 -3
- package/target/main/ts/compose/diff-coverage.js +1 -1
- package/target/main/ts/compose/history-cache.d.ts +2 -0
- package/target/main/ts/compose/history-cache.js +2 -0
- package/target/main/ts/compose/inspect.js +3 -3
- package/target/main/ts/compose/native-language-plugins.js +7 -6
- package/target/main/ts/compose/review.js +3 -1
- package/target/main/ts/report/json/projections/commit-summary.js +5 -7
- package/target/main/ts/report/json/projections/metric-values.d.ts +5 -0
- package/target/main/ts/report/json/projections/metric-values.js +9 -6
- package/target/main/ts/report/markdown/pull-review.js +11 -1
|
@@ -22,15 +22,12 @@ export function metricProjection(report) {
|
|
|
22
22
|
rows.set(id, [row]);
|
|
23
23
|
}
|
|
24
24
|
const unavailable = new Map();
|
|
25
|
-
for (const
|
|
26
|
-
for (const
|
|
27
|
-
const id = structureMetricIds[measure];
|
|
28
|
-
if (id === undefined)
|
|
29
|
-
continue;
|
|
25
|
+
for (const file of metadata.inventory ?? []) {
|
|
26
|
+
for (const id of unavailableStructureMetrics(file)) {
|
|
30
27
|
let files = unavailable.get(id);
|
|
31
28
|
if (!files)
|
|
32
29
|
unavailable.set(id, files = new Set());
|
|
33
|
-
files.add(path);
|
|
30
|
+
files.add(file.path);
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
function isAvailable(id, path, directory = false) {
|
|
@@ -72,6 +69,12 @@ export function metricProjection(report) {
|
|
|
72
69
|
const privateMetrics = metadata.privateMetrics?.map(canonicalMetricId).filter(id => measured.has(id));
|
|
73
70
|
return { catalog: metrics, privateMetrics: privateMetrics?.length ? privateMetrics : undefined, values, isAvailable };
|
|
74
71
|
}
|
|
72
|
+
export function unavailableStructureMetrics({ analysed, unmeasured = [] }) {
|
|
73
|
+
const metrics = unmeasured.flatMap(measure => structureMetricIds[measure] ?? []);
|
|
74
|
+
if (!analysed && unmeasured.length)
|
|
75
|
+
metrics.push(definitions.lines);
|
|
76
|
+
return metrics;
|
|
77
|
+
}
|
|
75
78
|
export function canonicalMetricDescriptor(metric) {
|
|
76
79
|
const id = canonicalMetricId(metric.id);
|
|
77
80
|
if (!metric.ratio)
|
|
@@ -2,6 +2,7 @@ import { annotationLimit } from '../../core/model/pull-review.js';
|
|
|
2
2
|
/** The first line of every review comment, which finds the comment to update. */
|
|
3
3
|
export const reviewMarker = '<!-- repometry-review -->';
|
|
4
4
|
const maxLength = 60_000;
|
|
5
|
+
const assets = 'https://raw.githubusercontent.com/idleware/repometry/master/.github/assets';
|
|
5
6
|
const groups = [
|
|
6
7
|
{ effect: 'new', title: 'New', folded: false }, { effect: 'worsened', title: 'Worsened', folded: false },
|
|
7
8
|
{ effect: 'improved', title: 'Improved', folded: true }, { effect: 'touched', title: 'Touched', folded: true },
|
|
@@ -9,7 +10,7 @@ const groups = [
|
|
|
9
10
|
const verdicts = { passed: 'Passed', failed: 'Failed', unmeasured: 'Not measured' };
|
|
10
11
|
/** The review as Markdown: the run summary and the pull request comment carry the same text. */
|
|
11
12
|
export function pullReviewMarkdown(review) {
|
|
12
|
-
const head = [reviewMarker, `##
|
|
13
|
+
const head = [reviewMarker, `## ${review.verdict === 'unmeasured' ? '' : `${flag(review.verdict)} `}repometry`, '', headline(review), '',
|
|
13
14
|
...facts(review).map(line => `- ${line}`), ''];
|
|
14
15
|
const annotated = review.issues.filter(issue => issue.effect === 'new' || issue.effect === 'worsened').length;
|
|
15
16
|
const ranges = review.coverage.uncovered.length;
|
|
@@ -53,6 +54,15 @@ function fitTable({ title, folded, heads, rows }, budget) {
|
|
|
53
54
|
const cut = rows.length - kept.length;
|
|
54
55
|
return kept.length ? { lines: [...header, ...kept, ...closing], length, cut } : { lines: [], length: 0, cut };
|
|
55
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The verdict flag that, with the name, forms the logo. Comments load it from master, so these paths must never change.
|
|
59
|
+
* It is cropped to its ink: at 17 px it stands on the heading's baseline at cap height.
|
|
60
|
+
*/
|
|
61
|
+
function flag(verdict) {
|
|
62
|
+
const asset = (theme) => `${assets}/flag-${verdict}-${theme}.svg`;
|
|
63
|
+
return `<picture><source media="(prefers-color-scheme: dark)" srcset="${asset('dark')}">`
|
|
64
|
+
+ `<img src="${asset('light')}" alt="" width="17" height="17"></picture>`;
|
|
65
|
+
}
|
|
56
66
|
function headline({ verdict, issues, base, mergeBase, head, changedFiles }) {
|
|
57
67
|
const counts = groups.map(({ effect }) => [effect, issues.filter(issue => issue.effect === effect).length])
|
|
58
68
|
.filter(([, count]) => count > 0).map(([effect, count]) => `${count} ${effect}`);
|