repometry 0.4.2 → 0.5.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.
Files changed (188) hide show
  1. package/README.md +4 -0
  2. package/package.json +1 -1
  3. package/target/main/resources/report/json/report-v2.schema.json +13 -1
  4. package/target/main/resources/viewer/styles.css +2 -2
  5. package/target/main/ts/api/git/git.d.ts +1 -0
  6. package/target/main/ts/api/git/git.js +12 -0
  7. package/target/main/ts/api/git/inspection-source.js +2 -8
  8. package/target/main/ts/api/git/local.d.ts +1 -1
  9. package/target/main/ts/api/git/local.js +39 -5
  10. package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
  11. package/target/main/ts/api/process/docker-tool-runner.js +108 -0
  12. package/target/main/ts/api/process/failure.d.ts +1 -0
  13. package/target/main/ts/api/process/failure.js +12 -0
  14. package/target/main/ts/api/process/plugin.d.ts +10 -0
  15. package/target/main/ts/api/process/plugin.js +96 -0
  16. package/target/main/ts/compose/analyze-snapshot.d.ts +3 -2
  17. package/target/main/ts/compose/analyze-snapshot.js +82 -29
  18. package/target/main/ts/compose/inspect.d.ts +5 -0
  19. package/target/main/ts/compose/inspect.js +10 -6
  20. package/target/main/ts/core/engine/execute.d.ts +3 -1
  21. package/target/main/ts/core/engine/execute.js +14 -2
  22. package/target/main/ts/core/engine/operation-cache.d.ts +14 -0
  23. package/target/main/ts/core/engine/operation-cache.js +66 -0
  24. package/target/main/ts/core/engine/plan.d.ts +1 -0
  25. package/target/main/ts/core/engine/plan.js +22 -3
  26. package/target/main/ts/core/engine/plugin.d.ts +8 -1
  27. package/target/main/ts/core/engine/plugin.js +1 -3
  28. package/target/main/ts/core/engine/report-products.js +2 -13
  29. package/target/main/ts/core/model/clone-source.js +1 -1
  30. package/target/main/ts/core/model/code-structure.d.ts +3 -0
  31. package/target/main/ts/core/model/code-structure.js +4 -1
  32. package/target/main/ts/core/model/finding-ignore.js +1 -1
  33. package/target/main/ts/core/model/finding.js +1 -1
  34. package/target/main/ts/core/model/line-coverage.d.ts +5 -1
  35. package/target/main/ts/core/model/line-coverage.js +14 -11
  36. package/target/main/ts/core/model/measurement.js +1 -1
  37. package/target/main/ts/core/model/plugin-data.d.ts +2 -0
  38. package/target/main/ts/core/model/plugin-data.js +15 -1
  39. package/target/main/ts/core/model/quality-summary.js +1 -1
  40. package/target/main/ts/core/model/scanner-import.js +1 -1
  41. package/target/main/ts/core/model/snapshot.d.ts +1 -0
  42. package/target/main/ts/core/model/snapshot.js +5 -1
  43. package/target/main/ts/core/model/source.d.ts +3 -0
  44. package/target/main/ts/core/model/source.js +15 -0
  45. package/target/main/ts/core/ports/tool-runner.d.ts +18 -0
  46. package/target/main/ts/core/ports/tool-runner.js +2 -0
  47. package/target/main/ts/plugin.d.ts +7 -1
  48. package/target/main/ts/plugin.js +3 -1
  49. package/target/main/ts/plugins/coverage/coverage.d.ts +5 -2
  50. package/target/main/ts/plugins/coverage/coverage.js +35 -10
  51. package/target/main/ts/plugins/language-js/function-facts.d.ts +1 -0
  52. package/target/main/ts/plugins/language-js/function-facts.js +30 -4
  53. package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +11 -0
  54. package/target/main/ts/report/html/app/viewer-chart-bars.js +54 -0
  55. package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
  56. package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
  57. package/target/main/ts/report/html/app/viewer-chart-line.d.ts +24 -0
  58. package/target/main/ts/report/html/app/viewer-chart-line.js +89 -0
  59. package/target/main/ts/report/html/app/viewer-chart-points.d.ts +49 -0
  60. package/target/main/ts/report/html/app/viewer-chart-points.js +74 -0
  61. package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
  62. package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
  63. package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
  64. package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
  65. package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
  66. package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
  67. package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
  68. package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
  69. package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
  70. package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
  71. package/target/main/ts/report/html/app/viewer-chart.d.ts +4 -98
  72. package/target/main/ts/report/html/app/viewer-chart.js +16 -677
  73. package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
  74. package/target/main/ts/report/html/app/viewer-code-map.js +175 -0
  75. package/target/main/ts/report/html/app/viewer-columns.d.ts +38 -0
  76. package/target/main/ts/report/html/app/viewer-columns.js +92 -0
  77. package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
  78. package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
  79. package/target/main/ts/report/html/app/viewer-commits.d.ts +5 -9
  80. package/target/main/ts/report/html/app/viewer-commits.js +17 -216
  81. package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
  82. package/target/main/ts/report/html/app/viewer-controls.js +141 -0
  83. package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
  84. package/target/main/ts/report/html/app/viewer-copy.js +64 -0
  85. package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
  86. package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
  87. package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
  88. package/target/main/ts/report/html/app/viewer-dom.js +99 -0
  89. package/target/main/ts/report/html/app/viewer-file-aside.d.ts +19 -0
  90. package/target/main/ts/report/html/app/viewer-file-aside.js +124 -0
  91. package/target/main/ts/report/html/app/viewer-file-figures.d.ts +15 -0
  92. package/target/main/ts/report/html/app/viewer-file-figures.js +60 -0
  93. package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
  94. package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
  95. package/target/main/ts/report/html/app/viewer-files.d.ts +2 -118
  96. package/target/main/ts/report/html/app/viewer-files.js +24 -2184
  97. package/target/main/ts/report/html/app/viewer-filter.d.ts +3 -51
  98. package/target/main/ts/report/html/app/viewer-filter.js +111 -450
  99. package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
  100. package/target/main/ts/report/html/app/viewer-hotspots.js +131 -0
  101. package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
  102. package/target/main/ts/report/html/app/viewer-inspection.js +36 -0
  103. package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
  104. package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
  105. package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
  106. package/target/main/ts/report/html/app/viewer-issues.js +173 -0
  107. package/target/main/ts/report/html/app/viewer-language-bar.d.ts +9 -0
  108. package/target/main/ts/report/html/app/viewer-language-bar.js +72 -0
  109. package/target/main/ts/report/html/app/viewer-languages.d.ts +27 -0
  110. package/target/main/ts/report/html/app/viewer-languages.js +93 -0
  111. package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
  112. package/target/main/ts/report/html/app/viewer-layout.js +134 -0
  113. package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
  114. package/target/main/ts/report/html/app/viewer-line-coverage.js +121 -0
  115. package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
  116. package/target/main/ts/report/html/app/viewer-locations.js +31 -0
  117. package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
  118. package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
  119. package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
  120. package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
  121. package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
  122. package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
  123. package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +0 -20
  124. package/target/main/ts/report/html/app/viewer-metric-registry.js +0 -77
  125. package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
  126. package/target/main/ts/report/html/app/viewer-metrics-view.js +162 -0
  127. package/target/main/ts/report/html/app/viewer-metrics.d.ts +6 -1
  128. package/target/main/ts/report/html/app/viewer-metrics.js +53 -35
  129. package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
  130. package/target/main/ts/report/html/app/viewer-overview-cards.js +112 -0
  131. package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
  132. package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
  133. package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
  134. package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
  135. package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
  136. package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
  137. package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
  138. package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
  139. package/target/main/ts/report/html/app/viewer-profile.d.ts +2 -6
  140. package/target/main/ts/report/html/app/viewer-profile.js +6 -248
  141. package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
  142. package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
  143. package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
  144. package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
  145. package/target/main/ts/report/html/app/viewer-pulls.d.ts +0 -1
  146. package/target/main/ts/report/html/app/viewer-pulls.js +28 -178
  147. package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
  148. package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
  149. package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
  150. package/target/main/ts/report/html/app/viewer-route.js +55 -0
  151. package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
  152. package/target/main/ts/report/html/app/viewer-shell.js +116 -0
  153. package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
  154. package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
  155. package/target/main/ts/report/html/app/viewer-source.d.ts +0 -84
  156. package/target/main/ts/report/html/app/viewer-source.js +7 -365
  157. package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
  158. package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
  159. package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
  160. package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
  161. package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
  162. package/target/main/ts/report/html/app/viewer-table-cells.js +129 -0
  163. package/target/main/ts/report/html/app/viewer-table-rows.d.ts +54 -0
  164. package/target/main/ts/report/html/app/viewer-table-rows.js +95 -0
  165. package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +16 -0
  166. package/target/main/ts/report/html/app/viewer-tokenizer.js +192 -0
  167. package/target/main/ts/report/html/app/viewer-totals.d.ts +14 -0
  168. package/target/main/ts/report/html/app/viewer-totals.js +89 -0
  169. package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
  170. package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
  171. package/target/main/ts/report/html/app/viewer-trend-data.d.ts +49 -0
  172. package/target/main/ts/report/html/app/viewer-trend-data.js +105 -0
  173. package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
  174. package/target/main/ts/report/html/app/viewer-trend-nav.js +85 -0
  175. package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
  176. package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
  177. package/target/main/ts/report/html/app/viewer-trend-series.d.ts +26 -0
  178. package/target/main/ts/report/html/app/viewer-trend-series.js +98 -0
  179. package/target/main/ts/report/html/app/viewer-trends.d.ts +2 -70
  180. package/target/main/ts/report/html/app/viewer-trends.js +41 -392
  181. package/target/main/ts/report/html/app/viewer.js +152 -663
  182. package/target/main/ts/report/json/store/local-store.js +2 -12
  183. package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
  184. package/target/main/ts/report/json/store/operation-cache.js +32 -0
  185. package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
  186. package/target/main/ts/report/json/store/replace-file.js +14 -0
  187. package/target/main/ts/report.d.ts +1 -0
  188. package/target/main/ts/report.js +1 -0
