@repometry/cli 0.0.0-dev.0 → 0.0.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 -3
- package/package.json +65 -2
- package/target/main/resources/language-catalog.json +61 -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 +530 -0
- package/target/main/resources/report/json/repository-summary-v1.schema.json +337 -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 +131 -0
- package/target/main/ts/compose/analysis-results.d.ts +42 -0
- package/target/main/ts/compose/analysis-results.js +84 -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 +125 -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 +77 -0
- package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
- package/target/main/ts/report/json/validation/summary-validation.js +26 -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 +36 -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,241 @@
|
|
|
1
|
+
import { element } from './viewer-dom.js';
|
|
2
|
+
import { languageIdOf, syntaxOf } from './viewer-languages.js';
|
|
3
|
+
const form = (kind, start, end, multiline = false, raw = false) => ({ kind, start, end, multiline, raw });
|
|
4
|
+
/** The syntax data in the shape the scanner reads: forms longest marker first, words as sets. */
|
|
5
|
+
function grammarOf({ lineComments = [], blockComments = [], strings = [], stringPrefixes = [], keywords, regexAfter }) {
|
|
6
|
+
const forms = [
|
|
7
|
+
...lineComments.map(start => form('c', start, '', false, true)),
|
|
8
|
+
...blockComments.map(([start, end]) => form('c', start, end, true, true)),
|
|
9
|
+
...strings.map(({ quote, multiline, raw }) => form('s', quote, quote, multiline, raw)),
|
|
10
|
+
];
|
|
11
|
+
return {
|
|
12
|
+
// Longest marker first; the sort is stable, so on equal length a comment, listed first, wins.
|
|
13
|
+
forms: forms.sort((a, b) => b.start.length - a.start.length),
|
|
14
|
+
keywords: new Set(keywords),
|
|
15
|
+
prefixes: new Set(stringPrefixes.map(prefix => prefix.toLowerCase())),
|
|
16
|
+
regexAfter: regexAfter && new Set(regexAfter),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Where a form ends from `from` on: the index after its end marker, or the line's end when it stays open. */
|
|
20
|
+
function closeAt(line, from, open) {
|
|
21
|
+
if (!open.end)
|
|
22
|
+
return [line.length, true];
|
|
23
|
+
let at = from;
|
|
24
|
+
while (at < line.length && !line.startsWith(open.end, at))
|
|
25
|
+
at += !open.raw && line[at] === '\\' ? 2 : 1;
|
|
26
|
+
return at < line.length ? [at + open.end.length, true] : [line.length, false];
|
|
27
|
+
}
|
|
28
|
+
/** Takes the run up to `stop` as one token. */
|
|
29
|
+
function take(cursor, kind, stop) {
|
|
30
|
+
cursor.push(kind, cursor.line.slice(cursor.at, stop));
|
|
31
|
+
cursor.at = stop;
|
|
32
|
+
}
|
|
33
|
+
function close(state, closed) {
|
|
34
|
+
state.open = undefined;
|
|
35
|
+
if (closed.kind === 's')
|
|
36
|
+
state.regexAllowed = false;
|
|
37
|
+
}
|
|
38
|
+
/** Inside a form that an earlier line or run left open: up to its end, or the whole line. */
|
|
39
|
+
function inside(cursor, open) {
|
|
40
|
+
const [stop, closed] = closeAt(cursor.line, cursor.at, open);
|
|
41
|
+
take(cursor, open.kind, stop);
|
|
42
|
+
if (closed)
|
|
43
|
+
close(cursor.state, open);
|
|
44
|
+
}
|
|
45
|
+
/** Opens a form after `prefix` characters: a multi-line one as its start marker, left open; another to its end. */
|
|
46
|
+
function begin(cursor, opened, prefix) {
|
|
47
|
+
const body = cursor.at + prefix + opened.start.length;
|
|
48
|
+
take(cursor, opened.kind, opened.multiline ? body : closeAt(cursor.line, body, opened)[0]);
|
|
49
|
+
if (opened.multiline)
|
|
50
|
+
cursor.state.open = opened;
|
|
51
|
+
else
|
|
52
|
+
close(cursor.state, opened);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The end of a regular expression literal that starts at `at`, its flags included, honouring escapes and character
|
|
56
|
+
* classes; -1 where the line has no closing slash, so the slash divides after all.
|
|
57
|
+
*/
|
|
58
|
+
function regexEnd(line, at) {
|
|
59
|
+
let end = at + 1;
|
|
60
|
+
let inClass = false;
|
|
61
|
+
while (end < line.length) {
|
|
62
|
+
const current = line[end];
|
|
63
|
+
if (current === '\\') {
|
|
64
|
+
end += 2;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (current === '/' && !inClass)
|
|
68
|
+
break;
|
|
69
|
+
if (current === '[')
|
|
70
|
+
inClass = true;
|
|
71
|
+
else if (current === ']')
|
|
72
|
+
inClass = false;
|
|
73
|
+
end += 1;
|
|
74
|
+
}
|
|
75
|
+
if (end >= line.length)
|
|
76
|
+
return -1;
|
|
77
|
+
end += 1;
|
|
78
|
+
while (end < line.length && /[a-z]/i.test(line[end]))
|
|
79
|
+
end += 1;
|
|
80
|
+
return end;
|
|
81
|
+
}
|
|
82
|
+
const char = (cursor, offset = 0) => cursor.line[cursor.at + offset];
|
|
83
|
+
function marked(cursor) {
|
|
84
|
+
const found = cursor.grammar.forms.find(candidate => cursor.line.startsWith(candidate.start, cursor.at));
|
|
85
|
+
if (!found)
|
|
86
|
+
return false;
|
|
87
|
+
begin(cursor, found, 0);
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
/** Where a token can start, tried in order; each takes what it recognises and says whether it did. */
|
|
91
|
+
const starts = [
|
|
92
|
+
marked,
|
|
93
|
+
function regex(cursor) {
|
|
94
|
+
if (char(cursor) !== '/' || !cursor.grammar.regexAfter || !cursor.state.regexAllowed)
|
|
95
|
+
return false;
|
|
96
|
+
const end = regexEnd(cursor.line, cursor.at);
|
|
97
|
+
if (end < 0)
|
|
98
|
+
return false;
|
|
99
|
+
take(cursor, 's', end);
|
|
100
|
+
cursor.state.regexAllowed = false;
|
|
101
|
+
return true;
|
|
102
|
+
},
|
|
103
|
+
function word(cursor) {
|
|
104
|
+
const found = /^[A-Za-z_$][\w$]*/.exec(cursor.line.slice(cursor.at))?.[0];
|
|
105
|
+
if (!found)
|
|
106
|
+
return false;
|
|
107
|
+
const { grammar } = cursor;
|
|
108
|
+
// A declared string prefix right before a quote belongs to the string.
|
|
109
|
+
const quoted = grammar.prefixes.has(found.toLowerCase())
|
|
110
|
+
&& grammar.forms.find(candidate => candidate.kind === 's' && cursor.line.startsWith(candidate.start, cursor.at + found.length));
|
|
111
|
+
if (quoted) {
|
|
112
|
+
begin(cursor, quoted, found.length);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
take(cursor, grammar.keywords.has(found) ? 'k' : '', cursor.at + found.length);
|
|
116
|
+
cursor.state.regexAllowed = !!grammar.regexAfter?.has(found);
|
|
117
|
+
return true;
|
|
118
|
+
},
|
|
119
|
+
function number(cursor) {
|
|
120
|
+
const found = /^\.?\d(?:[eEpP][+-]\d|\.\d|\w)*/.exec(cursor.line.slice(cursor.at))?.[0];
|
|
121
|
+
if (!found)
|
|
122
|
+
return false;
|
|
123
|
+
take(cursor, 'n', cursor.at + found.length);
|
|
124
|
+
cursor.state.regexAllowed = false;
|
|
125
|
+
return true;
|
|
126
|
+
},
|
|
127
|
+
function punctuation(cursor) {
|
|
128
|
+
const found = char(cursor);
|
|
129
|
+
take(cursor, '', cursor.at + 1);
|
|
130
|
+
// After a closing bracket a slash divides; after any other punctuation it opens a regular expression.
|
|
131
|
+
if (!/\s/.test(found))
|
|
132
|
+
cursor.state.regexAllowed = found !== ')' && found !== ']';
|
|
133
|
+
return true;
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
/** Collects a line's runs, joining plain text into one run between coloured ones. */
|
|
137
|
+
function runs() {
|
|
138
|
+
const result = [];
|
|
139
|
+
let plain = '';
|
|
140
|
+
return {
|
|
141
|
+
push(kind, value) {
|
|
142
|
+
if (!value)
|
|
143
|
+
return;
|
|
144
|
+
if (!kind) {
|
|
145
|
+
plain += value;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (plain)
|
|
149
|
+
result.push(['', plain]);
|
|
150
|
+
plain = '';
|
|
151
|
+
result.push([kind, value]);
|
|
152
|
+
},
|
|
153
|
+
done() {
|
|
154
|
+
if (plain)
|
|
155
|
+
result.push(['', plain]);
|
|
156
|
+
return result;
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Splits lines into coloured runs by a language's syntax data: comments, strings, regular expressions, numbers and
|
|
162
|
+
* keywords. It honours escapes and character classes, and where the data asks for regular expressions it tells one from
|
|
163
|
+
* a division by what comes before the slash. State carries across lines, so a block comment or a multi-line string
|
|
164
|
+
* stays coloured to its end. Without syntax a line comes back as plain text.
|
|
165
|
+
*/
|
|
166
|
+
export function tokenizer(syntax) {
|
|
167
|
+
if (!syntax)
|
|
168
|
+
return line => [['', line]];
|
|
169
|
+
return scanLines(grammarOf(syntax), scanLine);
|
|
170
|
+
}
|
|
171
|
+
function scanLine(cursor) {
|
|
172
|
+
while (cursor.at < cursor.line.length) {
|
|
173
|
+
if (cursor.state.open)
|
|
174
|
+
inside(cursor, cursor.state.open);
|
|
175
|
+
else
|
|
176
|
+
starts.find(start => start(cursor));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function scanLines(grammar, scan) {
|
|
180
|
+
const state = { open: undefined, regexAllowed: true };
|
|
181
|
+
return line => {
|
|
182
|
+
const collected = runs();
|
|
183
|
+
scan({ line, grammar, at: 0, state, push: collected.push });
|
|
184
|
+
return collected.done();
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// Bash Reference Manual §§3.1.2, 3.1.3 and 3.2.1. Colour complete unquoted words without parsing their command position.
|
|
188
|
+
const shellGrammar = {
|
|
189
|
+
...grammarOf({ keywords: ['case', 'coproc', 'do', 'done', 'elif', 'else', 'esac', 'fi', 'for', 'function',
|
|
190
|
+
'if', 'in', 'select', 'then', 'time', 'until', 'while'] }),
|
|
191
|
+
forms: [
|
|
192
|
+
form('s', "$'", "'"), form('s', '$"', '"'),
|
|
193
|
+
form('s', "'", "'", false, true), form('s', '"', '"'),
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
const shellBoundary = /^[ \t;|&()<>]$/;
|
|
197
|
+
const shellWord = /^(?:[^ \t;|&()<>'"\\$]|\$(?!['"]))+/;
|
|
198
|
+
function scanShellLine(cursor) {
|
|
199
|
+
let wordStart = true;
|
|
200
|
+
while (cursor.at < cursor.line.length)
|
|
201
|
+
wordStart = scanShellPart(cursor, wordStart);
|
|
202
|
+
}
|
|
203
|
+
/** Returns whether the next token begins a shell word. */
|
|
204
|
+
function scanShellPart(cursor, wordStart) {
|
|
205
|
+
if (marked(cursor))
|
|
206
|
+
return false;
|
|
207
|
+
const current = char(cursor);
|
|
208
|
+
if (wordStart && current === '#') {
|
|
209
|
+
take(cursor, 'c', cursor.line.length);
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
if (shellBoundary.test(current)) {
|
|
213
|
+
take(cursor, '', cursor.at + 1);
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
if (current === '\\') {
|
|
217
|
+
take(cursor, '', Math.min(cursor.at + 2, cursor.line.length));
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
const word = shellWord.exec(cursor.line.slice(cursor.at))[0];
|
|
221
|
+
const next = char(cursor, word.length);
|
|
222
|
+
const keyword = wordStart && (next === undefined || shellBoundary.test(next)) && cursor.grammar.keywords.has(word);
|
|
223
|
+
take(cursor, keyword ? 'k' : '', cursor.at + word.length);
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
export function sourceTokenizer(path) {
|
|
227
|
+
const syntax = syntaxOf(path);
|
|
228
|
+
if (syntax === undefined && languageIdOf(path) === 'shell' && /\.(?:sh|bash)$/i.test(path)) {
|
|
229
|
+
return scanLines(shellGrammar, scanShellLine);
|
|
230
|
+
}
|
|
231
|
+
return tokenizer(syntax);
|
|
232
|
+
}
|
|
233
|
+
/** A line's runs as nodes: coloured spans and plain text. */
|
|
234
|
+
export function runNodes(lineRuns) {
|
|
235
|
+
return lineRuns.map(([kind, value]) => kind ? element('span', `tok-${kind}`, value) : document.createTextNode(value));
|
|
236
|
+
}
|
|
237
|
+
/** Highlights a file's lines, or a snippet of them, by the syntax of the file's language. */
|
|
238
|
+
export function highlighter(path) {
|
|
239
|
+
const tokenize = sourceTokenizer(path);
|
|
240
|
+
return line => runNodes(tokenize(line));
|
|
241
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
|
|
2
|
+
import type { Directory, Metrics } from './viewer-inspection.js';
|
|
3
|
+
type Read = (entry: Metrics) => number | null | undefined;
|
|
4
|
+
/** The sum of what the files measured; null where none of them did. */
|
|
5
|
+
export declare function sum(files: readonly Metrics[], read: Read): number | null;
|
|
6
|
+
/** Totals for any set of files, measured the way folder totals are: sums, the peak, and ratios of sums. */
|
|
7
|
+
export declare function aggregate(path: string, files: readonly Metrics[]): Directory;
|
|
8
|
+
/**
|
|
9
|
+
* Where only some of the files whose code was measured carry a measure, their total is partial and says so; a total
|
|
10
|
+
* that all of them carry, or none, says nothing more. A file only a scanner read (a workflow, a manifest) has no code
|
|
11
|
+
* measures and is not expected to carry one.
|
|
12
|
+
*/
|
|
13
|
+
export declare function partialNote(files: readonly Metrics[], present: (entry: Metrics) => boolean): string | undefined;
|
|
14
|
+
/** The folders all of whose files are only counted, found in one pass over the files. */
|
|
15
|
+
export declare function unreadFolders(files: readonly Pick<Metrics, 'path' | 'analysed'>[]): Set<string>;
|
|
16
|
+
/** The folders above a path, nearest first. */
|
|
17
|
+
export declare function ancestors(path: string): string[];
|
|
18
|
+
/** Each path's components, by name. */
|
|
19
|
+
export declare function componentIndex(components: NonNullable<InspectionDetails['components']>): Map<string, string[]>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { count } from './viewer-dom.js';
|
|
2
|
+
import { sized } from './viewer-languages.js';
|
|
3
|
+
import { localCatalog } from './viewer-inspection.js';
|
|
4
|
+
import { rollUp } from './viewer-metric-registry.js';
|
|
5
|
+
/** The sum of what the files measured; null where none of them did. */
|
|
6
|
+
export function sum(files, read) {
|
|
7
|
+
let total = null;
|
|
8
|
+
for (const entry of files) {
|
|
9
|
+
const value = read(entry);
|
|
10
|
+
if (value != null)
|
|
11
|
+
total = (total ?? 0) + value;
|
|
12
|
+
}
|
|
13
|
+
return total;
|
|
14
|
+
}
|
|
15
|
+
function zeroSum(files, read) {
|
|
16
|
+
return sum(files, read) ?? 0;
|
|
17
|
+
}
|
|
18
|
+
/** The quality counts that add up, in the order a folder's totals list them. */
|
|
19
|
+
const qualitySums = [
|
|
20
|
+
['codeLines', entry => entry.quality?.codeLines],
|
|
21
|
+
['commentLines', entry => entry.quality?.commentLines],
|
|
22
|
+
['classes', entry => entry.quality?.classes],
|
|
23
|
+
['cognitiveComplexity', entry => entry.quality?.cognitiveComplexity],
|
|
24
|
+
['churn', entry => entry.quality?.churn],
|
|
25
|
+
];
|
|
26
|
+
function qualityTotals(files) {
|
|
27
|
+
const quality = {};
|
|
28
|
+
for (const [key, read] of qualitySums) {
|
|
29
|
+
const value = sum(files, read);
|
|
30
|
+
if (value !== null)
|
|
31
|
+
quality[key] = value;
|
|
32
|
+
}
|
|
33
|
+
if (files.some(entry => entry.quality?.duplication)) {
|
|
34
|
+
quality.duplication = { duplicatedLines: zeroSum(files, entry => entry.quality?.duplication?.duplicatedLines),
|
|
35
|
+
codeLines: zeroSum(files, entry => entry.quality?.duplication?.codeLines) };
|
|
36
|
+
}
|
|
37
|
+
if (files.some(entry => entry.quality?.maintainability)) {
|
|
38
|
+
quality.maintainability = { smells: zeroSum(files, entry => entry.quality?.maintainability?.smells),
|
|
39
|
+
effortMinutes: sum(files, entry => entry.quality?.maintainability?.effortMinutes) };
|
|
40
|
+
}
|
|
41
|
+
return quality;
|
|
42
|
+
}
|
|
43
|
+
function peakComplexity(files) {
|
|
44
|
+
const peaks = files.flatMap(entry => entry.complexity?.maximum == null ? [] : [entry.complexity.maximum]);
|
|
45
|
+
return peaks.length ? peaks.reduce((max, value) => Math.max(max, value), 0) : null;
|
|
46
|
+
}
|
|
47
|
+
/** Totals for any set of files, measured the way folder totals are: sums, the peak, and ratios of sums. */
|
|
48
|
+
export function aggregate(path, files) {
|
|
49
|
+
const covered = files.filter(entry => entry.lineCoverage);
|
|
50
|
+
const values = rollUp(localCatalog(), files);
|
|
51
|
+
const quality = qualityTotals(files);
|
|
52
|
+
return {
|
|
53
|
+
path, files: files.length, lines: sum(files, entry => entry.lines), functions: sum(files, entry => entry.functions),
|
|
54
|
+
complexity: files.some(entry => entry.complexity) ? { sum: zeroSum(files, entry => entry.complexity?.sum), maximum: peakComplexity(files),
|
|
55
|
+
measuredFunctions: zeroSum(files, entry => entry.complexity?.measuredFunctions) } : null,
|
|
56
|
+
lineCoverage: covered.length ? { covered: zeroSum(files, entry => entry.lineCoverage?.covered),
|
|
57
|
+
total: zeroSum(files, entry => entry.lineCoverage?.total) } : null,
|
|
58
|
+
diagnosticCount: zeroSum(files, entry => entry.diagnosticCount),
|
|
59
|
+
sizeMeasuredFiles: files.filter(entry => entry.lines !== null).length, coverageMeasuredFiles: covered.length,
|
|
60
|
+
...(Object.keys(quality).length ? { quality } : {}),
|
|
61
|
+
...(values ? { values } : {}),
|
|
62
|
+
// A partial sum would understate the size: only a scope where every file has one gets a total.
|
|
63
|
+
...(sized(files) ? { bytes: zeroSum(files, entry => entry.bytes) } : {}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Where only some of the files whose code was measured carry a measure, their total is partial and says so; a total
|
|
68
|
+
* that all of them carry, or none, says nothing more. A file only a scanner read (a workflow, a manifest) has no code
|
|
69
|
+
* measures and is not expected to carry one.
|
|
70
|
+
*/
|
|
71
|
+
export function partialNote(files, present) {
|
|
72
|
+
const read = files.filter(entry => entry.quality !== undefined);
|
|
73
|
+
const measured = read.filter(present).length;
|
|
74
|
+
return measured > 0 && measured < read.length ? `Measured in ${count(measured)} of ${count(read.length)} files` : undefined;
|
|
75
|
+
}
|
|
76
|
+
/** The folders all of whose files are only counted, found in one pass over the files. */
|
|
77
|
+
export function unreadFolders(files) {
|
|
78
|
+
const read = new Map();
|
|
79
|
+
for (const file of files) {
|
|
80
|
+
const analysed = file.analysed !== false;
|
|
81
|
+
for (const folder of ancestors(file.path))
|
|
82
|
+
read.set(folder, read.get(folder) === true || analysed);
|
|
83
|
+
}
|
|
84
|
+
return new Set([...read].filter(([, analysed]) => !analysed).map(([folder]) => folder));
|
|
85
|
+
}
|
|
86
|
+
/** The folders above a path, nearest first. */
|
|
87
|
+
export function ancestors(path) {
|
|
88
|
+
const folders = [];
|
|
89
|
+
for (let slash = path.lastIndexOf('/'); slash > 0; slash = path.lastIndexOf('/', slash - 1))
|
|
90
|
+
folders.push(path.slice(0, slash));
|
|
91
|
+
return folders;
|
|
92
|
+
}
|
|
93
|
+
/** Each path's components, by name. */
|
|
94
|
+
export function componentIndex(components) {
|
|
95
|
+
const index = new Map();
|
|
96
|
+
for (const { component, paths } of components)
|
|
97
|
+
for (const path of paths)
|
|
98
|
+
index.set(path, [...index.get(path) ?? [], component.name]);
|
|
99
|
+
return index;
|
|
100
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Branch, MapDraw } from './viewer-map-shape.js';
|
|
2
|
+
export interface Box {
|
|
3
|
+
readonly x: number;
|
|
4
|
+
readonly y: number;
|
|
5
|
+
readonly w: number;
|
|
6
|
+
readonly h: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Squarified treemap layout: rows of tiles kept as close to square as the areas allow, largest first, so sizes stay
|
|
10
|
+
* comparable at a glance.
|
|
11
|
+
*/
|
|
12
|
+
export declare function squarify(children: readonly Branch[], room: Box): {
|
|
13
|
+
branch: Branch;
|
|
14
|
+
box: Box;
|
|
15
|
+
}[];
|
|
16
|
+
/** A label cut to the room it has, at about six pixels a character. */
|
|
17
|
+
export declare function fit(text: string, room: number): string;
|
|
18
|
+
/** A chain of folders that each hold one folder is one frame: src/main/ts/ rather than three nested ones. */
|
|
19
|
+
export declare function collapseChain(byParent: ReadonlyMap<string, readonly Branch[]>, branch: Branch): {
|
|
20
|
+
name: string;
|
|
21
|
+
inner: readonly Branch[];
|
|
22
|
+
};
|
|
23
|
+
/** The tree as tiles: folders frame their contents under a name strip, files fill the space by size. */
|
|
24
|
+
export declare function drawTiles(map: MapDraw, children: readonly Branch[], room: Box, level: number): void;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { basename, svgElement } from './viewer-dom.js';
|
|
2
|
+
/** The worst aspect ratio of a row of areas laid along a side: the row grows while this improves. */
|
|
3
|
+
function worst(areas, side) {
|
|
4
|
+
const sum = areas.reduce((a, b) => a + b, 0);
|
|
5
|
+
return Math.max(...areas.map(area => Math.max((side * side * area) / (sum * sum), (sum * sum) / (side * side * area))));
|
|
6
|
+
}
|
|
7
|
+
/** Lays a row along the shorter side of the box; returns the boxes and the room left beside them. */
|
|
8
|
+
function layRow(row, scale, box) {
|
|
9
|
+
const sum = row.reduce((acc, item) => acc + item.area * scale, 0);
|
|
10
|
+
const vertical = box.w >= box.h;
|
|
11
|
+
const thickness = sum / (vertical ? box.h : box.w);
|
|
12
|
+
let offset = 0;
|
|
13
|
+
const placed = row.map(item => {
|
|
14
|
+
const length = (item.area * scale) / thickness;
|
|
15
|
+
const at = offset;
|
|
16
|
+
offset += length;
|
|
17
|
+
return { branch: item, box: vertical ? { x: box.x, y: box.y + at, w: thickness, h: length } : { x: box.x + at, y: box.y, w: length, h: thickness } };
|
|
18
|
+
});
|
|
19
|
+
const rest = vertical ? { x: box.x + thickness, y: box.y, w: box.w - thickness, h: box.h }
|
|
20
|
+
: { x: box.x, y: box.y + thickness, w: box.w, h: box.h - thickness };
|
|
21
|
+
return { placed, rest };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Squarified treemap layout: rows of tiles kept as close to square as the areas allow, largest first, so sizes stay
|
|
25
|
+
* comparable at a glance.
|
|
26
|
+
*/
|
|
27
|
+
export function squarify(children, room) {
|
|
28
|
+
const items = [...children].sort((a, b) => b.area - a.area);
|
|
29
|
+
const total = items.reduce((sum, item) => sum + item.area, 0);
|
|
30
|
+
if (total <= 0 || room.w <= 0 || room.h <= 0)
|
|
31
|
+
return [];
|
|
32
|
+
const scale = (room.w * room.h) / total;
|
|
33
|
+
const areas = (line) => line.map(item => item.area * scale);
|
|
34
|
+
const placed = [];
|
|
35
|
+
let box = room;
|
|
36
|
+
let row = [];
|
|
37
|
+
const lay = () => {
|
|
38
|
+
const laid = layRow(row, scale, box);
|
|
39
|
+
placed.push(...laid.placed);
|
|
40
|
+
box = laid.rest;
|
|
41
|
+
};
|
|
42
|
+
for (const item of items) {
|
|
43
|
+
const side = Math.min(box.w, box.h);
|
|
44
|
+
if (row.length === 0 || worst(areas([...row, item]), side) <= worst(areas(row), side))
|
|
45
|
+
row.push(item);
|
|
46
|
+
else {
|
|
47
|
+
lay();
|
|
48
|
+
row = [item];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (row.length)
|
|
52
|
+
lay();
|
|
53
|
+
return placed;
|
|
54
|
+
}
|
|
55
|
+
/** A label cut to the room it has, at about six pixels a character. */
|
|
56
|
+
export function fit(text, room) {
|
|
57
|
+
const chars = Math.floor(room / 6.2);
|
|
58
|
+
if (text.length <= chars)
|
|
59
|
+
return text;
|
|
60
|
+
return chars > 2 ? `${text.slice(0, chars - 1)}…` : '';
|
|
61
|
+
}
|
|
62
|
+
/** A chain of folders that each hold one folder is one frame: src/main/ts/ rather than three nested ones. */
|
|
63
|
+
export function collapseChain(byParent, branch) {
|
|
64
|
+
let inner = byParent.get(branch.entry.path) ?? [];
|
|
65
|
+
let name = basename(branch.entry.path);
|
|
66
|
+
while (inner.length === 1 && inner[0].folder) {
|
|
67
|
+
name += `/${basename(inner[0].entry.path)}`;
|
|
68
|
+
inner = byParent.get(inner[0].entry.path) ?? [];
|
|
69
|
+
}
|
|
70
|
+
return { name, inner };
|
|
71
|
+
}
|
|
72
|
+
/** The strip a folder's name takes at the top of its frame: a full one where it fits, a hairline where it does not. */
|
|
73
|
+
function stripHeight(open, box) {
|
|
74
|
+
if (!open)
|
|
75
|
+
return 0;
|
|
76
|
+
return box.w > 64 && box.h > 44 ? 15 : 3;
|
|
77
|
+
}
|
|
78
|
+
function labelFits(folder, open, strip, box) {
|
|
79
|
+
if (open && strip <= 3)
|
|
80
|
+
return false;
|
|
81
|
+
return box.w > (folder ? 64 : 44) && box.h > (open ? 0 : 17);
|
|
82
|
+
}
|
|
83
|
+
function tileLabel(text, box, shade) {
|
|
84
|
+
const label = svgElement('text');
|
|
85
|
+
label.classList.add('fx-tile-label');
|
|
86
|
+
if (shade !== 'none' && shade >= 3)
|
|
87
|
+
label.classList.add('fx-tile-label-light');
|
|
88
|
+
label.setAttribute('x', (box.x + 4).toFixed(1));
|
|
89
|
+
label.setAttribute('y', (box.y + 11.5).toFixed(1));
|
|
90
|
+
label.textContent = fit(text, box.w - 8);
|
|
91
|
+
return label;
|
|
92
|
+
}
|
|
93
|
+
function rectangle(box) {
|
|
94
|
+
return `M${box.x.toFixed(1)},${box.y.toFixed(1)}h${box.w.toFixed(1)}v${box.h.toFixed(1)}h${(-box.w).toFixed(1)}z`;
|
|
95
|
+
}
|
|
96
|
+
/** The tree as tiles: folders frame their contents under a name strip, files fill the space by size. */
|
|
97
|
+
export function drawTiles(map, children, room, level) {
|
|
98
|
+
for (const { branch, box } of squarify(children, room)) {
|
|
99
|
+
if (box.w < 2 || box.h < 2 || map.drawn >= 600)
|
|
100
|
+
continue;
|
|
101
|
+
const tile = map.tile(branch, rectangle(box));
|
|
102
|
+
if (branch.folder)
|
|
103
|
+
tile.classList.add('fx-tile-folder');
|
|
104
|
+
const { name, inner } = collapseChain(map.byParent, branch);
|
|
105
|
+
const open = branch.folder && inner.length > 0 && level < map.depth && box.w > 28 && box.h > 28;
|
|
106
|
+
const strip = stripHeight(open, box);
|
|
107
|
+
if (labelFits(branch.folder, open, strip, box))
|
|
108
|
+
tile.append(tileLabel(name + (branch.folder ? '/' : ''), box, map.shade(branch)));
|
|
109
|
+
if (open)
|
|
110
|
+
drawTiles(map, inner, { x: box.x + 3, y: box.y + strip, w: box.w - 6, h: box.h - strip - 3 }, level + 1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { InspectionContext } from '../../json/wire/inspection-context-model.js';
|
|
2
|
+
import type { QualitySummary } from '../../json/wire/domain-types.js';
|
|
3
|
+
import type { PublicHistoryEntry } from '../../json/wire/public-history-model.js';
|
|
4
|
+
import type { Metric } from './viewer-metrics.js';
|
|
5
|
+
export type TrendView = Metric | 'debt-changes' | 'diff-coverage';
|
|
6
|
+
export type Period = '30' | '100' | 'all';
|
|
7
|
+
export interface TrendData {
|
|
8
|
+
readonly reports: readonly PublicHistoryEntry[];
|
|
9
|
+
readonly quality: Record<string, QualitySummary>;
|
|
10
|
+
readonly context: Record<string, InspectionContext> | null;
|
|
11
|
+
readonly compact: boolean;
|
|
12
|
+
/** How many pull request reviews are saved: changed-line coverage is a series only where there are some. */
|
|
13
|
+
readonly reviews: number;
|
|
14
|
+
/** Link to the Trends page for a commit, keeping or replacing the view and period. */
|
|
15
|
+
readonly link: (sha: string, view?: TrendView, period?: Period) => string;
|
|
16
|
+
}
|
|
17
|
+
export declare function viewLabel(view: TrendView): string;
|
|
18
|
+
/** The metric a view reads at a commit; the views drawn by hand read none. */
|
|
19
|
+
export declare function viewMetric(view: TrendView): Metric | null;
|
|
20
|
+
/**
|
|
21
|
+
* The series list: Repometry's own groups, with other plugins' metrics joining a group they name or one of their own.
|
|
22
|
+
* A registry metric the groups already place keeps its place, and is left out where this history has no such metric.
|
|
23
|
+
*/
|
|
24
|
+
export declare function groups(): (readonly [string, readonly TrendView[]])[];
|
|
25
|
+
export declare function isTrendView(value: string | null | undefined): value is TrendView;
|
|
26
|
+
export declare function isPeriod(value: string | null | undefined): value is Period;
|
|
27
|
+
/** A metric's value at a commit, read with the commit's own quality summary and context. */
|
|
28
|
+
export declare function trendValue(data: Pick<TrendData, 'quality' | 'context'>, report: PublicHistoryEntry, metric: Metric): number | null;
|
|
29
|
+
/**
|
|
30
|
+
* Views that have data in this history, in display order: debt changes need remediation times, and changed-line
|
|
31
|
+
* coverage needs saved pull request reviews.
|
|
32
|
+
*/
|
|
33
|
+
export declare function availableViews(data: TrendData): TrendView[];
|
|
34
|
+
/** The whole curve by default; only a very long history opens on its last hundred inspections. */
|
|
35
|
+
export declare function defaultPeriod(total: number): Period;
|
|
36
|
+
export interface Window {
|
|
37
|
+
readonly start: number;
|
|
38
|
+
readonly end: number;
|
|
39
|
+
}
|
|
40
|
+
/** The inspections shown for a period, oldest first, always including the selected one. */
|
|
41
|
+
export declare function windowOf(reports: readonly PublicHistoryEntry[], selected: PublicHistoryEntry, period: Period): PublicHistoryEntry[];
|
|
42
|
+
/**
|
|
43
|
+
* The slice of history a chart shows, newest first by index. Picking a commit inside the current slice keeps it, so
|
|
44
|
+
* the axes and scale stay where the eye left them; only a commit outside it moves the slice, which then centres on
|
|
45
|
+
* that commit so its neighbours on both sides are in view. The newest commits are the default slice.
|
|
46
|
+
*/
|
|
47
|
+
export declare function stableWindow(reports: readonly PublicHistoryEntry[], index: number, size: number, key: string): Window;
|
|
48
|
+
/** Commit time of an inspection, or null for exports made before commit times were recorded. */
|
|
49
|
+
export declare function commitTime(report: PublicHistoryEntry): number | null;
|
|
50
|
+
/**
|
|
51
|
+
* The inspections a time chart can place: when the history has commit times, one without (a root commit has no churn
|
|
52
|
+
* window to read it from) cannot be put on the time axis, so it stays out of the chart and in the table.
|
|
53
|
+
*/
|
|
54
|
+
export declare function charted(shown: readonly PublicHistoryEntry[]): PublicHistoryEntry[];
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { isMetric, labelOf, metricLabels, metricValue, pluginMetrics } from './viewer-metrics.js';
|
|
2
|
+
/** The views the viewer draws by hand rather than from one metric's values. */
|
|
3
|
+
const ownViews = new Set(['debt-changes', 'diff-coverage']);
|
|
4
|
+
const ownLabels = {
|
|
5
|
+
debt: 'Technical debt', 'debt-changes': 'Technical debt changes', 'diff-coverage': 'Changed-line coverage',
|
|
6
|
+
};
|
|
7
|
+
export function viewLabel(view) {
|
|
8
|
+
return ownLabels[view] ?? labelOf(view);
|
|
9
|
+
}
|
|
10
|
+
/** The metric a view reads at a commit; the views drawn by hand read none. */
|
|
11
|
+
export function viewMetric(view) {
|
|
12
|
+
return ownViews.has(view) ? null : view;
|
|
13
|
+
}
|
|
14
|
+
const builtinGroups = [
|
|
15
|
+
['Maintainability', ['debt', 'debt-changes', 'duplication', 'cognitive', 'complexity', 'smells']],
|
|
16
|
+
// Branch and function coverage come from the registry, where the coverage report has them.
|
|
17
|
+
['Coverage', ['coverage', 'branch-coverage', 'function-coverage', 'diff-coverage']],
|
|
18
|
+
['Security', ['security']],
|
|
19
|
+
['Size', ['code-lines', 'files', 'functions', 'classes', 'comments']],
|
|
20
|
+
];
|
|
21
|
+
/** A view the registry names, not one the viewer draws by hand. */
|
|
22
|
+
function pluginKey(view) {
|
|
23
|
+
return !ownViews.has(view) && !(view in metricLabels);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The series list: Repometry's own groups, with other plugins' metrics joining a group they name or one of their own.
|
|
27
|
+
* A registry metric the groups already place keeps its place, and is left out where this history has no such metric.
|
|
28
|
+
*/
|
|
29
|
+
export function groups() {
|
|
30
|
+
const placed = new Set(builtinGroups.flatMap(([, views]) => views));
|
|
31
|
+
const trended = pluginMetrics().filter(spec => spec.trend);
|
|
32
|
+
const keys = new Set(trended.map(spec => spec.key));
|
|
33
|
+
const merged = new Map(builtinGroups.map(([group, views]) => [group, views.filter(view => !pluginKey(view) || keys.has(view))]));
|
|
34
|
+
for (const spec of trended.filter(spec => !placed.has(spec.key))) {
|
|
35
|
+
merged.set(spec.group, [...merged.get(spec.group) ?? [], spec.key]);
|
|
36
|
+
}
|
|
37
|
+
return [...merged];
|
|
38
|
+
}
|
|
39
|
+
export function isTrendView(value) {
|
|
40
|
+
if (value === 'debt-changes' || value === 'diff-coverage')
|
|
41
|
+
return true;
|
|
42
|
+
return isMetric(value) && groups().some(([, views]) => views.includes(value));
|
|
43
|
+
}
|
|
44
|
+
export function isPeriod(value) {
|
|
45
|
+
return value === '30' || value === '100' || value === 'all';
|
|
46
|
+
}
|
|
47
|
+
/** A metric's value at a commit, read with the commit's own quality summary and context. */
|
|
48
|
+
export function trendValue(data, report, metric) {
|
|
49
|
+
return metricValue(report, metric, data.quality[report.sha], data.context?.[report.sha]);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Views that have data in this history, in display order: debt changes need remediation times, and changed-line
|
|
53
|
+
* coverage needs saved pull request reviews.
|
|
54
|
+
*/
|
|
55
|
+
export function availableViews(data) {
|
|
56
|
+
const has = (metric) => data.reports.some(report => trendValue(data, report, metric) !== null);
|
|
57
|
+
const shown = (view) => view === 'diff-coverage' ? data.reviews > 0 : has(view === 'debt-changes' ? 'effort' : view);
|
|
58
|
+
return groups().flatMap(([, views]) => views).filter(shown);
|
|
59
|
+
}
|
|
60
|
+
/** The whole curve by default; only a very long history opens on its last hundred inspections. */
|
|
61
|
+
export function defaultPeriod(total) {
|
|
62
|
+
return total <= 1000 ? 'all' : '100';
|
|
63
|
+
}
|
|
64
|
+
const windows = new Map();
|
|
65
|
+
/** The inspections shown for a period, oldest first, always including the selected one. */
|
|
66
|
+
export function windowOf(reports, selected, period) {
|
|
67
|
+
const limit = period === 'all' ? reports.length : Number(period);
|
|
68
|
+
const { start, end } = stableWindow(reports, reports.indexOf(selected), limit, 'trends');
|
|
69
|
+
return reports.slice(start, end).reverse();
|
|
70
|
+
}
|
|
71
|
+
/** Whether the slice shown last still fits: the same size over the same history, and the commit inside it. */
|
|
72
|
+
function keeps(previous, index, shape) {
|
|
73
|
+
if (!previous || previous.size !== shape.size || previous.total !== shape.total)
|
|
74
|
+
return false;
|
|
75
|
+
return previous.head === shape.head && index >= previous.start && index < previous.end;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The slice of history a chart shows, newest first by index. Picking a commit inside the current slice keeps it, so
|
|
79
|
+
* the axes and scale stay where the eye left them; only a commit outside it moves the slice, which then centres on
|
|
80
|
+
* that commit so its neighbours on both sides are in view. The newest commits are the default slice.
|
|
81
|
+
*/
|
|
82
|
+
export function stableWindow(reports, index, size, key) {
|
|
83
|
+
const shape = { size, total: reports.length, head: reports[0]?.sha };
|
|
84
|
+
const previous = windows.get(key);
|
|
85
|
+
let result;
|
|
86
|
+
if (keeps(previous, index, shape))
|
|
87
|
+
result = { start: previous.start, end: previous.end };
|
|
88
|
+
else if (index < size)
|
|
89
|
+
result = { start: 0, end: Math.min(size, shape.total) };
|
|
90
|
+
else {
|
|
91
|
+
const end = Math.min(shape.total, Math.max(0, index - Math.floor(size / 2)) + size);
|
|
92
|
+
result = { start: Math.max(0, end - size), end };
|
|
93
|
+
}
|
|
94
|
+
windows.set(key, { ...result, ...shape });
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
/** Commit time of an inspection, or null for exports made before commit times were recorded. */
|
|
98
|
+
export function commitTime(report) {
|
|
99
|
+
const time = report.committedAt === undefined ? NaN : Date.parse(report.committedAt);
|
|
100
|
+
return Number.isFinite(time) ? time : null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The inspections a time chart can place: when the history has commit times, one without (a root commit has no churn
|
|
104
|
+
* window to read it from) cannot be put on the time axis, so it stays out of the chart and in the table.
|
|
105
|
+
*/
|
|
106
|
+
export function charted(shown) {
|
|
107
|
+
const timed = shown.filter(report => commitTime(report) !== null);
|
|
108
|
+
return timed.length ? timed : [...shown];
|
|
109
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PublicHistoryEntry } from '../../json/wire/public-history-model.js';
|
|
2
|
+
import type { Period, TrendData, TrendView } from './viewer-trend-data.js';
|
|
3
|
+
/** The series list, and a select with the same series for a narrow screen. */
|
|
4
|
+
export declare function viewNavigation(data: TrendData, views: readonly TrendView[], current: TrendView, selected: PublicHistoryEntry, period: Period): HTMLElement;
|
|
5
|
+
export declare function periodControl(data: TrendData, sha: string, view: TrendView, period: Period): HTMLElement;
|