@repometry/cli 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +70 -2
- package/package.json +75 -4
- package/target/main/resources/language-catalog.json +77 -0
- package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
- package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
- package/target/main/resources/report/json/config-v2.schema.json +224 -0
- package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
- package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
- package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
- package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
- package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
- package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
- package/target/main/resources/report/json/report-v2.schema.json +534 -0
- package/target/main/resources/report/json/repository-summary-v1.schema.json +341 -0
- package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
- package/target/main/resources/viewer/files.css +616 -0
- package/target/main/resources/viewer/index.html +120 -0
- package/target/main/resources/viewer/projects.html +52 -0
- package/target/main/resources/viewer/styles.css +579 -0
- package/target/main/resources/viewer/viewer-pulls.css +64 -0
- package/target/main/ts/api/cache/root.d.ts +2 -0
- package/target/main/ts/api/cache/root.js +21 -0
- package/target/main/ts/api/gh/github.d.ts +4 -0
- package/target/main/ts/api/gh/github.js +47 -0
- package/target/main/ts/api/git/blob-batch.d.ts +10 -0
- package/target/main/ts/api/git/blob-batch.js +107 -0
- 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/changes.d.ts +27 -0
- package/target/main/ts/api/git/changes.js +117 -0
- package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
- package/target/main/ts/api/git/commit-metadata.js +46 -0
- package/target/main/ts/api/git/git-churn.d.ts +9 -0
- package/target/main/ts/api/git/git-churn.js +72 -0
- 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-reader.d.ts +24 -0
- package/target/main/ts/api/git/git-reader.js +113 -0
- package/target/main/ts/api/git/git.d.ts +47 -0
- package/target/main/ts/api/git/git.js +289 -0
- package/target/main/ts/api/git/inspection-source.d.ts +17 -0
- package/target/main/ts/api/git/inspection-source.js +36 -0
- package/target/main/ts/api/git/line-changes.d.ts +6 -0
- package/target/main/ts/api/git/line-changes.js +57 -0
- package/target/main/ts/api/git/local-sources.d.ts +5 -0
- package/target/main/ts/api/git/local-sources.js +48 -0
- package/target/main/ts/api/git/local.d.ts +7 -0
- package/target/main/ts/api/git/local.js +106 -0
- package/target/main/ts/api/git/source-cache.d.ts +1 -0
- package/target/main/ts/api/git/source-cache.js +42 -0
- package/target/main/ts/api/import/cobertura.d.ts +2 -0
- package/target/main/ts/api/import/cobertura.js +160 -0
- package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
- package/target/main/ts/api/import/coverage-xml.js +135 -0
- package/target/main/ts/api/import/finding-import.d.ts +9 -0
- package/target/main/ts/api/import/finding-import.js +227 -0
- package/target/main/ts/api/import/go-cover.d.ts +13 -0
- package/target/main/ts/api/import/go-cover.js +150 -0
- package/target/main/ts/api/import/lcov-files.d.ts +12 -0
- package/target/main/ts/api/import/lcov-files.js +53 -0
- package/target/main/ts/api/import/profile-file.d.ts +4 -0
- package/target/main/ts/api/import/profile-file.js +17 -0
- package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
- package/target/main/ts/api/process/docker-tool-runner.js +92 -0
- package/target/main/ts/api/process/failure.d.ts +1 -0
- package/target/main/ts/api/process/failure.js +12 -0
- package/target/main/ts/api/process/plugin.d.ts +13 -0
- package/target/main/ts/api/process/plugin.js +100 -0
- package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
- package/target/main/ts/api/process/tool-snapshot.js +26 -0
- package/target/main/ts/cli/arguments.d.ts +28 -0
- package/target/main/ts/cli/arguments.js +109 -0
- package/target/main/ts/cli/config.d.ts +63 -0
- package/target/main/ts/cli/config.js +165 -0
- package/target/main/ts/cli/imports.d.ts +9 -0
- package/target/main/ts/cli/imports.js +37 -0
- package/target/main/ts/cli/main.d.ts +2 -0
- package/target/main/ts/cli/main.js +4 -0
- package/target/main/ts/cli/range-inspection.d.ts +38 -0
- package/target/main/ts/cli/range-inspection.js +34 -0
- package/target/main/ts/cli/range-jobs.d.ts +23 -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 +40 -0
- package/target/main/ts/cli/reporting.d.ts +42 -0
- package/target/main/ts/cli/reporting.js +98 -0
- package/target/main/ts/cli/revisions.d.ts +6 -0
- package/target/main/ts/cli/revisions.js +16 -0
- package/target/main/ts/cli/run.d.ts +2 -0
- package/target/main/ts/cli/run.js +306 -0
- package/target/main/ts/cli/store.d.ts +13 -0
- package/target/main/ts/cli/store.js +39 -0
- package/target/main/ts/compose/analysis-report.d.ts +6 -0
- package/target/main/ts/compose/analysis-report.js +132 -0
- package/target/main/ts/compose/analysis-results.d.ts +46 -0
- package/target/main/ts/compose/analysis-results.js +119 -0
- package/target/main/ts/compose/analysis-steps.d.ts +23 -0
- package/target/main/ts/compose/analysis-steps.js +217 -0
- package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
- package/target/main/ts/compose/analyze-snapshot.js +21 -0
- package/target/main/ts/compose/attach-churn.d.ts +2 -0
- package/target/main/ts/compose/attach-churn.js +50 -0
- package/target/main/ts/compose/built-ins.d.ts +6 -0
- package/target/main/ts/compose/built-ins.js +12 -0
- package/target/main/ts/compose/diff-coverage.d.ts +25 -0
- package/target/main/ts/compose/diff-coverage.js +82 -0
- package/target/main/ts/compose/distribution.d.ts +17 -0
- package/target/main/ts/compose/distribution.js +13 -0
- package/target/main/ts/compose/docker-image.d.ts +5 -0
- package/target/main/ts/compose/docker-image.js +49 -0
- package/target/main/ts/compose/file-selection.d.ts +9 -0
- package/target/main/ts/compose/file-selection.js +38 -0
- package/target/main/ts/compose/history-cache.d.ts +31 -0
- package/target/main/ts/compose/history-cache.js +62 -0
- package/target/main/ts/compose/inspect.d.ts +34 -0
- package/target/main/ts/compose/inspect.js +51 -0
- package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
- package/target/main/ts/compose/inspection-coverage.js +9 -0
- package/target/main/ts/compose/js-plugin.d.ts +113 -0
- package/target/main/ts/compose/js-plugin.js +99 -0
- package/target/main/ts/compose/language-discovery.d.ts +12 -0
- package/target/main/ts/compose/language-discovery.js +51 -0
- package/target/main/ts/compose/languages.d.ts +64 -0
- package/target/main/ts/compose/languages.js +98 -0
- package/target/main/ts/compose/load-plugins.d.ts +6 -0
- package/target/main/ts/compose/load-plugins.js +71 -0
- package/target/main/ts/compose/parser-order.d.ts +20 -0
- package/target/main/ts/compose/parser-order.js +90 -0
- package/target/main/ts/compose/phases.d.ts +140 -0
- package/target/main/ts/compose/phases.js +147 -0
- package/target/main/ts/compose/plugin-list.d.ts +37 -0
- package/target/main/ts/compose/plugin-list.js +30 -0
- package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
- package/target/main/ts/compose/plugin-manifest.js +50 -0
- package/target/main/ts/compose/plugin-options.d.ts +2 -0
- package/target/main/ts/compose/plugin-options.js +29 -0
- package/target/main/ts/compose/plugin-reference.d.ts +9 -0
- package/target/main/ts/compose/plugin-reference.js +40 -0
- package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
- package/target/main/ts/compose/plugin-requirements.js +83 -0
- package/target/main/ts/compose/plugin-scope.d.ts +9 -0
- package/target/main/ts/compose/plugin-scope.js +60 -0
- package/target/main/ts/compose/process-plugins.d.ts +89 -0
- package/target/main/ts/compose/process-plugins.js +74 -0
- package/target/main/ts/compose/registered-plugin.d.ts +17 -0
- package/target/main/ts/compose/registered-plugin.js +8 -0
- package/target/main/ts/compose/review.d.ts +26 -0
- package/target/main/ts/compose/review.js +54 -0
- package/target/main/ts/compose/schema-error.d.ts +2 -0
- package/target/main/ts/compose/schema-error.js +16 -0
- package/target/main/ts/compose/sources.d.ts +2 -0
- package/target/main/ts/compose/sources.js +32 -0
- package/target/main/ts/compose/structure-measures.d.ts +9 -0
- package/target/main/ts/compose/structure-measures.js +63 -0
- package/target/main/ts/index.d.ts +8 -0
- package/target/main/ts/index.js +5 -0
- package/target/main/ts/plugin.d.ts +2 -0
- package/target/main/ts/plugin.js +2 -0
- package/target/main/ts/plugins/built-in.d.ts +3 -0
- package/target/main/ts/plugins/built-in.js +19 -0
- package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
- package/target/main/ts/plugins/coverage/coverage.js +289 -0
- package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
- package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
- package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
- package/target/main/ts/plugins/duplication/duplication.js +95 -0
- package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
- package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
- package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
- package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
- package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
- package/target/main/ts/plugins/language-js/code-lines.js +36 -0
- package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
- package/target/main/ts/plugins/language-js/extensions.js +3 -0
- package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
- package/target/main/ts/plugins/language-js/function-facts.js +74 -0
- package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
- package/target/main/ts/plugins/language-js/js-security.js +497 -0
- package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
- package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
- package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
- package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
- package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
- package/target/main/ts/plugins/language-js/syntax.js +11 -0
- package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
- package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
- package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
- package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
- package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
- package/target/main/ts/plugins/security/actions-security.js +581 -0
- package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
- package/target/main/ts/plugins/security/dockerfile.js +487 -0
- package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
- package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
- package/target/main/ts/plugins/security/secrets.d.ts +12 -0
- package/target/main/ts/plugins/security/secrets.js +254 -0
- package/target/main/ts/plugins/source/forges.d.ts +4 -0
- package/target/main/ts/plugins/source/forges.js +80 -0
- package/target/main/ts/plugins/structure/structure.d.ts +2 -0
- package/target/main/ts/plugins/structure/structure.js +42 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
- package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
- package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
- package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
- package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
- package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
- package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
- package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
- package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-chart.js +50 -0
- package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
- package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
- package/target/main/ts/report/html/app/viewer-columns.js +97 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
- package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-commits.js +81 -0
- package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
- package/target/main/ts/report/html/app/viewer-controls.js +141 -0
- package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-copy.js +64 -0
- package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-data.js +78 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
- package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-dom.js +99 -0
- package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
- package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
- package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
- package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-files.js +40 -0
- package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
- package/target/main/ts/report/html/app/viewer-filter.js +161 -0
- package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
- package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
- package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
- package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
- package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-issues.js +173 -0
- package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
- package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
- package/target/main/ts/report/html/app/viewer-languages.js +97 -0
- package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
- package/target/main/ts/report/html/app/viewer-layout.js +134 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
- package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
- package/target/main/ts/report/html/app/viewer-locations.js +31 -0
- package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
- package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
- package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
- package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
- package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
- package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
- package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
- package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
- package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
- package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-profile.js +180 -0
- package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer-projects.js +90 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
- package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
- package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
- package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
- package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
- package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
- package/target/main/ts/report/html/app/viewer-route.js +55 -0
- package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-shell.js +113 -0
- package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
- package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
- package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-source.js +57 -0
- package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
- package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
- package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
- package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
- package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
- package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
- package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-totals.js +100 -0
- package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
- package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
- package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
- package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
- package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
- package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
- package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trends.js +89 -0
- package/target/main/ts/report/html/app/viewer.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer.js +222 -0
- package/target/main/ts/report/html/site/badges.d.ts +11 -0
- package/target/main/ts/report/html/site/badges.js +72 -0
- package/target/main/ts/report/html/site/export-site.d.ts +16 -0
- package/target/main/ts/report/html/site/export-site.js +129 -0
- package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
- package/target/main/ts/report/html/site/exported-server.js +72 -0
- package/target/main/ts/report/html/site/local-server.d.ts +7 -0
- package/target/main/ts/report/html/site/local-server.js +59 -0
- package/target/main/ts/report/html/site/projects.d.ts +1 -0
- package/target/main/ts/report/html/site/projects.js +69 -0
- package/target/main/ts/report/html/site/server.d.ts +4 -0
- package/target/main/ts/report/html/site/server.js +65 -0
- package/target/main/ts/report/html/site/source-route.d.ts +6 -0
- package/target/main/ts/report/html/site/source-route.js +23 -0
- package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
- package/target/main/ts/report/json/projections/commit-summary.js +126 -0
- package/target/main/ts/report/json/projections/components.d.ts +4 -0
- package/target/main/ts/report/json/projections/components.js +30 -0
- package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
- package/target/main/ts/report/json/projections/file-metrics.js +260 -0
- package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
- package/target/main/ts/report/json/projections/ignore-view.js +13 -0
- package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
- package/target/main/ts/report/json/projections/inspection-context.js +104 -0
- package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
- package/target/main/ts/report/json/projections/inspection-details.js +98 -0
- package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
- package/target/main/ts/report/json/projections/metric-values.js +104 -0
- package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
- package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
- package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
- package/target/main/ts/report/json/projections/security-summary.js +22 -0
- package/target/main/ts/report/json/store/directory.d.ts +3 -0
- package/target/main/ts/report/json/store/directory.js +19 -0
- package/target/main/ts/report/json/store/local-store.d.ts +25 -0
- package/target/main/ts/report/json/store/local-store.js +214 -0
- package/target/main/ts/report/json/store/object-store.d.ts +14 -0
- package/target/main/ts/report/json/store/object-store.js +73 -0
- package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
- package/target/main/ts/report/json/store/operation-cache.js +32 -0
- package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
- package/target/main/ts/report/json/store/pull-review-store.js +33 -0
- package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
- package/target/main/ts/report/json/store/replace-file.js +35 -0
- package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
- package/target/main/ts/report/json/store/report-tree.js +295 -0
- package/target/main/ts/report/json/store/store-check.d.ts +32 -0
- package/target/main/ts/report/json/store/store-check.js +153 -0
- package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
- package/target/main/ts/report/json/validation/metabranch.js +11 -0
- package/target/main/ts/report/json/validation/report.d.ts +20 -0
- package/target/main/ts/report/json/validation/report.js +82 -0
- package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
- package/target/main/ts/report/json/validation/summary-validation.js +30 -0
- package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
- package/target/main/ts/report/json/wire/compact-json.js +76 -0
- package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
- package/target/main/ts/report/json/wire/component-model.js +1 -0
- package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
- package/target/main/ts/report/json/wire/domain-types.js +1 -0
- package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
- package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
- package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
- package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
- package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
- package/target/main/ts/report/json/wire/project-model.js +1 -0
- package/target/main/ts/report/json/wire/public-history-model.d.ts +37 -0
- package/target/main/ts/report/json/wire/public-history-model.js +5 -0
- package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
- package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
- package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
- package/target/main/ts/report/json/wire/summary-model.js +1 -0
- package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
- package/target/main/ts/report/markdown/pull-review.js +132 -0
- package/target/main/ts/report.d.ts +23 -0
- package/target/main/ts/report.js +12 -0
- package/target/main/ts/runtime.d.ts +17 -0
- package/target/main/ts/runtime.js +30 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { element } from './viewer-dom.js';
|
|
2
|
+
import { bandLabels as pluginBandLabels, bandOf, bandScale } from './viewer-metric-format.js';
|
|
3
|
+
import { labelOf, pluginSpec } from './viewer-metrics.js';
|
|
4
|
+
import { ancestors } from './viewer-totals.js';
|
|
5
|
+
const bandMeaning = {
|
|
6
|
+
complexity: 'Colour shows the most complex function.',
|
|
7
|
+
cognitive: 'Colour shows cognitive complexity relative to the highest file, or folder at the same depth.',
|
|
8
|
+
missedLines: 'Colour shows the share of uncovered lines.',
|
|
9
|
+
duplication: 'Colour shows the share of duplicated code lines.',
|
|
10
|
+
churn: 'Colour shows Git changes relative to the busiest file, or folder at the same depth.',
|
|
11
|
+
};
|
|
12
|
+
/** The band limits used when the profile sets none. */
|
|
13
|
+
const defaultLimits = { complexity: [5, 10, 20, 50], missedLines: [.05, .15, .3, .5], duplication: [.03, .1, .25] };
|
|
14
|
+
const scaled = (metric) => metric in defaultLimits;
|
|
15
|
+
const rankTitles = {
|
|
16
|
+
complexity: labelOf('complexity'),
|
|
17
|
+
cognitive: labelOf('cognitive'),
|
|
18
|
+
missedLines: 'Uncovered lines',
|
|
19
|
+
duplication: 'Duplicated lines',
|
|
20
|
+
churn: 'Git changes',
|
|
21
|
+
};
|
|
22
|
+
/** What a metric is called where files are ranked by it. */
|
|
23
|
+
export function rankTitle(metric) {
|
|
24
|
+
return pluginSpec(metric)?.label ?? rankTitles[metric];
|
|
25
|
+
}
|
|
26
|
+
export function scoreLabel(metric) {
|
|
27
|
+
return rankTitle(metric).toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
function ascending(values) {
|
|
30
|
+
return values.every((value, index) => Number.isFinite(value) && (index === 0 || value > values[index - 1]));
|
|
31
|
+
}
|
|
32
|
+
/** The profile's limits for a metric with a meaningful scale, when they are well formed; otherwise the defaults. */
|
|
33
|
+
export function bandLimits(details, metric) {
|
|
34
|
+
if (!scaled(metric))
|
|
35
|
+
return undefined;
|
|
36
|
+
const given = details.bands?.[metric];
|
|
37
|
+
return given?.length === defaultLimits[metric].length && ascending(given) ? given : defaultLimits[metric];
|
|
38
|
+
}
|
|
39
|
+
/** The legend's words for the bands, written from the limits: 1–5, 6–10 … 51+, or <5%, 5–15% … 50%+. */
|
|
40
|
+
function bandLabels(metric, limits) {
|
|
41
|
+
const percent = (value) => `${+(value * 100).toFixed(1)}%`;
|
|
42
|
+
if (metric === 'complexity') {
|
|
43
|
+
return [...limits.map((limit, index) => `${index === 0 ? 1 : limits[index - 1] + 1}–${limit}`), `${limits.at(-1) + 1}+`];
|
|
44
|
+
}
|
|
45
|
+
const ranges = [...limits.map((limit, index) => index === 0 ? `<${percent(limit)}`
|
|
46
|
+
: `${percent(limits[index - 1]).replace('%', '')}–${percent(limit)}`), `${percent(limits.at(-1))}+`];
|
|
47
|
+
return metric === 'duplication' ? ['0%', ...ranges] : ranges;
|
|
48
|
+
}
|
|
49
|
+
/** What the map's colour shows, said to assistive technology. */
|
|
50
|
+
export function meaningOf(metric) {
|
|
51
|
+
const plugin = pluginSpec(metric);
|
|
52
|
+
if (!plugin)
|
|
53
|
+
return bandMeaning[metric];
|
|
54
|
+
return `Colour shows ${plugin.label.toLowerCase()}${plugin.descriptor.bands ? '' : ' relative to the highest file, or folder at the same depth'}.`;
|
|
55
|
+
}
|
|
56
|
+
function step(value, bounds) {
|
|
57
|
+
const index = bounds.findIndex(limit => value <= limit);
|
|
58
|
+
return index < 0 ? bounds.length : index;
|
|
59
|
+
}
|
|
60
|
+
/** The share of a count the score is, or none where the file counts nothing. */
|
|
61
|
+
function share(score, whole) {
|
|
62
|
+
return whole && whole > 0 ? score / whole : null;
|
|
63
|
+
}
|
|
64
|
+
const scales = {
|
|
65
|
+
complexity: (_, score, limits) => step(score, limits),
|
|
66
|
+
missedLines: (entry, score, limits) => {
|
|
67
|
+
const ratio = share(score, entry.lineCoverage?.total);
|
|
68
|
+
return ratio === null ? 0 : step(ratio, limits);
|
|
69
|
+
},
|
|
70
|
+
duplication: (entry, score, limits) => {
|
|
71
|
+
const ratio = share(score, entry.quality?.codeLines);
|
|
72
|
+
return score === 0 || ratio === null ? 0 : 1 + step(ratio, limits);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
/** Maps a score to one of five colour bands: by the profile's limits where the metric has a meaningful scale. */
|
|
76
|
+
export function band(entry, metric, score, highest, limits = scaled(metric) ? defaultLimits[metric] : undefined) {
|
|
77
|
+
const plugin = pluginSpec(metric);
|
|
78
|
+
if (plugin)
|
|
79
|
+
return bandOf(plugin, score, highest);
|
|
80
|
+
const scale = scales[metric];
|
|
81
|
+
return scale ? scale(entry, score, limits) : Math.min(4, Math.floor(score / highest * 5));
|
|
82
|
+
}
|
|
83
|
+
/** Each file's worst level spread to the folders above it. */
|
|
84
|
+
export function spreadLevels(files) {
|
|
85
|
+
const spread = new Map(files);
|
|
86
|
+
for (const [path, level] of files)
|
|
87
|
+
for (const folder of ancestors(path))
|
|
88
|
+
spread.set(folder, Math.max(level, spread.get(folder) ?? 0));
|
|
89
|
+
return spread;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The top of a relative colour scale, per level: files against files, folders against the folders at their depth. One
|
|
93
|
+
* scale for both would let a folder's sum outshine every file in it, and the map would read hot folders over pale files.
|
|
94
|
+
*/
|
|
95
|
+
export function relativePeaks(entries) {
|
|
96
|
+
const level = (path, folder) => folder ? `folder:${path.split('/').length}` : 'file';
|
|
97
|
+
const peaks = new Map();
|
|
98
|
+
for (const { path, folder, score } of entries)
|
|
99
|
+
peaks.set(level(path, folder), Math.max(peaks.get(level(path, folder)) ?? 1, score ?? 0));
|
|
100
|
+
return (path, folder) => peaks.get(level(path, folder)) ?? 1;
|
|
101
|
+
}
|
|
102
|
+
function swatches() {
|
|
103
|
+
const bar = element('span', 'fx-scale-bar');
|
|
104
|
+
bar.setAttribute('aria-hidden', 'true');
|
|
105
|
+
for (let index = 0; index < 5; index++) {
|
|
106
|
+
const swatch = element('span');
|
|
107
|
+
swatch.dataset.band = String(index);
|
|
108
|
+
bar.append(swatch);
|
|
109
|
+
}
|
|
110
|
+
return bar;
|
|
111
|
+
}
|
|
112
|
+
/** Each word stands under its band. */
|
|
113
|
+
function labelledScale(legend, labels) {
|
|
114
|
+
legend.classList.add('fx-scale-labelled');
|
|
115
|
+
const words = element('span', 'fx-scale-words');
|
|
116
|
+
words.append(...labels.map(label => element('span', '', label)));
|
|
117
|
+
legend.append(swatches(), words);
|
|
118
|
+
return legend;
|
|
119
|
+
}
|
|
120
|
+
export function levelLegend() {
|
|
121
|
+
const legend = element('p', 'fx-scale fx-note');
|
|
122
|
+
legend.dataset.palette = 'grade';
|
|
123
|
+
return labelledScale(legend, ['None', 'Low', 'Medium', 'High', 'Critical']);
|
|
124
|
+
}
|
|
125
|
+
function legendLabels(metric, limits) {
|
|
126
|
+
const plugin = pluginSpec(metric);
|
|
127
|
+
if (plugin)
|
|
128
|
+
return pluginBandLabels(plugin) ?? undefined;
|
|
129
|
+
return scaled(metric) && limits ? bandLabels(metric, limits) : undefined;
|
|
130
|
+
}
|
|
131
|
+
export function sunburstLegend(metric, limits) {
|
|
132
|
+
const legend = element('p', 'fx-scale fx-note');
|
|
133
|
+
const labels = legendLabels(metric, limits);
|
|
134
|
+
if (labels)
|
|
135
|
+
return labelledScale(legend, labels);
|
|
136
|
+
legend.append(element('span', '', 'Lower'), swatches(), element('span', '', 'Higher'));
|
|
137
|
+
return legend;
|
|
138
|
+
}
|
|
139
|
+
/** The map's colours: grade steps for security, grey for nothing measured, heat where higher is worse, else neutral. */
|
|
140
|
+
export function palette(metric, levels, grey) {
|
|
141
|
+
if (levels)
|
|
142
|
+
return 'grade';
|
|
143
|
+
if (grey)
|
|
144
|
+
return 'none';
|
|
145
|
+
const plugin = pluginSpec(metric);
|
|
146
|
+
return (plugin ? bandScale(plugin) === 'heat' : metric !== 'churn') ? 'heat' : 'neutral';
|
|
147
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Metrics } from './viewer-inspection.js';
|
|
2
|
+
/** Rings (a sunburst) or tiles (a treemap); the last choice is remembered for this viewer. */
|
|
3
|
+
export type MapShape = 'rings' | 'tiles';
|
|
4
|
+
/** A file or folder on the map: its area, and the score its colour is read from; null where it was not measured. */
|
|
5
|
+
export interface Branch {
|
|
6
|
+
readonly entry: Metrics;
|
|
7
|
+
readonly folder: boolean;
|
|
8
|
+
readonly area: number;
|
|
9
|
+
readonly score: number | null;
|
|
10
|
+
}
|
|
11
|
+
/** What the ring and tile layouts draw with. */
|
|
12
|
+
export interface MapDraw {
|
|
13
|
+
/** The map's tree: each folder's children, by path. */
|
|
14
|
+
readonly byParent: ReadonlyMap<string, readonly Branch[]>;
|
|
15
|
+
/** How many levels the map shows below its root. */
|
|
16
|
+
readonly depth: number;
|
|
17
|
+
/** How many wedges or tiles are drawn so far. */
|
|
18
|
+
readonly drawn: number;
|
|
19
|
+
shade(branch: Branch): number | 'none';
|
|
20
|
+
/** Draws a branch by its outline, shaded, linked and wired to the readout. */
|
|
21
|
+
tile(branch: Branch, outline: string): SVGAElement;
|
|
22
|
+
}
|
|
23
|
+
export declare const chartCenter = 200;
|
|
24
|
+
export declare const innerRadius = 47;
|
|
25
|
+
export declare const outerRadius = 196;
|
|
26
|
+
export declare const fullCircle: number;
|
|
27
|
+
export declare const startAngle: number;
|
|
28
|
+
export declare function mapShape(): MapShape;
|
|
29
|
+
/** The switch between the two shapes, remembering the choice before the map redraws. */
|
|
30
|
+
export declare function shapeSwitch(shape: MapShape, change: (shape: MapShape) => void): HTMLElement;
|
|
31
|
+
/**
|
|
32
|
+
* The compact map's stand-in while the inspection loads: the same frame, switch and canvas size in a flat tone, so the
|
|
33
|
+
* column keeps its shape and the map fades in where it will stand.
|
|
34
|
+
*/
|
|
35
|
+
export declare function mapStub(): HTMLElement;
|
|
36
|
+
/** A ring sector between two angles; the whole circle is drawn as two halves, since one arc cannot close on itself. */
|
|
37
|
+
export declare function sectorPath(inner: number, outer: number, first: number, last: number): string;
|
|
38
|
+
/**
|
|
39
|
+
* The readout under the map, filled on hover or focus: values appear only there, so the map does not repeat the
|
|
40
|
+
* ranking beside it. The pointed place keeps its colour together with its parents and its contents; the rest fades.
|
|
41
|
+
*/
|
|
42
|
+
export declare function readout(canvas: SVGSVGElement, summary: HTMLElement, words: (branch: Branch) => string): (branch: Branch, tile: SVGAElement) => void;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { segmented } from './viewer-controls.js';
|
|
2
|
+
import { element, store, stored, svgElement } from './viewer-dom.js';
|
|
3
|
+
export const chartCenter = 200;
|
|
4
|
+
export const innerRadius = 47;
|
|
5
|
+
export const outerRadius = 196;
|
|
6
|
+
export const fullCircle = 2 * Math.PI;
|
|
7
|
+
export const startAngle = -Math.PI / 2;
|
|
8
|
+
const shapeKey = 'repometry.map';
|
|
9
|
+
export function mapShape() {
|
|
10
|
+
return stored(() => localStorage, shapeKey) === 'tiles' ? 'tiles' : 'rings';
|
|
11
|
+
}
|
|
12
|
+
/** The switch between the two shapes, remembering the choice before the map redraws. */
|
|
13
|
+
export function shapeSwitch(shape, change) {
|
|
14
|
+
return segmented('Map shape', [['rings', 'Sunburst'], ['tiles', 'Treemap']], shape, value => {
|
|
15
|
+
store(() => localStorage, shapeKey, value);
|
|
16
|
+
change(value);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function stubCanvas(shape) {
|
|
20
|
+
const canvas = svgElement('svg');
|
|
21
|
+
canvas.classList.add('fx-sunburst-chart');
|
|
22
|
+
canvas.setAttribute('aria-hidden', 'true');
|
|
23
|
+
if (shape === 'tiles') {
|
|
24
|
+
canvas.classList.add('fx-treemap');
|
|
25
|
+
canvas.setAttribute('viewBox', '0 0 400 320');
|
|
26
|
+
const tile = svgElement('rect');
|
|
27
|
+
tile.setAttribute('width', '400');
|
|
28
|
+
tile.setAttribute('height', '320');
|
|
29
|
+
tile.setAttribute('rx', '3');
|
|
30
|
+
canvas.append(tile);
|
|
31
|
+
return canvas;
|
|
32
|
+
}
|
|
33
|
+
canvas.setAttribute('viewBox', '0 0 400 400');
|
|
34
|
+
const ring = svgElement('circle');
|
|
35
|
+
ring.setAttribute('cx', '200');
|
|
36
|
+
ring.setAttribute('cy', '200');
|
|
37
|
+
ring.setAttribute('r', String((outerRadius + innerRadius) / 2));
|
|
38
|
+
ring.setAttribute('stroke-width', String(outerRadius - innerRadius));
|
|
39
|
+
canvas.append(ring);
|
|
40
|
+
return canvas;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The compact map's stand-in while the inspection loads: the same frame, switch and canvas size in a flat tone, so the
|
|
44
|
+
* column keeps its shape and the map fades in where it will stand.
|
|
45
|
+
*/
|
|
46
|
+
export function mapStub() {
|
|
47
|
+
const shape = mapShape();
|
|
48
|
+
const panel = element('section', 'fx-sunburst fx-sunburst-compact fx-map-stub');
|
|
49
|
+
panel.dataset.shape = shape;
|
|
50
|
+
panel.setAttribute('aria-busy', 'true');
|
|
51
|
+
const heading = element('div', 'fx-map-heading');
|
|
52
|
+
heading.append(shapeSwitch(shape, () => panel.replaceWith(mapStub())));
|
|
53
|
+
panel.append(heading, stubCanvas(shape), element('p', 'fx-map-summary fx-map-hint fx-map-hint-quiet'));
|
|
54
|
+
return panel;
|
|
55
|
+
}
|
|
56
|
+
/** A ring sector between two angles; the whole circle is drawn as two halves, since one arc cannot close on itself. */
|
|
57
|
+
export function sectorPath(inner, outer, first, last) {
|
|
58
|
+
const large = last - first > Math.PI ? 1 : 0;
|
|
59
|
+
const radius = (r, angle) => `${(chartCenter + r * Math.cos(angle)).toFixed(3)},${(chartCenter + r * Math.sin(angle)).toFixed(3)}`;
|
|
60
|
+
if (last - first >= fullCircle - 0.00001) {
|
|
61
|
+
const middle = first + Math.PI;
|
|
62
|
+
return `M${radius(outer, first)} A${outer},${outer} 0 1 1 ${radius(outer, middle)} A${outer},${outer} 0 1 1 ${radius(outer, first)}
|
|
63
|
+
M${radius(inner, first)} A${inner},${inner} 0 1 0 ${radius(inner, middle)} A${inner},${inner} 0 1 0 ${radius(inner, first)} Z`;
|
|
64
|
+
}
|
|
65
|
+
return `M${radius(outer, first)} A${outer},${outer} 0 ${large} 1 ${radius(outer, last)}
|
|
66
|
+
L${radius(inner, last)} A${inner},${inner} 0 ${large} 0 ${radius(inner, first)} Z`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The readout under the map, filled on hover or focus: values appear only there, so the map does not repeat the
|
|
70
|
+
* ranking beside it. The pointed place keeps its colour together with its parents and its contents; the rest fades.
|
|
71
|
+
*/
|
|
72
|
+
export function readout(canvas, summary, words) {
|
|
73
|
+
// One outline drawn above every wedge, so neighbours never paint over it.
|
|
74
|
+
const outline = svgElement('path');
|
|
75
|
+
outline.classList.add('fx-wedge-outline');
|
|
76
|
+
outline.setAttribute('aria-hidden', 'true');
|
|
77
|
+
const reset = () => {
|
|
78
|
+
canvas.removeAttribute('data-inspecting');
|
|
79
|
+
for (const wedge of canvas.querySelectorAll('.fx-wedge[data-related]'))
|
|
80
|
+
wedge.removeAttribute('data-related');
|
|
81
|
+
outline.remove();
|
|
82
|
+
summary.classList.add('fx-map-hint');
|
|
83
|
+
summary.textContent = '';
|
|
84
|
+
};
|
|
85
|
+
canvas.addEventListener('pointerleave', reset);
|
|
86
|
+
canvas.addEventListener('focusout', event => {
|
|
87
|
+
if (!canvas.contains(event.relatedTarget))
|
|
88
|
+
reset();
|
|
89
|
+
});
|
|
90
|
+
return (branch, tile) => {
|
|
91
|
+
const own = branch.entry.path;
|
|
92
|
+
canvas.setAttribute('data-inspecting', '');
|
|
93
|
+
for (const wedge of canvas.querySelectorAll('.fx-wedge')) {
|
|
94
|
+
const other = wedge.dataset.path;
|
|
95
|
+
wedge.toggleAttribute('data-related', other === own || own.startsWith(`${other}/`) || other.startsWith(`${own}/`));
|
|
96
|
+
}
|
|
97
|
+
outline.setAttribute('d', tile.querySelector('path').getAttribute('d'));
|
|
98
|
+
canvas.append(outline);
|
|
99
|
+
summary.classList.remove('fx-map-hint');
|
|
100
|
+
summary.replaceChildren(element('code', 'fx-path', own), element('strong', '', words(branch)));
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Direction, MetricSpec } from './viewer-metric-registry.js';
|
|
2
|
+
/** Remediation time in hours and minutes: 45 min, 2 h, 3 h 20 min. */
|
|
3
|
+
export declare function duration(minutes: number): string;
|
|
4
|
+
export declare function format(spec: MetricSpec, value: number | null): string;
|
|
5
|
+
/** The signed change between two values: percentage points for a ratio, coloured only where the metric has a better. */
|
|
6
|
+
export declare function difference(spec: MetricSpec, value: number, before: number): {
|
|
7
|
+
text: string;
|
|
8
|
+
direction: Direction;
|
|
9
|
+
};
|
|
10
|
+
/** The first click on a column sorts worst first. */
|
|
11
|
+
export declare function firstSortAscending(spec: MetricSpec): boolean;
|
|
12
|
+
/** Missing values sort last in both directions. */
|
|
13
|
+
export declare function compareValues(ascending: boolean): (a: number | null, b: number | null) => number;
|
|
14
|
+
/** The colour scale: heat where the metric has a better, so the worst is always red; neutral greys where it has none. */
|
|
15
|
+
export declare function bandScale(spec: MetricSpec): 'heat' | 'neutral';
|
|
16
|
+
/**
|
|
17
|
+
* One of five bands, 0 best to 4 worst. Fixed by the descriptor's limits where it has them; otherwise relative to the
|
|
18
|
+
* highest value shown. A metric where higher is better turns the scale round. A limit belongs to the better side: at
|
|
19
|
+
* most 5 is the best complexity band, 90% is already the best coverage band.
|
|
20
|
+
*/
|
|
21
|
+
export declare function bandOf(spec: MetricSpec, value: number, highest: number): number;
|
|
22
|
+
/** The legend's words, best band first; null where the bands are relative and the legend reads Lower … Higher. */
|
|
23
|
+
export declare function bandLabels(spec: MetricSpec): string[] | null;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const integers = new Intl.NumberFormat();
|
|
2
|
+
const percent = new Intl.NumberFormat(undefined, { style: 'percent', maximumFractionDigits: 1 });
|
|
3
|
+
const decimal = new Intl.NumberFormat(undefined, { maximumFractionDigits: 1 });
|
|
4
|
+
/** Remediation time in hours and minutes: 45 min, 2 h, 3 h 20 min. */
|
|
5
|
+
export function duration(minutes) {
|
|
6
|
+
const rounded = Math.round(minutes);
|
|
7
|
+
if (rounded < 60)
|
|
8
|
+
return `${integers.format(rounded)} min`;
|
|
9
|
+
const hours = Math.floor(rounded / 60);
|
|
10
|
+
const rest = rounded % 60;
|
|
11
|
+
return rest ? `${integers.format(hours)} h ${integers.format(rest)} min` : `${integers.format(hours)} h`;
|
|
12
|
+
}
|
|
13
|
+
const writers = {
|
|
14
|
+
ratio: value => percent.format(value),
|
|
15
|
+
minutes: duration,
|
|
16
|
+
count: value => integers.format(value),
|
|
17
|
+
};
|
|
18
|
+
export function format(spec, value) {
|
|
19
|
+
return value === null ? '—' : writers[spec.descriptor.unit](value);
|
|
20
|
+
}
|
|
21
|
+
/** How large a change is: percentage points for a ratio, time for minutes, a count otherwise. */
|
|
22
|
+
const magnitudes = {
|
|
23
|
+
ratio: size => `${decimal.format(size)} pp`,
|
|
24
|
+
minutes: duration,
|
|
25
|
+
count: size => integers.format(size),
|
|
26
|
+
};
|
|
27
|
+
/** The signed change between two values: percentage points for a ratio, coloured only where the metric has a better. */
|
|
28
|
+
export function difference(spec, value, before) {
|
|
29
|
+
const { unit, better } = spec.descriptor;
|
|
30
|
+
const raw = unit === 'ratio' ? (value - before) * 100 : value - before;
|
|
31
|
+
const rounded = unit === 'ratio' ? Math.round(raw * 10) / 10 : Math.round(raw);
|
|
32
|
+
if (rounded === 0)
|
|
33
|
+
return { text: 'No change', direction: 'same' };
|
|
34
|
+
const improved = (better === 'lower') === (rounded < 0);
|
|
35
|
+
const direction = better === 'none' ? 'neutral' : improved ? 'better' : 'worse';
|
|
36
|
+
return { text: `${rounded > 0 ? '+' : '−'}${magnitudes[unit](Math.abs(rounded))}`, direction };
|
|
37
|
+
}
|
|
38
|
+
/** The first click on a column sorts worst first. */
|
|
39
|
+
export function firstSortAscending(spec) {
|
|
40
|
+
return spec.descriptor.better === 'higher';
|
|
41
|
+
}
|
|
42
|
+
/** Missing values sort last in both directions. */
|
|
43
|
+
export function compareValues(ascending) {
|
|
44
|
+
return (a, b) => {
|
|
45
|
+
if (a === null || b === null)
|
|
46
|
+
return Number(a === null) - Number(b === null);
|
|
47
|
+
return ascending ? a - b : b - a;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** The colour scale: heat where the metric has a better, so the worst is always red; neutral greys where it has none. */
|
|
51
|
+
export function bandScale(spec) {
|
|
52
|
+
return spec.descriptor.better === 'none' ? 'neutral' : 'heat';
|
|
53
|
+
}
|
|
54
|
+
/** The band of a value against fixed limits; a limit belongs to the better side. */
|
|
55
|
+
function fixedStep(limits, value, higher) {
|
|
56
|
+
const index = limits.findIndex(limit => higher ? value < limit : value <= limit);
|
|
57
|
+
return index < 0 ? limits.length : index;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One of five bands, 0 best to 4 worst. Fixed by the descriptor's limits where it has them; otherwise relative to the
|
|
61
|
+
* highest value shown. A metric where higher is better turns the scale round. A limit belongs to the better side: at
|
|
62
|
+
* most 5 is the best complexity band, 90% is already the best coverage band.
|
|
63
|
+
*/
|
|
64
|
+
export function bandOf(spec, value, highest) {
|
|
65
|
+
const limits = spec.descriptor.bands;
|
|
66
|
+
const higher = spec.descriptor.better === 'higher';
|
|
67
|
+
const relative = highest > 0 ? Math.min(4, Math.floor(value / highest * 5)) : 0;
|
|
68
|
+
const step = limits ? fixedStep(limits, value, higher) : relative;
|
|
69
|
+
return higher ? 4 - step : step;
|
|
70
|
+
}
|
|
71
|
+
const labels = {
|
|
72
|
+
ratio: value => `${+(value * 100).toFixed(1)}%`,
|
|
73
|
+
minutes: duration,
|
|
74
|
+
count: value => integers.format(value),
|
|
75
|
+
};
|
|
76
|
+
/** Counts step by whole numbers: ≤5, 6–10 … 51+. */
|
|
77
|
+
function countRanges(limits, show) {
|
|
78
|
+
return [`≤${show(limits[0])}`, ...limits.slice(1).map((limit, index) => `${show(limits[index] + 1)}–${show(limit)}`), `${show(limits[3] + 1)}+`];
|
|
79
|
+
}
|
|
80
|
+
/** Ratios and times run from limit to limit: <5%, 5–15% … 50%+; a ratio's range names its unit once. */
|
|
81
|
+
function spanRanges(limits, show, unit) {
|
|
82
|
+
const low = unit === 'ratio' ? (value) => show(value).replace(/%$/, '') : show;
|
|
83
|
+
return [`<${show(limits[0])}`, ...limits.slice(1).map((limit, index) => `${low(limits[index])}–${show(limit)}`), `${show(limits[3])}+`];
|
|
84
|
+
}
|
|
85
|
+
/** The legend's words, best band first; null where the bands are relative and the legend reads Lower … Higher. */
|
|
86
|
+
export function bandLabels(spec) {
|
|
87
|
+
const limits = spec.descriptor.bands;
|
|
88
|
+
if (!limits)
|
|
89
|
+
return null;
|
|
90
|
+
const unit = spec.descriptor.unit;
|
|
91
|
+
const ranges = unit === 'count' ? countRanges(limits, labels[unit]) : spanRanges(limits, labels[unit], unit);
|
|
92
|
+
return spec.descriptor.better === 'higher' ? ranges.reverse() : ranges;
|
|
93
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { MetricDescriptor, MetricValues } from '../../json/wire/summary-model.js';
|
|
2
|
+
export type { MetricDescriptor, MetricValues } from '../../json/wire/summary-model.js';
|
|
3
|
+
export type Direction = 'better' | 'worse' | 'same' | 'neutral';
|
|
4
|
+
export interface MetricSpec {
|
|
5
|
+
readonly descriptor: MetricDescriptor;
|
|
6
|
+
/** The word the query field takes and the Trends view id: `todo-count`. */
|
|
7
|
+
readonly key: string;
|
|
8
|
+
readonly plugin: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
/** The column header. */
|
|
11
|
+
readonly short: string;
|
|
12
|
+
readonly group: string;
|
|
13
|
+
/** A Metrics column shown before the reader picks columns. */
|
|
14
|
+
readonly column: boolean;
|
|
15
|
+
/** Offered in the Hotspots metric menu. */
|
|
16
|
+
readonly hotspot: boolean;
|
|
17
|
+
/** Has one value per commit, so a trend chart. */
|
|
18
|
+
readonly trend: boolean;
|
|
19
|
+
/** A count another metric's ratio is made of, as covered branches are of branch coverage. */
|
|
20
|
+
readonly ratioPart: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** A row that may carry values: a commit, a file or a folder. */
|
|
23
|
+
export interface Valued {
|
|
24
|
+
readonly values?: MetricValues | undefined;
|
|
25
|
+
readonly analysed?: boolean | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** Curated groups first, in this order; groups named by plugins follow in catalog order. */
|
|
28
|
+
/** The metrics the viewer draws from their typed fields; a Repometry metric it has no code for goes by its descriptor. */
|
|
29
|
+
export declare function isBuiltin(descriptor: MetricDescriptor): boolean;
|
|
30
|
+
/** One spec per descriptor, in catalog order; descriptors listed twice by id count once. */
|
|
31
|
+
export declare function metricSpecs(catalog: readonly MetricDescriptor[]): MetricSpec[];
|
|
32
|
+
/** Positions of a catalog's metrics by id: summary indexes for commits, the detail's own indexes for files. */
|
|
33
|
+
export declare function catalogIndex(catalog: readonly MetricDescriptor[] | undefined): Map<string, number>;
|
|
34
|
+
/** Specs by key, for the query field and the Trends views. Where versions share a key, the one the index holds wins. */
|
|
35
|
+
export declare function byKey(specs: readonly MetricSpec[], index?: ReadonlyMap<string, number>): Map<string, MetricSpec>;
|
|
36
|
+
/**
|
|
37
|
+
* The repository's value at a commit. A commit lists every metric it measured, null where nothing rolls up; a metric
|
|
38
|
+
* it does not list did not run, and has no value, so a chart breaks its line instead of dropping to zero.
|
|
39
|
+
*/
|
|
40
|
+
export declare function commitValue(index: ReadonlyMap<string, number>, commit: Valued, spec: MetricSpec): number | null;
|
|
41
|
+
/**
|
|
42
|
+
* A file's or folder's value against the detail's own catalog. None for a file no plugin analysed, nor for a metric
|
|
43
|
+
* this inspection did not run. Within a measured metric a missing value is zero: zeros are left out of the data.
|
|
44
|
+
*/
|
|
45
|
+
export declare function entryValue(index: ReadonlyMap<string, number>, entry: Valued, spec: MetricSpec): number | null;
|
|
46
|
+
/** The values of a group of files the viewer gathers itself (a filtered folder, a component), by each metric's roll-up. */
|
|
47
|
+
export declare function rollUp(catalog: readonly MetricDescriptor[] | undefined, entries: readonly Valued[]): MetricValues | undefined;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/** Repometry's metrics keep short query words; every other key comes from the descriptor's id. */
|
|
2
|
+
const builtinKeys = {
|
|
3
|
+
'repometry.cyclomatic-complexity/v1': 'complexity',
|
|
4
|
+
'repometry.cognitive-complexity/v1': 'cognitive',
|
|
5
|
+
'repometry.code-lines/v1': 'lines',
|
|
6
|
+
'repometry.functions/v1': 'functions',
|
|
7
|
+
'repometry.lcov-line-coverage/v1': 'coverage',
|
|
8
|
+
'repometry.duplicated-lines/v1': 'duplication',
|
|
9
|
+
'repometry.git-change-frequency/v1': 'changes',
|
|
10
|
+
'repometry.lcov-branch-coverage/v1': 'branch-coverage',
|
|
11
|
+
'repometry.lcov-covered-branches/v1': 'covered-branches',
|
|
12
|
+
'repometry.lcov-coverable-branches/v1': 'coverable-branches',
|
|
13
|
+
'repometry.lcov-function-coverage/v1': 'function-coverage',
|
|
14
|
+
'repometry.lcov-covered-functions/v1': 'covered-functions',
|
|
15
|
+
'repometry.lcov-coverable-functions/v1': 'coverable-functions',
|
|
16
|
+
};
|
|
17
|
+
/** The Repometry metrics the viewer draws from typed fields, with their own labels, columns and charts. */
|
|
18
|
+
const handDrawn = new Set([
|
|
19
|
+
'repometry.physical-lines/v1', 'repometry.functions/v1', 'repometry.cyclomatic-complexity/v1', 'repometry.cognitive-complexity/v1',
|
|
20
|
+
'repometry.classes/v1', 'repometry.code-lines/v1', 'repometry.comment-lines/v1',
|
|
21
|
+
'repometry.duplicated-lines/v1', 'repometry.lcov-line-coverage/v1', 'repometry.lcov-covered-lines/v1',
|
|
22
|
+
'repometry.lcov-coverable-lines/v1', 'repometry.git-change-frequency/v1',
|
|
23
|
+
]);
|
|
24
|
+
/** Words that already mean something: query keys, Trends views and the series the viewer draws by hand. */
|
|
25
|
+
const reserved = new Set(['lang', 'language', 'component', 'path', 'in', 'has', 'analysed', 'ignored', 'lockfile', 'lockfiles', 'remediation', 'missedlines', 'churn',
|
|
26
|
+
'debt', 'debt-changes', 'diff-coverage', 'effort', 'smells', 'files', 'classes', 'comments', 'code-lines', 'security',
|
|
27
|
+
'coverable-lines', 'covered-lines', 'uncovered-lines', 'security-high', 'security-medium', 'security-low',
|
|
28
|
+
...Object.values(builtinKeys)]);
|
|
29
|
+
/** Curated groups first, in this order; groups named by plugins follow in catalog order. */
|
|
30
|
+
/** The metrics the viewer draws from their typed fields; a Repometry metric it has no code for goes by its descriptor. */
|
|
31
|
+
export function isBuiltin(descriptor) {
|
|
32
|
+
return handDrawn.has(descriptor.id);
|
|
33
|
+
}
|
|
34
|
+
function parts(id) {
|
|
35
|
+
const bare = id.replace(/\/v\d+$/, '');
|
|
36
|
+
const dot = bare.indexOf('.');
|
|
37
|
+
return dot < 0 ? { plugin: bare, name: bare } : { plugin: bare.slice(0, dot), name: bare.slice(dot + 1) };
|
|
38
|
+
}
|
|
39
|
+
/** One spec per descriptor, in catalog order; descriptors listed twice by id count once. */
|
|
40
|
+
export function metricSpecs(catalog) {
|
|
41
|
+
const unique = [...new Map(catalog.map(descriptor => [descriptor.id, descriptor])).values()];
|
|
42
|
+
// Two versions of one metric share a key: a commit measures one of them. Two plugins naming the same metric do not.
|
|
43
|
+
const owners = new Map();
|
|
44
|
+
for (const { id } of unique) {
|
|
45
|
+
const { plugin, name } = parts(id);
|
|
46
|
+
owners.set(name, (owners.get(name) ?? new Set()).add(plugin));
|
|
47
|
+
}
|
|
48
|
+
// The counts a ratio is made of (covered and measured branches) read through the ratio: no chart, column or rank of their own.
|
|
49
|
+
const ratioParts = new Set(unique.flatMap(({ ratio }) => ratio ? [ratio.of, ratio.over] : []));
|
|
50
|
+
return unique.map(descriptor => {
|
|
51
|
+
const { plugin, name } = parts(descriptor.id);
|
|
52
|
+
const builtin = builtinKeys[descriptor.id];
|
|
53
|
+
const key = builtin ?? (owners.get(name).size > 1 || reserved.has(name.toLowerCase()) ? `${plugin}.${name}` : name);
|
|
54
|
+
const rolls = descriptor.aggregate !== 'none' || descriptor.ratio !== undefined;
|
|
55
|
+
const ranked = descriptor.scope === 'file' && descriptor.better !== 'none' && !ratioParts.has(descriptor.id);
|
|
56
|
+
return {
|
|
57
|
+
descriptor, key, plugin,
|
|
58
|
+
label: descriptor.label,
|
|
59
|
+
short: descriptor.short ?? descriptor.label,
|
|
60
|
+
group: descriptor.group ?? plugin,
|
|
61
|
+
// Repometry's own columns are curated; its metrics without a hand-made column are there to pick, not shown first.
|
|
62
|
+
column: ranked && plugin !== 'repometry',
|
|
63
|
+
hotspot: ranked && rolls,
|
|
64
|
+
trend: !ratioParts.has(descriptor.id) && (descriptor.scope === 'repository' || rolls),
|
|
65
|
+
ratioPart: ratioParts.has(descriptor.id),
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** Positions of a catalog's metrics by id: summary indexes for commits, the detail's own indexes for files. */
|
|
70
|
+
export function catalogIndex(catalog) {
|
|
71
|
+
return new Map((catalog ?? []).map((descriptor, index) => [descriptor.id, index]));
|
|
72
|
+
}
|
|
73
|
+
/** Specs by key, for the query field and the Trends views. Where versions share a key, the one the index holds wins. */
|
|
74
|
+
export function byKey(specs, index) {
|
|
75
|
+
const keys = new Map();
|
|
76
|
+
for (const spec of specs) {
|
|
77
|
+
if (!keys.has(spec.key) || index?.has(spec.descriptor.id))
|
|
78
|
+
keys.set(spec.key, spec);
|
|
79
|
+
}
|
|
80
|
+
return keys;
|
|
81
|
+
}
|
|
82
|
+
/** The id whose presence says a metric was measured: a ratio is measured where its denominator is. */
|
|
83
|
+
function measuredId(spec) {
|
|
84
|
+
return spec.descriptor.ratio?.over ?? spec.descriptor.id;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The repository's value at a commit. A commit lists every metric it measured, null where nothing rolls up; a metric
|
|
88
|
+
* it does not list did not run, and has no value, so a chart breaks its line instead of dropping to zero.
|
|
89
|
+
*/
|
|
90
|
+
export function commitValue(index, commit, spec) {
|
|
91
|
+
const values = commit.values;
|
|
92
|
+
const at = index.get(measuredId(spec));
|
|
93
|
+
if (!values || at === undefined || !(at in values))
|
|
94
|
+
return null;
|
|
95
|
+
const ratio = spec.descriptor.ratio;
|
|
96
|
+
if (!ratio)
|
|
97
|
+
return values[at] ?? null;
|
|
98
|
+
const of = index.get(ratio.of);
|
|
99
|
+
const total = values[at] ?? 0;
|
|
100
|
+
return total > 0 && of !== undefined ? (values[of] ?? 0) / total : null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A file's or folder's value against the detail's own catalog. None for a file no plugin analysed, nor for a metric
|
|
104
|
+
* this inspection did not run. Within a measured metric a missing value is zero: zeros are left out of the data.
|
|
105
|
+
*/
|
|
106
|
+
export function entryValue(index, entry, spec) {
|
|
107
|
+
if (entry.analysed === false)
|
|
108
|
+
return null;
|
|
109
|
+
const at = index.get(measuredId(spec));
|
|
110
|
+
if (at === undefined)
|
|
111
|
+
return null;
|
|
112
|
+
const ratio = spec.descriptor.ratio;
|
|
113
|
+
if (!ratio)
|
|
114
|
+
return entry.values?.[at] ?? 0;
|
|
115
|
+
const of = index.get(ratio.of);
|
|
116
|
+
const total = entry.values?.[at] ?? 0;
|
|
117
|
+
return total > 0 && of !== undefined ? (entry.values?.[of] ?? 0) / total : null;
|
|
118
|
+
}
|
|
119
|
+
/** The values of a group of files the viewer gathers itself (a filtered folder, a component), by each metric's roll-up. */
|
|
120
|
+
export function rollUp(catalog, entries) {
|
|
121
|
+
if (!catalog?.length)
|
|
122
|
+
return undefined;
|
|
123
|
+
const values = {};
|
|
124
|
+
catalog.forEach((descriptor, index) => {
|
|
125
|
+
if (descriptor.aggregate === 'none')
|
|
126
|
+
return;
|
|
127
|
+
let total = 0;
|
|
128
|
+
for (const entry of entries) {
|
|
129
|
+
if (entry.analysed === false)
|
|
130
|
+
continue;
|
|
131
|
+
const value = entry.values?.[index] ?? 0;
|
|
132
|
+
total = descriptor.aggregate === 'max' ? Math.max(total, value) : total + value;
|
|
133
|
+
}
|
|
134
|
+
if (total !== 0)
|
|
135
|
+
values[index] = total;
|
|
136
|
+
});
|
|
137
|
+
return values;
|
|
138
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
|
|
2
|
+
import type { Metrics, Navigation, Preferences } from './viewer-inspection.js';
|
|
3
|
+
/** The Metrics page: a query, a grouping and columns over the folder's files, their languages, and the totals beside. */
|
|
4
|
+
export declare function metricsView(details: InspectionDetails, navigation: Navigation, settings: Preferences, directory: string, selectedFile?: Metrics): HTMLElement;
|