repometry 0.4.2 → 0.6.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 (269) hide show
  1. package/README.md +36 -14
  2. package/package.json +1 -1
  3. package/target/main/resources/report/json/comparison-v1.schema.json +6 -6
  4. package/target/main/resources/report/json/file-metrics-v1.schema.json +7 -6
  5. package/target/main/resources/report/json/pull-review-v1.schema.json +5 -5
  6. package/target/main/resources/report/json/report-v2.schema.json +210 -11
  7. package/target/main/resources/report/json/repository-summary-v1.schema.json +161 -14
  8. package/target/main/resources/report/json/viewer-inspection-v1.schema.json +518 -6
  9. package/target/main/resources/viewer/styles.css +7 -2
  10. package/target/main/ts/api/git/changes.d.ts +1 -1
  11. package/target/main/ts/api/git/changes.js +3 -3
  12. package/target/main/ts/api/git/commit-metadata.js +6 -4
  13. package/target/main/ts/api/git/git.d.ts +2 -1
  14. package/target/main/ts/api/git/git.js +16 -4
  15. package/target/main/ts/api/git/inspection-source.d.ts +1 -1
  16. package/target/main/ts/api/git/inspection-source.js +4 -10
  17. package/target/main/ts/api/git/local.d.ts +1 -1
  18. package/target/main/ts/api/git/local.js +41 -7
  19. package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
  20. package/target/main/ts/api/process/docker-tool-runner.js +108 -0
  21. package/target/main/ts/api/process/failure.d.ts +1 -0
  22. package/target/main/ts/api/process/failure.js +12 -0
  23. package/target/main/ts/api/process/plugin.d.ts +10 -0
  24. package/target/main/ts/api/process/plugin.js +96 -0
  25. package/target/main/ts/api/worker/remote-executor.d.ts +1 -1
  26. package/target/main/ts/api/worker/remote-executor.js +2 -2
  27. package/target/main/ts/api/worker/worker-protocol.d.ts +2 -2
  28. package/target/main/ts/api/worker/worker-protocol.js +8 -8
  29. package/target/main/ts/api/worker/worker.d.ts +1 -1
  30. package/target/main/ts/api/worker/worker.js +4 -4
  31. package/target/main/ts/cli/main.js +4 -3
  32. package/target/main/ts/cli/reporting.d.ts +1 -1
  33. package/target/main/ts/cli/reporting.js +1 -1
  34. package/target/main/ts/compose/analysis-files.d.ts +13 -0
  35. package/target/main/ts/compose/analysis-files.js +95 -0
  36. package/target/main/ts/compose/analysis-imports.d.ts +7 -0
  37. package/target/main/ts/compose/analysis-imports.js +34 -0
  38. package/target/main/ts/compose/analysis-report.d.ts +5 -0
  39. package/target/main/ts/compose/analysis-report.js +78 -0
  40. package/target/main/ts/compose/analysis-repository.d.ts +6 -0
  41. package/target/main/ts/compose/analysis-repository.js +61 -0
  42. package/target/main/ts/compose/analysis-results.d.ts +38 -0
  43. package/target/main/ts/compose/analysis-results.js +78 -0
  44. package/target/main/ts/compose/analysis-sources.d.ts +73 -0
  45. package/target/main/ts/compose/analysis-sources.js +47 -0
  46. package/target/main/ts/compose/analyze-snapshot.d.ts +3 -2
  47. package/target/main/ts/compose/analyze-snapshot.js +19 -197
  48. package/target/main/ts/compose/diff-coverage.d.ts +2 -0
  49. package/target/main/ts/compose/diff-coverage.js +6 -4
  50. package/target/main/ts/compose/inspect.d.ts +5 -0
  51. package/target/main/ts/compose/inspect.js +14 -7
  52. package/target/main/ts/compose/languages.d.ts +29 -0
  53. package/target/main/ts/compose/languages.js +87 -0
  54. package/target/main/ts/compose/sources.js +14 -12
  55. package/target/main/ts/core/engine/execute.d.ts +3 -1
  56. package/target/main/ts/core/engine/execute.js +14 -2
  57. package/target/main/ts/core/engine/manifest.d.ts +2 -2
  58. package/target/main/ts/core/engine/manifest.js +25 -5
  59. package/target/main/ts/core/engine/operation-cache.d.ts +14 -0
  60. package/target/main/ts/core/engine/operation-cache.js +66 -0
  61. package/target/main/ts/core/engine/plan.d.ts +3 -4
  62. package/target/main/ts/core/engine/plan.js +28 -11
  63. package/target/main/ts/core/engine/plugin.d.ts +10 -2
  64. package/target/main/ts/core/engine/plugin.js +1 -3
  65. package/target/main/ts/core/engine/report-products.js +2 -13
  66. package/target/main/ts/core/model/clone-source.d.ts +1 -0
  67. package/target/main/ts/core/model/clone-source.js +2 -1
  68. package/target/main/ts/core/model/code-structure.d.ts +5 -0
  69. package/target/main/ts/core/model/code-structure.js +10 -1
  70. package/target/main/ts/core/model/finding-ignore.js +1 -1
  71. package/target/main/ts/core/model/finding.js +1 -1
  72. package/target/main/ts/core/model/language.d.ts +10 -0
  73. package/target/main/ts/core/model/language.js +6 -0
  74. package/target/main/ts/core/model/line-coverage.d.ts +5 -1
  75. package/target/main/ts/core/model/line-coverage.js +14 -11
  76. package/target/main/ts/core/model/measurement.d.ts +7 -6
  77. package/target/main/ts/core/model/measurement.js +18 -7
  78. package/target/main/ts/core/model/plugin-data.d.ts +5 -0
  79. package/target/main/ts/core/model/plugin-data.js +15 -1
  80. package/target/main/ts/core/model/quality-summary.js +6 -5
  81. package/target/main/ts/core/model/report.d.ts +1 -2
  82. package/target/main/ts/core/model/report.js +0 -1
  83. package/target/main/ts/core/model/scanner-import.js +1 -1
  84. package/target/main/ts/core/model/snapshot.d.ts +1 -2
  85. package/target/main/ts/core/model/snapshot.js +5 -7
  86. package/target/main/ts/core/model/source.d.ts +3 -0
  87. package/target/main/ts/core/model/source.js +15 -0
  88. package/target/main/ts/core/ports/tool-runner.d.ts +18 -0
  89. package/target/main/ts/core/ports/tool-runner.js +2 -0
  90. package/target/main/ts/core/usecases/compare.js +61 -17
  91. package/target/main/ts/core/usecases/inspect.js +2 -2
  92. package/target/main/ts/plugin.d.ts +10 -3
  93. package/target/main/ts/plugin.js +4 -2
  94. package/target/main/ts/plugins/coverage/coverage.d.ts +5 -2
  95. package/target/main/ts/plugins/coverage/coverage.js +35 -10
  96. package/target/main/ts/plugins/duplication/duplication.js +10 -4
  97. package/target/main/ts/plugins/language-js/babel-provider.js +8 -2
  98. package/target/main/ts/plugins/language-js/extensions.d.ts +3 -0
  99. package/target/main/ts/plugins/language-js/extensions.js +4 -0
  100. package/target/main/ts/plugins/language-js/function-facts.d.ts +1 -0
  101. package/target/main/ts/plugins/language-js/function-facts.js +30 -4
  102. package/target/main/ts/plugins/language-js/js-security.js +3 -2
  103. package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +11 -0
  104. package/target/main/ts/report/html/app/viewer-chart-bars.js +54 -0
  105. package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
  106. package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
  107. package/target/main/ts/report/html/app/viewer-chart-line.d.ts +24 -0
  108. package/target/main/ts/report/html/app/viewer-chart-line.js +89 -0
  109. package/target/main/ts/report/html/app/viewer-chart-points.d.ts +49 -0
  110. package/target/main/ts/report/html/app/viewer-chart-points.js +74 -0
  111. package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
  112. package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
  113. package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
  114. package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
  115. package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
  116. package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
  117. package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
  118. package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
  119. package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
  120. package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
  121. package/target/main/ts/report/html/app/viewer-chart.d.ts +4 -98
  122. package/target/main/ts/report/html/app/viewer-chart.js +16 -677
  123. package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
  124. package/target/main/ts/report/html/app/viewer-code-map.js +175 -0
  125. package/target/main/ts/report/html/app/viewer-columns.d.ts +38 -0
  126. package/target/main/ts/report/html/app/viewer-columns.js +92 -0
  127. package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
  128. package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
  129. package/target/main/ts/report/html/app/viewer-commits.d.ts +5 -9
  130. package/target/main/ts/report/html/app/viewer-commits.js +17 -216
  131. package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
  132. package/target/main/ts/report/html/app/viewer-controls.js +141 -0
  133. package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
  134. package/target/main/ts/report/html/app/viewer-copy.js +64 -0
  135. package/target/main/ts/report/html/app/viewer-data.d.ts +1 -1
  136. package/target/main/ts/report/html/app/viewer-data.js +2 -29
  137. package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
  138. package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
  139. package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
  140. package/target/main/ts/report/html/app/viewer-dom.js +99 -0
  141. package/target/main/ts/report/html/app/viewer-file-aside.d.ts +19 -0
  142. package/target/main/ts/report/html/app/viewer-file-aside.js +124 -0
  143. package/target/main/ts/report/html/app/viewer-file-figures.d.ts +15 -0
  144. package/target/main/ts/report/html/app/viewer-file-figures.js +60 -0
  145. package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
  146. package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
  147. package/target/main/ts/report/html/app/viewer-files.d.ts +2 -118
  148. package/target/main/ts/report/html/app/viewer-files.js +24 -2184
  149. package/target/main/ts/report/html/app/viewer-filter.d.ts +3 -51
  150. package/target/main/ts/report/html/app/viewer-filter.js +111 -450
  151. package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
  152. package/target/main/ts/report/html/app/viewer-hotspots.js +131 -0
  153. package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
  154. package/target/main/ts/report/html/app/viewer-inspection.js +36 -0
  155. package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
  156. package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
  157. package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
  158. package/target/main/ts/report/html/app/viewer-issues.js +173 -0
  159. package/target/main/ts/report/html/app/viewer-language-bar.d.ts +9 -0
  160. package/target/main/ts/report/html/app/viewer-language-bar.js +72 -0
  161. package/target/main/ts/report/html/app/viewer-languages.d.ts +27 -0
  162. package/target/main/ts/report/html/app/viewer-languages.js +93 -0
  163. package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
  164. package/target/main/ts/report/html/app/viewer-layout.js +134 -0
  165. package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
  166. package/target/main/ts/report/html/app/viewer-line-coverage.js +121 -0
  167. package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
  168. package/target/main/ts/report/html/app/viewer-locations.js +31 -0
  169. package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
  170. package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
  171. package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
  172. package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
  173. package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
  174. package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
  175. package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +0 -20
  176. package/target/main/ts/report/html/app/viewer-metric-registry.js +7 -84
  177. package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
  178. package/target/main/ts/report/html/app/viewer-metrics-view.js +162 -0
  179. package/target/main/ts/report/html/app/viewer-metrics.d.ts +6 -1
  180. package/target/main/ts/report/html/app/viewer-metrics.js +53 -35
  181. package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
  182. package/target/main/ts/report/html/app/viewer-overview-cards.js +118 -0
  183. package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
  184. package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
  185. package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
  186. package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
  187. package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
  188. package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
  189. package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
  190. package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
  191. package/target/main/ts/report/html/app/viewer-profile.d.ts +2 -6
  192. package/target/main/ts/report/html/app/viewer-profile.js +6 -248
  193. package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
  194. package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
  195. package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
  196. package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
  197. package/target/main/ts/report/html/app/viewer-pulls.d.ts +0 -1
  198. package/target/main/ts/report/html/app/viewer-pulls.js +28 -178
  199. package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
  200. package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
  201. package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
  202. package/target/main/ts/report/html/app/viewer-route.js +55 -0
  203. package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
  204. package/target/main/ts/report/html/app/viewer-shell.js +116 -0
  205. package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
  206. package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
  207. package/target/main/ts/report/html/app/viewer-source.d.ts +0 -84
  208. package/target/main/ts/report/html/app/viewer-source.js +7 -365
  209. package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
  210. package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
  211. package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
  212. package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
  213. package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
  214. package/target/main/ts/report/html/app/viewer-table-cells.js +129 -0
  215. package/target/main/ts/report/html/app/viewer-table-rows.d.ts +54 -0
  216. package/target/main/ts/report/html/app/viewer-table-rows.js +95 -0
  217. package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +16 -0
  218. package/target/main/ts/report/html/app/viewer-tokenizer.js +192 -0
  219. package/target/main/ts/report/html/app/viewer-totals.d.ts +14 -0
  220. package/target/main/ts/report/html/app/viewer-totals.js +89 -0
  221. package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
  222. package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
  223. package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
  224. package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
  225. package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
  226. package/target/main/ts/report/html/app/viewer-trend-nav.js +85 -0
  227. package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
  228. package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
  229. package/target/main/ts/report/html/app/viewer-trend-series.d.ts +26 -0
  230. package/target/main/ts/report/html/app/viewer-trend-series.js +98 -0
  231. package/target/main/ts/report/html/app/viewer-trends.d.ts +2 -70
  232. package/target/main/ts/report/html/app/viewer-trends.js +41 -392
  233. package/target/main/ts/report/html/app/viewer.js +152 -663
  234. package/target/main/ts/report/html/site/export-site.d.ts +3 -4
  235. package/target/main/ts/report/html/site/export-site.js +24 -41
  236. package/target/main/ts/report/html/site/exported-server.js +2 -1
  237. package/target/main/ts/report/html/site/local-server.d.ts +1 -1
  238. package/target/main/ts/report/html/site/local-server.js +13 -19
  239. package/target/main/ts/report/html/site/projects.js +8 -17
  240. package/target/main/ts/report/json/projections/commit-summary.d.ts +2 -2
  241. package/target/main/ts/report/json/projections/commit-summary.js +18 -19
  242. package/target/main/ts/report/json/projections/file-metrics.js +31 -24
  243. package/target/main/ts/report/json/projections/inspection-context.js +10 -1
  244. package/target/main/ts/report/json/projections/inspection-details.d.ts +1 -1
  245. package/target/main/ts/report/json/projections/inspection-details.js +2 -2
  246. package/target/main/ts/report/json/projections/metric-values.d.ts +1 -0
  247. package/target/main/ts/report/json/projections/metric-values.js +15 -5
  248. package/target/main/ts/report/json/store/local-store.js +2 -12
  249. package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
  250. package/target/main/ts/report/json/store/operation-cache.js +32 -0
  251. package/target/main/ts/report/json/store/pull-review-store.js +1 -2
  252. package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
  253. package/target/main/ts/report/json/store/replace-file.js +14 -0
  254. package/target/main/ts/report/json/validation/report.d.ts +1 -1
  255. package/target/main/ts/report/json/validation/report.js +10 -8
  256. package/target/main/ts/report/json/validation/summary-validation.js +1 -3
  257. package/target/main/ts/report/json/wire/file-metrics-model.d.ts +2 -0
  258. package/target/main/ts/report/json/wire/inspection-details-model.d.ts +0 -5
  259. package/target/main/ts/report/json/wire/public-history-model.d.ts +0 -6
  260. package/target/main/ts/report/json/wire/public-history-model.js +0 -1
  261. package/target/main/ts/report.d.ts +3 -3
  262. package/target/main/ts/report.js +2 -2
  263. package/target/main/resources/report/json/inspection-context-v1.schema.json +0 -172
  264. package/target/main/resources/report/json/public-history-v1.schema.json +0 -50
  265. package/target/main/resources/report/json/quality-history-v1.schema.json +0 -51
  266. package/target/main/resources/report/json/report-v1.schema.json +0 -65
  267. package/target/main/resources/report/json/viewer-details-v1.schema.json +0 -346
  268. package/target/main/ts/report/json/projections/public-history.d.ts +0 -4
  269. package/target/main/ts/report/json/projections/public-history.js +0 -17