@@ -0,0 +1,131 @@
1
+ import { renderSunburst } from './viewer-code-map.js';
2
+ import { choice, navigationButtons } from './viewer-controls.js';
3
+ import { basename, collator, count, element, inside, link, parentPath } from './viewer-dom.js';
4
+ import { fileHref, hotspotScore } from './viewer-file-figures.js';
5
+ import { localValue, measured } from './viewer-inspection.js';
6
+ import { breadcrumbs, liftToTitle } from './viewer-layout.js';
7
+ import { band, bandLimits, rankTitle } from './viewer-map-scale.js';
8
+ import { bandScale, compareValues, firstSortAscending } from './viewer-metric-format.js';
9
+ import { labelOf, pluginMetrics, pluginSpec } from './viewer-metrics.js';
10
+ const maxRanked = 10;
11
+ const hotspotChoices = [
12
+ ['complexity', labelOf('complexity')],
13
+ ['cognitive', labelOf('cognitive')],
14
+ ['missedLines', 'Uncovered lines'],
15
+ ['duplication', 'Duplicated lines'],
16
+ ['churn', 'Git churn'],
17
+ ];
18
+ /**
19
+ * What Hotspots ranks by: Repometry's rankings, then every other plugin's metric this inspection ran that has a worse
20
+ * end to rank by. The window is part of what churn means, so it is in the metric's name rather than in a sentence.
21
+ */
22
+ function rankChoices(days) {
23
+ const churn = days ? `Changes in ${count(days)} days` : undefined;
24
+ return [
25
+ ...hotspotChoices.map(([value, name]) => [value, value === 'churn' ? churn ?? name : name]),
26
+ ...pluginMetrics().filter(spec => spec.hotspot && measured(spec.descriptor)).map(spec => [spec.key, spec.label]),
27
+ ];
28
+ }
29
+ /** What makes the churn count incomplete, when anything does: missing history, a shallow checkout, a capped scan. */
30
+ function churnCaveat(window) {
31
+ if (!window)
32
+ return 'Git history is unavailable for this inspection.';
33
+ return [window.shallow ? 'The checkout is shallow, so older changes are missing.' : '',
34
+ window.capReached ? `Only the latest ${count(window.maxCommits)} commits were scanned.` : ''].filter(Boolean).join(' ');
35
+ }
36
+ /**
37
+ * Files by another plugin's metric, worst first. Where lower is better a zero is nothing to fix and stays off the list,
38
+ * as with Repometry's own rankings; where higher is better every measured file ranks.
39
+ */
40
+ function pluginRanking(files, spec) {
41
+ const order = compareValues(firstSortAscending(spec));
42
+ const ranks = (value) => value !== null && (spec.descriptor.better === 'higher' || value > 0);
43
+ return files.flatMap(entry => {
44
+ const value = localValue(entry, spec);
45
+ return ranks(value) ? [{ entry, value }] : [];
46
+ }).sort((a, b) => order(a.value, b.value) || collator.compare(a.entry.path, b.entry.path)).map(({ entry }) => entry);
47
+ }
48
+ function ranked(details, files, metric) {
49
+ const plugin = pluginSpec(metric);
50
+ if (plugin)
51
+ return pluginRanking(files, plugin);
52
+ const byPath = new Map(files.map(entry => [entry.path, entry]));
53
+ return (details.metrics.hotspots[metric] ?? []).flatMap(path => byPath.get(path) ?? []);
54
+ }
55
+ function rankRow(entry, metric, navigation, peak, limits) {
56
+ const row = element('li');
57
+ const title = link(fileHref(navigation, entry.path), basename(entry.path), 'fx-rank-link');
58
+ title.append(element('span', 'fx-rank-path', parentPath(entry.path) || '/'));
59
+ const value = hotspotScore(entry, metric) ?? 0;
60
+ const mark = element('span', 'fx-rank-mark');
61
+ mark.style.setProperty('--length', `${value / peak * 100}%`);
62
+ mark.dataset.band = String(band(entry, metric, value, peak, limits));
63
+ mark.setAttribute('aria-hidden', 'true');
64
+ row.append(title, mark, element('strong', 'fx-rank-score', count(value)));
65
+ return row;
66
+ }
67
+ function rankFiles(entries, metric, navigation, hasMeasures, limits) {
68
+ const panel = element('section', 'fx-rank');
69
+ // The bars speak the map's colours: the same bands, the same palette.
70
+ const plugin = pluginSpec(metric);
71
+ panel.dataset.palette = plugin ? bandScale(plugin) : metric === 'churn' ? 'neutral' : 'heat';
72
+ const heading = rankTitle(metric);
73
+ panel.append(element('h2', '', `${heading} by file`));
74
+ if (!entries.length) {
75
+ panel.append(element('p', 'fx-note', hasMeasures
76
+ ? `No files with ${heading.toLowerCase()} above zero.`
77
+ : `No measurements for ${heading.toLowerCase()} in this folder.`));
78
+ return panel;
79
+ }
80
+ const list = element('ol', 'fx-ranking');
81
+ const pages = navigationButtons('Ranking pages', () => { page--; render(); }, () => { page++; render(); });
82
+ pages.section.hidden = entries.length <= maxRanked;
83
+ // The longest bar is the highest value, whichever end of the scale the list starts from.
84
+ const peak = entries.reduce((max, entry) => Math.max(max, hotspotScore(entry, metric) ?? 0), 0) || 1;
85
+ let page = 0;
86
+ function render() {
87
+ const offset = page * maxRanked;
88
+ list.start = offset + 1;
89
+ list.replaceChildren(...entries.slice(offset, offset + maxRanked).map(entry => rankRow(entry, metric, navigation, peak, limits)));
90
+ pages.update(page, Math.ceil(entries.length / maxRanked));
91
+ }
92
+ panel.append(list, pages.section);
93
+ render();
94
+ return panel;
95
+ }
96
+ /** The Hotspots page: the folder's code map coloured by a metric, and its files ranked by it beside. */
97
+ export function hotspotView(details, navigation, settings, directory) {
98
+ const view = element('div', 'fx-view');
99
+ const choices = rankChoices(details.metrics.churnWindow?.lookbackDays);
100
+ const linked = choices.find(([value]) => value === navigation.rank)?.[0];
101
+ if (linked)
102
+ settings.hotspot = linked;
103
+ if (!choices.some(([value]) => value === settings.hotspot))
104
+ settings.hotspot = 'complexity';
105
+ const selector = choice('Rank by', choices, settings.hotspot);
106
+ selector.label.classList.add('fx-field-bare');
107
+ const tools = element('div', 'fx-tools fx-hotspot-tools');
108
+ tools.append(breadcrumbs('hotspots', navigation, directory));
109
+ const content = element('div', 'fx-hotspot-content');
110
+ const provenance = element('p', 'fx-note fx-churn-provenance');
111
+ view.append(tools, provenance, content);
112
+ selector.select.addEventListener('change', () => {
113
+ settings.hotspot = choices.find(([value]) => value === selector.select.value)?.[0] ?? 'complexity';
114
+ history.replaceState(history.state, '', navigation.href('hotspots', { directory, rank: settings.hotspot }));
115
+ render();
116
+ });
117
+ const files = details.metrics.files.filter(entry => inside(entry.path, directory));
118
+ function render() {
119
+ const metric = settings.hotspot;
120
+ const caveat = metric === 'churn' ? churnCaveat(details.metrics.churnWindow) : '';
121
+ provenance.hidden = !caveat;
122
+ provenance.textContent = caveat;
123
+ const hasMeasures = files.some(entry => hotspotScore(entry, metric) !== null);
124
+ const mapSection = renderSunburst(details, { metric, directory, href: navigation.href, reshape: () => render(), controls: selector.label });
125
+ content.replaceChildren(mapSection, rankFiles(ranked(details, files, metric), metric, navigation, hasMeasures, bandLimits(details, metric)));
126
+ }
127
+ // The ranking is the page's side column: its heading stands on the page title's baseline, as a sidebar's does.
128
+ liftToTitle(content, ':scope > .fx-rank h2');
129
+ render();
130
+ return view;
131
+ }
@@ -0,0 +1,69 @@
1
+ import type { FileMetricsReport } from '../../json/wire/file-metrics-model.js';
2
+ import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
3
+ import type { MetricDescriptor } from '../../json/wire/summary-model.js';
4
+ import type { MetricSpec, Valued } from './viewer-metric-registry.js';
5
+ import type { PluginMetric } from './viewer-metrics.js';
6
+ /** The pages that read one inspection: its files, its code map, its findings and its diagnostics. */
7
+ export type View = 'metrics' | 'hotspots' | 'diagnostics' | 'issues';
8
+ export type Metrics = FileMetricsReport['files'][number];
9
+ export type Directory = FileMetricsReport['directories'][number];
10
+ export type BuiltinHotspot = keyof FileMetricsReport['hotspots'];
11
+ /** What the code map and the ranking measure: one of Repometry's rankings, or another plugin's metric by its key. */
12
+ export type HotspotMetric = BuiltinHotspot | PluginMetric;
13
+ export interface Navigation {
14
+ readonly directory: string;
15
+ readonly file: string;
16
+ /** The Metrics query and grouping from the URL. */
17
+ readonly query?: string | undefined;
18
+ readonly group?: string | undefined;
19
+ /** A source line to bring into view. */
20
+ readonly line?: number | undefined;
21
+ /** The Issues filters from the URL: finding categories, comma-separated, and a severity. */
22
+ readonly category?: string | undefined;
23
+ readonly level?: string | undefined;
24
+ /** What Hotspots ranks by. */
25
+ readonly rank?: string | undefined;
26
+ /** What an open file's lines show: its findings (the default) or its coverage. */
27
+ readonly layer?: string | undefined;
28
+ /** Source text of a file at this commit; absent where the view cannot load source. */
29
+ readonly source?: ((path: string) => Promise<string | null>) | undefined;
30
+ /** The file's page on its forge, when the export names one. */
31
+ readonly sourcePage?: ((path: string, line?: number) => {
32
+ readonly href: string;
33
+ readonly provider: string;
34
+ } | null) | undefined;
35
+ href(view: View, options?: LinkOptions): string;
36
+ }
37
+ export interface LinkOptions {
38
+ readonly directory?: string;
39
+ readonly file?: string;
40
+ readonly query?: string;
41
+ readonly group?: string;
42
+ readonly line?: number;
43
+ readonly category?: string;
44
+ readonly level?: string;
45
+ readonly rank?: string;
46
+ readonly layer?: string;
47
+ }
48
+ /** What a reader chose on these pages, kept while the viewer stays open. */
49
+ export interface Preferences {
50
+ mode: string;
51
+ sort: number;
52
+ ascending: boolean;
53
+ hotspot: HotspotMetric;
54
+ columns: Map<number, boolean>;
55
+ /** Whether the files no plugin read are listed, or folded into one row at the end. */
56
+ unanalysed: boolean;
57
+ }
58
+ /** How many rows a page of any list holds. */
59
+ export declare const pageSize = 50;
60
+ export declare function useDetails(details: InspectionDetails): void;
61
+ export declare function localCatalog(): readonly MetricDescriptor[] | undefined;
62
+ /** A file's or a folder's value of a registry metric, read through this inspection's catalog. */
63
+ export declare function localValue(entry: Valued, spec: MetricSpec): number | null;
64
+ /** Whether this inspection ran the metric: a ratio ran where its denominator did. */
65
+ export declare function measured(descriptor: MetricDescriptor): boolean;
66
+ /** Registry metrics of files that this inspection ran. */
67
+ export declare function measuredFileMetrics(): MetricSpec[];
68
+ /** Coverage kinds beside line coverage (branches, functions), where the coverage report has them. */
69
+ export declare function coverageKinds(): MetricSpec[];
@@ -0,0 +1,36 @@
1
+ import { usePluginMeasures } from './viewer-filter.js';
2
+ import { catalogIndex, entryValue } from './viewer-metric-registry.js';
3
+ import { extendCatalog, pluginMetrics } from './viewer-metrics.js';
4
+ /** How many rows a page of any list holds. */
5
+ export const pageSize = 50;
6
+ /** The inspection's own catalog: its file and folder values are indexed by it, not by the history's. */
7
+ let local = { catalog: undefined, index: new Map() };
8
+ export function useDetails(details) {
9
+ const catalog = details.metrics.catalog;
10
+ extendCatalog(catalog);
11
+ local = { catalog, index: catalogIndex(catalog) };
12
+ usePluginMeasures(pluginMetrics().filter(spec => spec.descriptor.scope === 'file' && measured(spec.descriptor)).map(spec => [spec.key, {
13
+ label: spec.label, percent: spec.descriptor.unit === 'ratio', minutes: spec.descriptor.unit === 'minutes',
14
+ read: (entry) => localValue(entry, spec),
15
+ }]));
16
+ }
17
+ export function localCatalog() {
18
+ return local.catalog;
19
+ }
20
+ /** A file's or a folder's value of a registry metric, read through this inspection's catalog. */
21
+ export function localValue(entry, spec) {
22
+ return entryValue(local.index, entry, spec);
23
+ }
24
+ /** Whether this inspection ran the metric: a ratio ran where its denominator did. */
25
+ export function measured(descriptor) {
26
+ return local.index.has(descriptor.ratio?.over ?? descriptor.id);
27
+ }
28
+ /** Registry metrics of files that this inspection ran. */
29
+ export function measuredFileMetrics() {
30
+ return pluginMetrics().filter(spec => spec.descriptor.scope === 'file' && measured(spec.descriptor));
31
+ }
32
+ /** Coverage kinds beside line coverage (branches, functions), where the coverage report has them. */
33
+ export function coverageKinds() {
34
+ return pluginMetrics().filter(spec => spec.plugin === 'repometry' && spec.group === 'Coverage' && spec.descriptor.unit === 'ratio'
35
+ && spec.descriptor.scope === 'file');
36
+ }
@@ -0,0 +1,27 @@
1
+ import type { Finding } from '../../json/wire/domain-types.js';
2
+ import type { Navigation } from './viewer-inspection.js';
3
+ export declare const issueCategories: Readonly<Record<string, string>>;
4
+ export declare const issueLevels: {
5
+ readonly high: 'High';
6
+ readonly medium: 'Medium';
7
+ readonly low: 'Low';
8
+ readonly unknown: 'Unknown';
9
+ };
10
+ export declare const levelOrder: {
11
+ readonly high: 0;
12
+ readonly medium: 1;
13
+ readonly low: 2;
14
+ readonly unknown: 3;
15
+ };
16
+ /** The work a set of findings asks for, where any of them states it. */
17
+ export declare function effortOf(findings: readonly Finding[]): number | undefined;
18
+ /** A path the ignore entry can match literally: relative, normalised, with no glob or drive in it. */
19
+ export declare function literalPath(path: string | undefined): path is string;
20
+ /** The profile entry that ignores a finding: in its file where the path can be matched literally, else everywhere. */
21
+ export declare function ignoreRecord(finding: Pick<Finding, 'tool' | 'rule' | 'path'>): {
22
+ tool: string;
23
+ rule: string;
24
+ path?: string;
25
+ } | undefined;
26
+ /** The findings of one rule as a group that opens to its occurrences. */
27
+ export declare function issueGroup(group: readonly Finding[], navigation: Navigation, files: ReadonlySet<string>): HTMLDetailsElement;
@@ -0,0 +1,174 @@
1
+ import { copyIcon, copyOnClick } from './viewer-copy.js';
2
+ import { element, externalLink, link, parentPath, quantity } from './viewer-dom.js';
3
+ import { allLocations, formatLocation } from './viewer-locations.js';
4
+ import { duration } from './viewer-metrics.js';
5
+ import { lineSnippet, renderExcerpt } from './viewer-source-view.js';
6
+ import { highlightCode } from './viewer-tokenizer.js';
7
+ export const issueCategories = {
8
+ structure: 'Structure', duplication: 'Duplication', lint: 'Lint', security: 'Security',
9
+ dependency: 'Dependencies', secret: 'Secrets', infrastructure: 'Infrastructure',
10
+ };
11
+ export const issueLevels = { high: 'High', medium: 'Medium', low: 'Low', unknown: 'Unknown' };
12
+ export const levelOrder = { high: 0, medium: 1, low: 2, unknown: 3 };
13
+ /** The work a set of findings asks for, where any of them states it. */
14
+ export function effortOf(findings) {
15
+ if (!findings.some(item => item.effortMinutes !== undefined))
16
+ return undefined;
17
+ return findings.reduce((sum, item) => sum + (item.effortMinutes ?? 0), 0);
18
+ }
19
+ /** A tool, a rule or a path with nothing in it, or a line break, would make an entry the profile cannot read back. */
20
+ function plain(value) {
21
+ return value.trim() !== '' && !/[\0\r\n]/.test(value);
22
+ }
23
+ /** A path the ignore entry can match literally: relative, normalised, with no glob or drive in it. */
24
+ export function literalPath(path) {
25
+ if (!path || /[\0\r\n\\*?{}[\]()]/.test(path) || /^[#!]|^[a-z]:/i.test(path))
26
+ return false;
27
+ return path.split('/').every(part => part && part !== '.' && part !== '..');
28
+ }
29
+ /** The profile entry that ignores a finding: in its file where the path can be matched literally, else everywhere. */
30
+ export function ignoreRecord(finding) {
31
+ const { tool, rule, path } = finding;
32
+ if (!plain(tool) || !plain(rule))
33
+ return undefined;
34
+ return { tool, rule, ...(literalPath(path) ? { path } : {}) };
35
+ }
36
+ function ignoreSnippet(finding) {
37
+ const record = ignoreRecord(finding);
38
+ if (!record)
39
+ return undefined;
40
+ const details = element('details', 'fx-ignore');
41
+ const title = element('summary', '', 'Ignore rule');
42
+ const hint = element('p', 'fx-note', 'Add this entry to the profile’s ignore array and rerun the inspection. '
43
+ + (record.path ? 'It matches this rule in the file shown.' : 'It matches this rule across the repository.'));
44
+ const input = element('textarea', 'fx-ignore-code');
45
+ input.readOnly = true;
46
+ input.rows = Object.keys(record).length + 2;
47
+ input.wrap = 'off';
48
+ input.value = JSON.stringify(record, null, 2);
49
+ input.setAttribute('aria-label', 'Profile ignore rule JSON');
50
+ const copy = element('button', 'fx-copy');
51
+ copy.type = 'button';
52
+ copy.title = 'Copy rule';
53
+ copy.setAttribute('aria-label', 'Copy rule');
54
+ copy.append(copyIcon());
55
+ const feedback = element('p', 'fx-note fx-copy-status');
56
+ feedback.setAttribute('role', 'status');
57
+ copyOnClick(copy, () => input.value, {
58
+ copied: () => {
59
+ copy.title = 'Copied';
60
+ feedback.textContent = 'Copied.';
61
+ feedback.classList.add('visually-hidden');
62
+ },
63
+ reset: () => {
64
+ copy.title = 'Copy rule';
65
+ feedback.textContent = '';
66
+ },
67
+ refused: () => {
68
+ input.focus();
69
+ input.select();
70
+ feedback.classList.remove('visually-hidden');
71
+ feedback.textContent = 'Rule selected. Press your copy shortcut.';
72
+ },
73
+ });
74
+ const code = element('div', 'fx-ignore-box');
75
+ code.append(input, copy);
76
+ details.append(title, hint, code, feedback);
77
+ return details;
78
+ }
79
+ /** A place as a link into its file where the inspection has the file, else as plain code. */
80
+ function placeLink(location, context, label, className, plainClass) {
81
+ if (!context.files.has(location.path))
82
+ return element('code', plainClass, label);
83
+ return link(context.navigation.href('metrics', { directory: parentPath(location.path), file: location.path,
84
+ ...(location.line ? { line: location.line } : {}) }), label, className);
85
+ }
86
+ /** Where the excerpt cannot load, the forge's page is one link away; without one, no gap is left. */
87
+ function excerptAway(slot, place, context) {
88
+ const page = context.navigation.sourcePage?.(place.path, place.line);
89
+ if (!page) {
90
+ slot.remove();
91
+ return;
92
+ }
93
+ slot.replaceChildren(externalLink(page.href, `View on ${page.provider}`, 'fx-source-forge'));
94
+ slot.classList.add('fx-occurrence-away');
95
+ }
96
+ /** The lines a finding points at, loaded on demand; an anonymous function is named by its first line's code. */
97
+ function excerpt(finding, place, message, context, source) {
98
+ const slot = element('div', 'fx-occurrence-code');
99
+ void source(place.path).then(text => {
100
+ if (text === null) {
101
+ excerptAway(slot, place, context);
102
+ return;
103
+ }
104
+ slot.append(renderExcerpt(text, { path: place.path, line: place.line, endLine: place.endLine,
105
+ more: line => context.navigation.href('metrics', { directory: parentPath(place.path), file: place.path, line }) }));
106
+ // A tool that could not name the function said "(anonymous)"; its first line says which one it is.
107
+ const snippet = lineSnippet(text, place.line, 48);
108
+ if (!snippet || !finding.message.startsWith('(anonymous)'))
109
+ return;
110
+ const name = element('code', 'fx-occurrence-name');
111
+ name.append(...highlightCode(place.path, snippet));
112
+ message.replaceChildren(name, finding.message.slice('(anonymous)'.length));
113
+ });
114
+ return slot;
115
+ }
116
+ function otherPlaces(places, context) {
117
+ if (!places.length)
118
+ return [];
119
+ const paths = element('ul', 'fx-event-paths');
120
+ paths.append(...places.map(location => {
121
+ const item = element('li');
122
+ const label = formatLocation(location);
123
+ item.append(context.files.has(location.path) ? placeLink(location, context, `Also ${label}`, 'fx-inline-link', 'fx-path')
124
+ : element('code', 'fx-path', label));
125
+ return item;
126
+ }));
127
+ return [paths];
128
+ }
129
+ /** Each occurrence is bound to its code: the place, the message, and the lines themselves. */
130
+ function occurrence(finding, context) {
131
+ const row = element('li', 'fx-occurrence');
132
+ const [primary, ...others] = allLocations(finding);
133
+ const head = element('div', 'fx-occurrence-head');
134
+ if (primary)
135
+ head.append(placeLink(primary, context, formatLocation(primary), 'fx-location', 'fx-location'));
136
+ if (finding.effortMinutes !== undefined)
137
+ head.append(element('span', 'fx-occurrence-effort', duration(finding.effortMinutes)));
138
+ const message = element('p', 'fx-occurrence-message', finding.message);
139
+ row.append(head, message);
140
+ const source = context.navigation.source;
141
+ const line = primary?.line;
142
+ if (primary && line !== undefined && context.files.has(primary.path) && source)
143
+ row.append(excerpt(finding, { ...primary, line }, message, context, source));
144
+ row.append(...otherPlaces(others, context));
145
+ const ignore = ignoreSnippet(finding);
146
+ if (ignore)
147
+ row.append(ignore);
148
+ return row;
149
+ }
150
+ /** The findings of one rule as a group that opens to its occurrences. */
151
+ export function issueGroup(group, navigation, files) {
152
+ const item = group[0];
153
+ const details = element('details', 'fx-issue');
154
+ const summary = element('summary', 'fx-issue-summary');
155
+ const identity = element('span');
156
+ identity.append(element('strong', '', item.rule), element('span', 'fx-note', `${item.tool} · ${issueCategories[item.category] ?? item.category}`));
157
+ const severity = element('span', 'fx-state', issueLevels[item.level]);
158
+ severity.dataset.state = item.level;
159
+ const effort = effortOf(group);
160
+ const occurrences = quantity(group.length, 'occurrence');
161
+ summary.append(identity, severity, element('span', 'fx-issue-count', effort === undefined ? occurrences : `${occurrences} · ${duration(effort)}`));
162
+ const locations = element('ul', 'fx-event-list fx-occurrences');
163
+ // The excerpts mark their lines in the finding's own colour, as its severity badge does.
164
+ locations.dataset.level = item.level;
165
+ // The occurrences, and the source they load, are built when the group is first opened: a page of closed groups
166
+ // requests nothing.
167
+ const context = { navigation, files };
168
+ details.addEventListener('toggle', () => {
169
+ if (details.open && !locations.childElementCount)
170
+ locations.append(...group.map(finding => occurrence(finding, context)));
171
+ });
172
+ details.append(summary, locations);
173
+ return details;
174
+ }
@@ -0,0 +1,4 @@
1
+ import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
2
+ import type { Navigation } from './viewer-inspection.js';
3
+ /** The Findings page: the inspection's findings grouped by rule, filtered by a search, a severity, tools and categories. */
4
+ export declare function issuesView(details: InspectionDetails, navigation: Navigation): HTMLElement;
@@ -0,0 +1,173 @@
1
+ import { choices, multiChoice, navigationButtons, searchField, segmented } from './viewer-controls.js';
2
+ import { basename, collator, contains, count, element, fact, link, quantity } from './viewer-dom.js';
3
+ import { pageSize } from './viewer-inspection.js';
4
+ import { effortOf, issueCategories, issueGroup, issueLevels, levelOrder } from './viewer-issue-group.js';
5
+ import { splitter } from './viewer-layout.js';
6
+ import { atPath, locationPaths } from './viewer-locations.js';
7
+ import { duration, labelOf } from './viewer-metrics.js';
8
+ const severities = ['high', 'medium', 'low', 'unknown'];
9
+ /** How often each value occurs: the tally a multiple choice offers. */
10
+ function tally(values, labels) {
11
+ return choices('', values, labels).slice(1).map(([value, name]) => [value, name, values.filter(item => item === value).length]);
12
+ }
13
+ /** Whether a multiple choice lets the value through: none ticked means all. */
14
+ function allowed(values, value) {
15
+ return values.size === 0 || values.has(value);
16
+ }
17
+ function searchable(item) {
18
+ return [item.rule, item.message, item.path, ...(item.related?.map(location => location.path) ?? [])];
19
+ }
20
+ /** The findings grouped by rule: the most severe first, then the most frequent, then by name. */
21
+ function byRule(findings) {
22
+ const groups = new Map();
23
+ for (const item of findings) {
24
+ const key = JSON.stringify([item.tool, item.rule, item.category, item.level]);
25
+ const group = groups.get(key);
26
+ if (group)
27
+ group.push(item);
28
+ else
29
+ groups.set(key, [item]);
30
+ }
31
+ return [...groups.values()].sort((a, b) => levelOrder[a[0].level] - levelOrder[b[0].level]
32
+ || b.length - a.length || collator.compare(a[0].rule, b[0].rule));
33
+ }
34
+ function summaryFacts(findings, rules) {
35
+ const facts = element('dl', 'fx-kv');
36
+ facts.append(fact('Findings', count(findings.length)), fact('Rules', count(rules)));
37
+ const effort = effortOf(findings);
38
+ if (effort !== undefined)
39
+ facts.append(fact(labelOf('effort'), duration(effort)));
40
+ // One severity would only repeat the total.
41
+ const levels = severities.map(value => [value, findings.filter(item => item.level === value).length]).filter(([, total]) => total > 0);
42
+ if (levels.length > 1)
43
+ facts.append(...levels.map(([value, total]) => fact(issueLevels[value], count(total))));
44
+ return facts;
45
+ }
46
+ function asideSection(title, content) {
47
+ const section = element('section', 'fx-aside-section');
48
+ section.append(element('h3', '', title), content);
49
+ return section;
50
+ }
51
+ function categorySection(findings) {
52
+ const categories = new Map();
53
+ for (const item of findings)
54
+ categories.set(item.category, (categories.get(item.category) ?? 0) + 1);
55
+ if (categories.size < 2)
56
+ return [];
57
+ const rows = element('dl', 'fx-kv');
58
+ rows.append(...[...categories].sort((a, b) => b[1] - a[1]).map(([name, total]) => fact(issueCategories[name] ?? name, count(total))));
59
+ return [asideSection('By category', rows)];
60
+ }
61
+ function placesSection(findings, navigation, files) {
62
+ const places = new Map();
63
+ for (const item of findings)
64
+ for (const location of locationPaths(item))
65
+ places.set(location, (places.get(location) ?? 0) + 1);
66
+ if (!places.size)
67
+ return [];
68
+ const top = element('ol', 'fx-function-list fx-top-files');
69
+ for (const [file, total] of [...places].sort((a, b) => b[1] - a[1] || collator.compare(a[0], b[0])).slice(0, 5)) {
70
+ const row = element('li');
71
+ const name = files.has(file) ? link(navigation.href('issues', { file }), basename(file), 'fx-top-file') : element('span', 'fx-top-file', basename(file));
72
+ name.title = file;
73
+ row.append(name, element('strong', 'fx-function-score', count(total)));
74
+ top.append(row);
75
+ }
76
+ return [asideSection('Most affected files', top)];
77
+ }
78
+ /** Totals for the findings the filters select: how many, how much work, of what kind, and where they gather. */
79
+ function issueSummary(findings, rules, navigation, files) {
80
+ const panel = element('aside', 'fx-aside');
81
+ panel.setAttribute('aria-label', 'Findings summary');
82
+ const heading = element('div', 'fx-aside-heading');
83
+ heading.append(element('h2', '', 'Findings'));
84
+ panel.append(heading, summaryFacts(findings, rules), ...categorySection(findings), ...placesSection(findings, navigation, files));
85
+ return panel;
86
+ }
87
+ /** A file's findings name the file, with the way back to all of them. */
88
+ function fileScope(path, navigation) {
89
+ const scope = element('div', 'fx-file-heading');
90
+ scope.append(element('code', 'fx-path', path), link(navigation.href('issues'), 'All findings', 'fx-inline-link'));
91
+ return scope;
92
+ }
93
+ /** The Findings page: the inspection's findings grouped by rule, filtered by a search, a severity, tools and categories. */
94
+ export function issuesView(details, navigation) {
95
+ const { findings, metrics } = details;
96
+ const view = element('div', 'fx-view fx-events');
97
+ if (findings === undefined) {
98
+ view.append(element('p', 'fx-note', 'Findings are unavailable for this inspection. Reinspect this commit to collect them.'));
99
+ return view;
100
+ }
101
+ const path = navigation.file;
102
+ const scoped = path ? findings.filter(item => atPath(item, path)) : findings;
103
+ if (path)
104
+ view.append(fileScope(path, navigation));
105
+ if (!scoped.length) {
106
+ view.append(element('p', 'fx-note', path ? 'No findings recorded for this file.' : 'No findings recorded for this commit.'));
107
+ return view;
108
+ }
109
+ // One line of controls, as on Metrics: a search, the severities as a switch, and selects that appear only where they
110
+ // can narrow something. The counts live in the sidebar, which follows the filters.
111
+ const search = searchField('Search findings', 'Search rules, messages and paths');
112
+ search.label.classList.add('fx-field-bare');
113
+ // A link may arrive with a search, as the Profile's rules do: the list opens narrowed to it.
114
+ search.input.value = navigation.query ?? '';
115
+ const present = severities.filter(value => scoped.some(item => item.level === value));
116
+ // A link may name a severity and categories, as the Overview's figures do: the list opens filtered, the controls show it.
117
+ let level = present.find(value => value === navigation.level) ?? '';
118
+ const severity = segmented('Severity', [['', 'All'], ...present.map(value => [value, issueLevels[value]])], level, value => {
119
+ level = value;
120
+ reset();
121
+ });
122
+ const tools = multiChoice({ text: 'Tool', all: 'All tools', plural: 'tools' }, tally(scoped.map(item => item.tool)), reset);
123
+ const category = multiChoice({ text: 'Category', all: 'All categories', plural: 'categories' }, tally(scoped.map(item => item.category), issueCategories), reset, navigation.category?.split(','));
124
+ const toolbar = element('div', 'fx-tools fx-metrics-tools');
125
+ toolbar.append(search.label);
126
+ if (present.length > 1)
127
+ toolbar.append(severity);
128
+ toolbar.append(category.element, tools.element);
129
+ const status = element('p', 'fx-note fx-results');
130
+ status.setAttribute('aria-live', 'polite');
131
+ const list = element('div', 'fx-issue-list');
132
+ const nav = navigationButtons('Finding pages', () => { page--; render(); }, () => { page++; render(); });
133
+ const split = element('div', 'fx-split');
134
+ const main = element('div', 'fx-main');
135
+ main.append(toolbar, status, list, nav.section);
136
+ let aside = element('aside');
137
+ split.append(main, splitter(split), aside);
138
+ view.append(split);
139
+ const files = new Set(metrics.files.map(entry => entry.path));
140
+ let page = 0;
141
+ const passes = (item, query) => allowed(tools.values, item.tool) && allowed(category.values, item.category)
142
+ && (!level || item.level === level) && contains(query, searchable(item));
143
+ function render() {
144
+ const query = search.input.value.trim().toLowerCase();
145
+ const chosen = scoped.filter(item => passes(item, query));
146
+ const sorted = byRule(chosen);
147
+ list.replaceChildren(...sorted.slice(page * pageSize, (page + 1) * pageSize).map(group => issueGroup(group, navigation, files)));
148
+ // The sidebar carries the counts; on screen this line speaks only when nothing matches, and it tells a screen
149
+ // reader what the filters left.
150
+ status.textContent = chosen.length === 0 ? 'No findings match these filters.' : `${quantity(chosen.length, 'finding')} in ${quantity(sorted.length, 'rule')}`;
151
+ status.classList.toggle('visually-hidden', chosen.length > 0);
152
+ nav.section.hidden = sorted.length <= pageSize;
153
+ nav.update(page, Math.ceil(sorted.length / pageSize));
154
+ const next = issueSummary(chosen, sorted.length, navigation, files);
155
+ aside.replaceWith(next);
156
+ aside = next;
157
+ }
158
+ function reset() {
159
+ page = 0;
160
+ remember();
161
+ render();
162
+ }
163
+ /** The URL follows the filters, without a new history entry per change, so the view can be shared and reloaded. */
164
+ function remember() {
165
+ history.replaceState(history.state, '', navigation.href('issues', {
166
+ ...(path ? { file: path } : {}), query: search.input.value.trim(), level,
167
+ category: [...category.values].join(','),
168
+ }));
169
+ }
170
+ search.input.addEventListener('input', reset);
171
+ render();
172
+ return view;
173
+ }
@@ -0,0 +1,9 @@
1
+ import type { Clause } from './viewer-filter.js';
2
+ import type { Metrics } from './viewer-inspection.js';
3
+ /** The query with a language's chip pressed or released. */
4
+ export declare function toggleLanguage(clauses: readonly Clause[], language: string): Clause[];
5
+ /**
6
+ * The languages of the selection as one bar, with a legend whose names toggle their chips in the query. Nothing shows
7
+ * for a single language or no weight at all.
8
+ */
9
+ export declare function renderLanguages(container: HTMLElement, files: readonly Metrics[], clauses: readonly Clause[], set: (clauses: Clause[]) => void): void;