@@ -0,0 +1,8 @@
1
+ import type { OperationCache } from '../../../core/engine/operation-cache.js';
2
+ export declare class LocalOperationCache implements OperationCache {
3
+ private readonly directory;
4
+ constructor(directory: string);
5
+ read(key: string): Promise<Uint8Array | undefined>;
6
+ write(key: string, bytes: Uint8Array): Promise<void>;
7
+ private folder;
8
+ }
@@ -0,0 +1,32 @@
1
+ import { lstat, mkdir, readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { replaceFile } from './replace-file.js';
4
+ const digestPattern = /^[a-f0-9]{64}$/;
5
+ export class LocalOperationCache {
6
+ directory;
7
+ constructor(directory) {
8
+ this.directory = directory;
9
+ }
10
+ async read(key) {
11
+ const path = join(this.folder(key), key);
12
+ try {
13
+ return (await lstat(path)).isFile() ? await readFile(path) : undefined;
14
+ }
15
+ catch (error) {
16
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
17
+ return undefined;
18
+ throw error;
19
+ }
20
+ }
21
+ async write(key, bytes) {
22
+ const folder = this.folder(key);
23
+ await mkdir(folder, { recursive: true, mode: 0o700 });
24
+ await replaceFile(folder, key, bytes);
25
+ }
26
+ folder(key) {
27
+ if (!digestPattern.test(key))
28
+ throw new Error('Invalid operation cache key');
29
+ return join(this.directory, key.slice(0, 2));
30
+ }
31
+ }
32
+ //# sourceMappingURL=operation-cache.js.map
@@ -5,10 +5,9 @@ import { Ajv2020 } from 'ajv/dist/2020.js';
5
5
  import metricCatalog from '../../../../resources/report/json/metric-catalog-v1.schema.json' with { type: 'json' };
6
6
  import comparison from '../../../../resources/report/json/comparison-v1.schema.json' with { type: 'json' };
7
7
  import diffCoverage from '../../../../resources/report/json/diff-coverage-v1.schema.json' with { type: 'json' };
8
- import inspection from '../../../../resources/report/json/report-v1.schema.json' with { type: 'json' };
9
8
  import currentInspection from '../../../../resources/report/json/report-v2.schema.json' with { type: 'json' };
10
9
  import schema from '../../../../resources/report/json/pull-review-v1.schema.json' with { type: 'json' };
11
- const ajv = new Ajv2020({ schemas: [metricCatalog, inspection, currentInspection, comparison, diffCoverage] });
10
+ const ajv = new Ajv2020({ schemas: [metricCatalog, currentInspection, comparison, diffCoverage] });
12
11
  const validate = ajv.compile(schema);
13
12
  export async function savePullReview(output, review) {
14
13
  if (!validate(review))
@@ -0,0 +1 @@
1
+ export declare function replaceFile(directory: string, name: string, contents: string | Uint8Array): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { rename, rm, writeFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ export async function replaceFile(directory, name, contents) {
5
+ const temporary = join(directory, `.repometry-${randomUUID()}.tmp`);
6
+ try {
7
+ await writeFile(temporary, contents, { flag: 'wx', mode: 0o600 });
8
+ await rename(temporary, join(directory, name));
9
+ }
10
+ finally {
11
+ await rm(temporary, { force: true });
12
+ }
13
+ }
14
+ //# sourceMappingURL=replace-file.js.map
@@ -2,7 +2,7 @@ import type { Subject } from '../../../core/model/source.js';
2
2
  import type { CommitSummary } from '../wire/summary-model.js';
3
3
  import type { Report } from '../../../core/model/report.js';
4
4
  import type { ReportReader as DomainReportReader, ReportWriter } from '../../../core/ports/report.js';
5
- export { legacyReportSchema, reportSchema, validSubjectId } from '../../../core/model/report.js';
5
+ export { reportSchema, validSubjectId } from '../../../core/model/report.js';
6
6
  export type { Diagnostic, Report } from '../../../core/model/report.js';
7
7
  export interface ReportReader extends DomainReportReader {
8
8
  listSummaries?(): Promise<readonly CommitSummary[]>;
@@ -1,15 +1,15 @@
1
1
  import { Ajv2020 } from 'ajv/dist/2020.js';
2
2
  import metricCatalog from '../../../../resources/report/json/metric-catalog-v1.schema.json' with { type: 'json' };
3
- import schemaV1 from '../../../../resources/report/json/report-v1.schema.json' with { type: 'json' };
4
3
  import schemaV2 from '../../../../resources/report/json/report-v2.schema.json' with { type: 'json' };
5
4
  import { isRecord } from '../../../core/engine/plugin.js';
6
5
  import { isMetricDescriptor } from '../../../core/engine/manifest.js';
7
6
  import { isFinding } from '../../../core/model/finding.js';
7
+ import { canonicalMetricId } from '../../../core/model/measurement.js';
8
8
  import { lcovLines } from '../../../core/model/line-coverage.js';
9
9
  import { digest } from '../../../core/model/snapshot.js';
10
10
  import { compactJsonSchema, unpackJson } from '../wire/compact-json.js';
11
- import { legacyReportSchema, reportSchema } from '../../../core/model/report.js';
12
- export { legacyReportSchema, reportSchema, validSubjectId } from '../../../core/model/report.js';
11
+ import { reportSchema } from '../../../core/model/report.js';
12
+ export { reportSchema, validSubjectId } from '../../../core/model/report.js';
13
13
  export function readReportText(text, subject) {
14
14
  const envelope = JSON.parse(text);
15
15
  const report = readReport(unpackJson(envelope));
@@ -28,19 +28,21 @@ export function compareReports(a, b) {
28
28
  return b.generatedAt.localeCompare(a.generatedAt) || a.subject.id.localeCompare(b.subject.id);
29
29
  }
30
30
  const ajv = new Ajv2020({ schemas: [metricCatalog] });
31
- const validateV1 = ajv.compile(schemaV1);
32
- const validateV2 = ajv.compile(schemaV2);
31
+ const validate = ajv.compile(schemaV2);
33
32
  export function readReport(value) {
34
- if (!isRecord(value) || (value.schema !== reportSchema && value.schema !== legacyReportSchema)) {
33
+ if (!isRecord(value) || value.schema !== reportSchema) {
35
34
  throw new Error('Unsupported or missing report schema');
36
35
  }
37
- const validate = value.schema === reportSchema ? validateV2 : validateV1;
38
36
  if (!validate(value))
39
37
  throw new Error(`Invalid report: ${ajv.errorsText(validate.errors)}`);
38
+ const definitionIds = Object.keys(value.definitions);
39
+ if (new Set(definitionIds.map(canonicalMetricId)).size !== definitionIds.length) {
40
+ throw new Error('Invalid report: the same measurement uses multiple IDs');
41
+ }
40
42
  if (value.pluginData) {
41
43
  const { metrics, measured, privateMetrics } = value.pluginData;
42
44
  const ids = new Set(metrics.map(metric => metric.id));
43
- if (ids.size !== metrics.length || !metrics.every(isMetricDescriptor)
45
+ if (new Set([...ids].map(canonicalMetricId)).size !== metrics.length || !metrics.every(isMetricDescriptor)
44
46
  || [...measured, ...privateMetrics ?? []].some(id => !ids.has(id)))
45
47
  throw new Error('Invalid report: inconsistent metric catalog');
46
48
  const lines = value.pluginData.products[lcovLines.id];
@@ -1,11 +1,9 @@
1
1
  import { Ajv2020 } from 'ajv/dist/2020.js';
2
2
  import metricCatalog from '../../../../resources/report/json/metric-catalog-v1.schema.json' with { type: 'json' };
3
- import historySchema from '../../../../resources/report/json/public-history-v1.schema.json' with { type: 'json' };
4
- import qualitySchema from '../../../../resources/report/json/quality-history-v1.schema.json' with { type: 'json' };
5
3
  import summaryContract from '../../../../resources/report/json/repository-summary-v1.schema.json' with { type: 'json' };
6
4
  import { summarySchema } from '../wire/summary-model.js';
7
5
  import { isMetricDescriptor } from '../../../core/engine/manifest.js';
8
- const validator = new Ajv2020({ schemas: [metricCatalog, historySchema, qualitySchema, summaryContract] });
6
+ const validator = new Ajv2020({ schemas: [metricCatalog, summaryContract] });
9
7
  export const validateSummary = validator.compile(summaryContract);
10
8
  const rowShape = validator.compile({ $ref: `${summarySchema}#/$defs/commit` });
11
9
  export function validateSummaryIndex(value) {
@@ -40,6 +40,7 @@ export interface Metrics {
40
40
  quality?: Quality;
41
41
  values?: MetricValues;
42
42
  language?: number;
43
+ provider?: string;
43
44
  analysed?: boolean;
44
45
  }
45
46
  export interface DirectoryMetrics extends Metrics {
@@ -60,6 +61,7 @@ export interface FileMetricsReport {
60
61
  readonly languages?: readonly {
61
62
  readonly id: string;
62
63
  readonly label?: string;
64
+ readonly color?: string;
63
65
  readonly analysed: boolean;
64
66
  }[];
65
67
  readonly churnWindow?: ChurnWindow & {
@@ -71,11 +71,6 @@ export interface ProfileRule {
71
71
  readonly level?: string;
72
72
  readonly help?: string;
73
73
  }
74
- export interface DetailsBundle {
75
- readonly schema: 'urn:repometry:schema:viewer-details:1';
76
- readonly context: Record<string, InspectionContext>;
77
- readonly inspections: Record<string, InspectionDetails>;
78
- }
79
74
  export interface InspectionAsset {
80
75
  readonly schema: 'urn:repometry:schema:viewer-inspection:1';
81
76
  readonly sha: string;
@@ -1,6 +1,5 @@
1
1
  import type { Report } from '../../../core/model/report.js';
2
2
  import type { QualitySummary } from '../../../core/model/quality-summary.js';
3
- export declare const historySchema = "urn:repometry:schema:public-history:1";
4
3
  export interface PublicHistoryEntry {
5
4
  readonly sha: string;
6
5
  readonly generatedAt: string;
@@ -26,12 +25,7 @@ export interface PublicHistoryEntry {
26
25
  } | null;
27
26
  }
28
27
  export declare function compareHistoryEntries(a: PublicHistoryEntry, b: PublicHistoryEntry): number;
29
- export interface PublicHistory {
30
- readonly schema: typeof historySchema;
31
- readonly reports: readonly PublicHistoryEntry[];
32
- }
33
28
  export interface QualityHistory {
34
- readonly schema: 'urn:repometry:schema:quality-history:1';
35
29
  readonly reports: Record<string, QualitySummary>;
36
30
  }
37
31
  export interface ComplexFunction {
@@ -1,4 +1,3 @@
1
- export const historySchema = 'urn:repometry:schema:public-history:1';
2
1
  export function compareHistoryEntries(a, b) {
3
2
  return Number(b.committedAt !== undefined) - Number(a.committedAt !== undefined)
4
3
  || (b.committedAt ?? b.generatedAt).localeCompare(a.committedAt ?? a.generatedAt)
@@ -1,9 +1,9 @@
1
- export { legacyReportSchema, readReport, reportSchema } from './report/json/validation/report.js';
1
+ export { readReport, reportSchema } from './report/json/validation/report.js';
2
2
  export type { Diagnostic, Report, ReportReader, ReportStore } from './report/json/validation/report.js';
3
3
  export type { ReportWriter } from './core/ports/report.js';
4
+ export { LocalOperationCache } from './report/json/store/operation-cache.js';
4
5
  export { validateSummary } from './report/json/validation/summary-validation.js';
5
- export { historySchema } from './report/json/wire/public-history-model.js';
6
- export type { PublicHistory, PublicHistoryEntry, QualityHistory } from './report/json/wire/public-history-model.js';
6
+ export type { PublicHistoryEntry } from './report/json/wire/public-history-model.js';
7
7
  export { summarySchema } from './report/json/wire/summary-model.js';
8
8
  export type { CommitSummary, RepositorySummary } from './report/json/wire/summary-model.js';
9
9
  export type { SourceLocator } from './report/json/wire/summary-model.js';
@@ -1,6 +1,6 @@
1
- export { legacyReportSchema, readReport, reportSchema } from './report/json/validation/report.js';
1
+ export { readReport, reportSchema } from './report/json/validation/report.js';
2
+ export { LocalOperationCache } from './report/json/store/operation-cache.js';
2
3
  export { validateSummary } from './report/json/validation/summary-validation.js';
3
- export { historySchema } from './report/json/wire/public-history-model.js';
4
4
  export { summarySchema } from './report/json/wire/summary-model.js';
5
5
  export { fileMetricsSchema } from './report/json/wire/file-metrics-model.js';
6
6
  //# sourceMappingURL=report.js.map
@@ -1,172 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:repometry:schema:inspection-context:1",
4
- "type": "object",
5
- "patternProperties": {
6
- "^(?:[a-f0-9]{40}|[a-f0-9]{64})$": {
7
- "$ref": "#/$defs/inspectionContext"
8
- }
9
- },
10
- "additionalProperties": false,
11
- "$defs": {
12
- "complexFunctions": {
13
- "type": "array",
14
- "maxItems": 5,
15
- "items": {
16
- "type": "object",
17
- "required": [
18
- "name",
19
- "path",
20
- "line",
21
- "complexity"
22
- ],
23
- "properties": {
24
- "name": {
25
- "type": "string"
26
- },
27
- "path": {
28
- "type": "string"
29
- },
30
- "line": {
31
- "type": [
32
- "integer",
33
- "null"
34
- ],
35
- "minimum": 1
36
- },
37
- "complexity": {
38
- "type": "number"
39
- }
40
- },
41
- "additionalProperties": false
42
- }
43
- },
44
- "inspectionContext": {
45
- "type": "object",
46
- "required": [
47
- "exclusions",
48
- "boundary"
49
- ],
50
- "properties": {
51
- "exclusions": {
52
- "type": [
53
- "object",
54
- "null"
55
- ],
56
- "required": [
57
- "paths",
58
- "directories"
59
- ],
60
- "properties": {
61
- "paths": {
62
- "type": "array",
63
- "items": {
64
- "type": "string"
65
- }
66
- },
67
- "directories": {
68
- "type": "array",
69
- "items": {
70
- "type": "string"
71
- }
72
- }
73
- },
74
- "additionalProperties": false
75
- },
76
- "boundary": {
77
- "enum": [
78
- null,
79
- "changed",
80
- "unavailable"
81
- ]
82
- },
83
- "scanners": {
84
- "type": "array",
85
- "items": {
86
- "type": "object",
87
- "required": [
88
- "name",
89
- "version"
90
- ],
91
- "properties": {
92
- "name": {
93
- "type": "string"
94
- },
95
- "version": {
96
- "type": [
97
- "string",
98
- "null"
99
- ]
100
- }
101
- },
102
- "additionalProperties": false
103
- }
104
- },
105
- "ignores": {
106
- "type": "object",
107
- "required": [
108
- "rules",
109
- "count"
110
- ],
111
- "properties": {
112
- "count": {
113
- "type": "integer",
114
- "minimum": 0
115
- },
116
- "rules": {
117
- "type": "array",
118
- "items": {
119
- "type": "object",
120
- "properties": {
121
- "tool": {
122
- "type": "string"
123
- },
124
- "rule": {
125
- "type": "string"
126
- },
127
- "path": {
128
- "type": "string"
129
- },
130
- "reason": {
131
- "type": "string"
132
- }
133
- },
134
- "additionalProperties": false
135
- }
136
- }
137
- },
138
- "additionalProperties": false
139
- },
140
- "security": {
141
- "type": "object",
142
- "required": [
143
- "low",
144
- "medium",
145
- "high",
146
- "unknown"
147
- ],
148
- "properties": {
149
- "low": {
150
- "type": "integer",
151
- "minimum": 0
152
- },
153
- "medium": {
154
- "type": "integer",
155
- "minimum": 0
156
- },
157
- "high": {
158
- "type": "integer",
159
- "minimum": 0
160
- },
161
- "unknown": {
162
- "type": "integer",
163
- "minimum": 0
164
- }
165
- },
166
- "additionalProperties": false
167
- }
168
- },
169
- "additionalProperties": false
170
- }
171
- }
172
- }
@@ -1,50 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:repometry:schema:public-history:1",
4
- "type": "object",
5
- "required": ["schema", "reports"],
6
- "properties": {
7
- "schema": { "const": "urn:repometry:schema:public-history:1" },
8
- "reports": {
9
- "type": "array",
10
- "items": {
11
- "type": "object",
12
- "required": ["sha", "generatedAt", "status", "files", "parsed", "lines", "functions", "maxComplexity", "lineCoverage"],
13
- "properties": {
14
- "sha": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" },
15
- "generatedAt": { "type": "string" },
16
- "committedAt": { "type": "string" },
17
- "subject": { "type": "string" },
18
- "author": {
19
- "type": "object",
20
- "required": ["name"],
21
- "additionalProperties": false,
22
- "properties": { "name": { "type": "string" }, "email": { "type": "string" } }
23
- },
24
- "tags": { "type": "array", "items": { "type": "string" } },
25
- "status": { "enum": ["complete", "partial", "not-applicable"] },
26
- "files": { "$ref": "#/$defs/count" },
27
- "parsed": { "$ref": "#/$defs/count" },
28
- "lines": { "$ref": "#/$defs/countOrMissing" },
29
- "functions": { "$ref": "#/$defs/countOrMissing" },
30
- "maxComplexity": { "$ref": "#/$defs/countOrMissing" },
31
- "lineCoverage": {
32
- "type": ["object", "null"],
33
- "required": ["covered", "total"],
34
- "properties": {
35
- "covered": { "$ref": "#/$defs/count" },
36
- "total": { "type": "integer", "minimum": 1 }
37
- },
38
- "additionalProperties": false
39
- }
40
- },
41
- "additionalProperties": false
42
- }
43
- }
44
- },
45
- "additionalProperties": false,
46
- "$defs": {
47
- "count": { "type": "integer", "minimum": 0 },
48
- "countOrMissing": { "type": ["integer", "null"], "minimum": 0 }
49
- }
50
- }
@@ -1,51 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:repometry:schema:quality-history:1",
4
- "type": "object",
5
- "required": ["schema", "reports"],
6
- "properties": {
7
- "schema": { "const": "urn:repometry:schema:quality-history:1" },
8
- "reports": {
9
- "type": "object",
10
- "patternProperties": { "^(?:[a-f0-9]{40}|[a-f0-9]{64})$": { "$ref": "#/$defs/quality" } },
11
- "additionalProperties": false
12
- }
13
- },
14
- "additionalProperties": false,
15
- "$defs": {
16
- "count": { "type": ["integer", "null"], "minimum": 0 },
17
- "ratio": { "type": ["number", "null"], "minimum": 0 },
18
- "quality": {
19
- "type": "object",
20
- "required": ["codeLines", "comments", "classes", "cognitiveComplexity", "duplication", "maintainability"],
21
- "properties": {
22
- "codeLines": { "$ref": "#/$defs/count" },
23
- "comments": { "$ref": "#/$defs/count" },
24
- "classes": { "$ref": "#/$defs/count" },
25
- "cognitiveComplexity": { "$ref": "#/$defs/count" },
26
- "duplication": {
27
- "type": ["object", "null"],
28
- "required": ["duplicatedLines", "codeLines", "ratio"],
29
- "properties": {
30
- "duplicatedLines": { "type": "integer", "minimum": 0 },
31
- "codeLines": { "type": "integer", "minimum": 0 },
32
- "ratio": { "type": ["number", "null"], "minimum": 0, "maximum": 1 }
33
- },
34
- "additionalProperties": false
35
- },
36
- "maintainability": {
37
- "type": ["object", "null"],
38
- "required": ["smells", "effortMinutes", "debtRatio", "grade"],
39
- "properties": {
40
- "smells": { "type": "integer", "minimum": 0 },
41
- "effortMinutes": { "type": "integer", "minimum": 0 },
42
- "debtRatio": { "$ref": "#/$defs/ratio" },
43
- "grade": { "enum": ["A", "B", "C", "D", "F", null] }
44
- },
45
- "additionalProperties": false
46
- }
47
- },
48
- "additionalProperties": false
49
- }
50
- }
51
- }
@@ -1,65 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:repometry:schema:report:1",
4
- "type": "object",
5
- "required": ["schema", "subject", "generatedAt", "appliedConfig", "definitions", "scope", "status", "measurements", "diagnostics"],
6
- "properties": {
7
- "schema": { "const": "urn:repometry:schema:report:1" },
8
- "subject": { "$ref": "#/$defs/subject" },
9
- "generatedAt": { "type": "string" },
10
- "appliedConfig": { "type": "object", "minProperties": 1 },
11
- "definitions": { "type": "object", "additionalProperties": { "type": "string" } },
12
- "scope": {
13
- "type": "object",
14
- "required": ["files", "parsed"],
15
- "properties": { "files": { "$ref": "#/$defs/count" }, "parsed": { "$ref": "#/$defs/count" } },
16
- "additionalProperties": false
17
- },
18
- "status": { "enum": ["complete", "partial", "not-applicable"] },
19
- "measurements": { "type": "array", "items": { "$ref": "#/$defs/measurement" } },
20
- "diagnostics": { "type": "array", "items": { "$ref": "#/$defs/diagnostic" } }
21
- },
22
- "additionalProperties": false,
23
- "$defs": {
24
- "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
25
- "subject": {
26
- "type": "object",
27
- "required": ["kind", "id"],
28
- "properties": { "kind": { "enum": ["commit", "working-tree"] }, "id": { "type": "string" } },
29
- "additionalProperties": false,
30
- "if": { "properties": { "kind": { "const": "commit" } } },
31
- "then": { "properties": { "id": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" } } },
32
- "else": { "properties": { "id": { "type": "string", "pattern": "^[a-f0-9]{64}$" } } }
33
- },
34
- "measurement": {
35
- "type": "object",
36
- "required": ["definition", "target", "value"],
37
- "properties": {
38
- "definition": { "type": "string", "minLength": 1 },
39
- "target": { "enum": ["repository", "file", "function"] },
40
- "value": { "type": ["number", "null"] },
41
- "path": { "type": "string", "minLength": 1 },
42
- "line": { "type": "integer", "minimum": 1 },
43
- "column": { "type": "integer", "minimum": 1 },
44
- "name": { "type": "string" },
45
- "covered": { "$ref": "#/$defs/count" },
46
- "total": { "$ref": "#/$defs/count" }
47
- },
48
- "dependentRequired": { "covered": ["total"], "total": ["covered"], "line": ["path"], "column": ["line"] },
49
- "if": { "properties": { "target": { "enum": ["file", "function"] } } },
50
- "then": { "required": ["path"] },
51
- "additionalProperties": false
52
- },
53
- "diagnostic": {
54
- "type": "object",
55
- "required": ["operation", "state", "message"],
56
- "properties": {
57
- "operation": { "type": "string" },
58
- "state": { "enum": ["failed", "blocked", "partial"] },
59
- "path": { "type": "string" },
60
- "message": { "type": "string" }
61
- },
62
- "additionalProperties": false
63
- }
64
- }
65
- }