@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,69 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { lstat, mkdir, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { readExportedSummary } from './exported-server.js';
|
|
5
|
+
const indexMarker = '<meta name="repometry-projects" content="1">';
|
|
6
|
+
const resources = '../../../../resources/viewer/';
|
|
7
|
+
export async function exportProjects(directory) {
|
|
8
|
+
const folders = await readdir(directory, { withFileTypes: true });
|
|
9
|
+
const candidates = folders.filter(entry => (entry.isDirectory() || entry.isSymbolicLink()) && !entry.name.startsWith('.'));
|
|
10
|
+
const entries = (await Promise.all(candidates.map(({ name }) => readProject(directory, name))))
|
|
11
|
+
.filter(entry => entry !== null);
|
|
12
|
+
entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
13
|
+
const marker = await readOptional(join(directory, 'index.html'));
|
|
14
|
+
const files = new Map([
|
|
15
|
+
['styles.css', await readFile(new URL(resources + 'styles.css', import.meta.url))],
|
|
16
|
+
['projects.js', await readFile(new URL('../app/viewer-projects.js', import.meta.url))],
|
|
17
|
+
['projects.json', JSON.stringify({ schema: 'urn:repometry:schema:projects:1', projects: entries }) + '\n'],
|
|
18
|
+
['index.html', await readFile(new URL(resources + 'projects.html', import.meta.url))],
|
|
19
|
+
]);
|
|
20
|
+
if (marker !== null && !marker.includes(indexMarker))
|
|
21
|
+
throw new Error('Directory already contains another site index');
|
|
22
|
+
for (const name of files.keys()) {
|
|
23
|
+
try {
|
|
24
|
+
const file = await lstat(join(directory, name));
|
|
25
|
+
if (!file.isFile() || marker === null)
|
|
26
|
+
throw new Error(`Project index would overwrite ${name}`);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (!hasCode(error, 'ENOENT'))
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const staging = join(directory, `.projects-${randomUUID()}`);
|
|
34
|
+
await mkdir(staging);
|
|
35
|
+
try {
|
|
36
|
+
for (const [name, contents] of files)
|
|
37
|
+
await writeFile(join(staging, name), contents);
|
|
38
|
+
for (const name of files.keys())
|
|
39
|
+
await rename(join(staging, name), join(directory, name));
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
await rm(staging, { recursive: true, force: true });
|
|
43
|
+
}
|
|
44
|
+
return entries.length;
|
|
45
|
+
}
|
|
46
|
+
async function readProject(directory, name) {
|
|
47
|
+
const summary = await readExportedSummary(join(directory, name));
|
|
48
|
+
if (!summary)
|
|
49
|
+
return null;
|
|
50
|
+
const latest = summary.commits[0];
|
|
51
|
+
if (!latest)
|
|
52
|
+
return { name, inspection: null, quality: null };
|
|
53
|
+
const { quality, counts, detail, revision, profileDigest, profileBoundary, metrics, values, privateMetrics, ...inspection } = latest;
|
|
54
|
+
return { name, inspection, quality };
|
|
55
|
+
}
|
|
56
|
+
async function readOptional(path) {
|
|
57
|
+
try {
|
|
58
|
+
return await readFile(path, 'utf8');
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (hasCode(error, 'ENOENT') || hasCode(error, 'ENOTDIR'))
|
|
62
|
+
return null;
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function hasCode(error, code) {
|
|
67
|
+
return error instanceof Error && 'code' in error && error.code === code;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=projects.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
import { extname } from 'node:path';
|
|
3
|
+
const contentTypes = new Map([
|
|
4
|
+
['.html', 'text/html; charset=utf-8'], ['.css', 'text/css; charset=utf-8'],
|
|
5
|
+
['.js', 'text/javascript; charset=utf-8'], ['.json', 'application/json; charset=utf-8'],
|
|
6
|
+
['.svg', 'image/svg+xml'],
|
|
7
|
+
]);
|
|
8
|
+
export async function serveAssets(port, asset, cleanup) {
|
|
9
|
+
const handle = async (request, response) => {
|
|
10
|
+
const port = request.socket.localPort;
|
|
11
|
+
const host = request.headers.host?.toLowerCase();
|
|
12
|
+
if (port === undefined || (host !== `127.0.0.1:${port}` && host !== `localhost:${port}` && host !== `[::1]:${port}`)) {
|
|
13
|
+
response.writeHead(403).end();
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
|
17
|
+
response.writeHead(405, { Allow: 'GET, HEAD' }).end();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const path = request.url?.split('?', 1)[0];
|
|
21
|
+
const name = path === '/' ? 'index.html' : path?.startsWith('/') ? path.slice(1) : '';
|
|
22
|
+
let data;
|
|
23
|
+
try {
|
|
24
|
+
data = await asset(name);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
response.writeHead(500).end();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!data) {
|
|
31
|
+
response.writeHead(404).end();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const contentType = name.startsWith('sources/') ? 'text/plain; charset=utf-8'
|
|
35
|
+
: contentTypes.get(extname(name)) ?? 'application/octet-stream';
|
|
36
|
+
response.writeHead(200, {
|
|
37
|
+
'Content-Type': contentType, 'Content-Length': data.length,
|
|
38
|
+
'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff',
|
|
39
|
+
});
|
|
40
|
+
response.end(request.method === 'HEAD' ? undefined : data);
|
|
41
|
+
};
|
|
42
|
+
const server = await listen('127.0.0.1', port, handle);
|
|
43
|
+
const address = server.address();
|
|
44
|
+
if (!address || typeof address === 'string') {
|
|
45
|
+
server.close();
|
|
46
|
+
throw new Error('Cannot determine the viewer address');
|
|
47
|
+
}
|
|
48
|
+
const ipv6 = await listen('::1', address.port, handle).catch((error) => {
|
|
49
|
+
if (error instanceof Error && 'code' in error &&
|
|
50
|
+
(error.code === 'EAFNOSUPPORT' || error.code === 'EADDRNOTAVAIL' || error.code === 'EADDRINUSE'))
|
|
51
|
+
return undefined;
|
|
52
|
+
server.close();
|
|
53
|
+
throw error;
|
|
54
|
+
});
|
|
55
|
+
return { url: `http://127.0.0.1:${address.port}/`, close: () => { cleanup?.(); server.close(); ipv6?.close(); } };
|
|
56
|
+
}
|
|
57
|
+
async function listen(host, port, handle) {
|
|
58
|
+
const server = createServer(handle);
|
|
59
|
+
await new Promise((resolve, reject) => {
|
|
60
|
+
server.once('error', reject);
|
|
61
|
+
server.listen(port, host, () => { server.removeListener('error', reject); resolve(); });
|
|
62
|
+
});
|
|
63
|
+
return server;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SourceProvider } from '@repometry/core/internal/ports/source-provider.js';
|
|
2
|
+
export interface SourceAccess {
|
|
3
|
+
readonly read: NonNullable<SourceProvider['read']>;
|
|
4
|
+
readonly close?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function sourceResponse(name: string, access: SourceAccess | undefined, listed: (revision: string, path: string) => Promise<boolean>): Promise<Uint8Array | undefined>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { validSubjectId } from '@repometry/core/internal/model/report.js';
|
|
2
|
+
import { isSourcePathname } from '@repometry/core/internal/ports/source-provider.js';
|
|
3
|
+
export async function sourceResponse(name, access, listed) {
|
|
4
|
+
if (!access)
|
|
5
|
+
return undefined;
|
|
6
|
+
const [prefix, revision, ...segments] = name.split('/');
|
|
7
|
+
if (prefix !== 'sources' || revision === undefined || !validSubjectId('commit', revision))
|
|
8
|
+
return undefined;
|
|
9
|
+
let path;
|
|
10
|
+
try {
|
|
11
|
+
const decoded = segments.map(decodeURIComponent);
|
|
12
|
+
if (decoded.some(part => part.includes('/')))
|
|
13
|
+
return undefined;
|
|
14
|
+
path = decoded.join('/');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
if (!isSourcePathname(path) || !await listed(revision, path))
|
|
20
|
+
return undefined;
|
|
21
|
+
return access.read(revision, path);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=source-route.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PublicHistoryEntry } from '../wire/public-history-model.js';
|
|
2
|
+
import type { Report } from '../validation/report.js';
|
|
3
|
+
import type { CommitSummary, RepositorySummary } from '../wire/summary-model.js';
|
|
4
|
+
export declare function commitSummary(report: Report): CommitSummary;
|
|
5
|
+
export declare function needsMaintainabilityRefresh(row: CommitSummary): boolean;
|
|
6
|
+
export declare function orderSummaries(rows: readonly CommitSummary[]): CommitSummary[];
|
|
7
|
+
export type CommitMetadata = Pick<PublicHistoryEntry, 'subject' | 'author' | 'tags' | 'committedAt'>;
|
|
8
|
+
export type ReadCommitMetadata = (revisions: readonly string[]) => Promise<ReadonlyMap<string, CommitMetadata>>;
|
|
9
|
+
/** Values recorded at analysis win; Git fills in missing metadata and adds current tag names. */
|
|
10
|
+
export declare function withCommitMetadata(rows: readonly CommitSummary[], read?: ReadCommitMetadata): Promise<readonly CommitSummary[]>;
|
|
11
|
+
export declare function expandSummaryCatalog(summary: RepositorySummary): CommitSummary[];
|
|
12
|
+
export declare function repositorySummary(rows: readonly CommitSummary[], pullReviewCount?: number, includePrivateMetrics?: boolean): RepositorySummary;
|
|
13
|
+
export declare function historyEntry(report: Report): PublicHistoryEntry;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { canonicalMetricId, definitions } from '@repometry/core/internal/model/measurement.js';
|
|
2
|
+
import { isRecord } from '@repometry/core/internal/model/plugin-data.js';
|
|
3
|
+
import { qualitySummary } from '@repometry/core/internal/model/quality-summary.js';
|
|
4
|
+
import { securityCounts } from './security-summary.js';
|
|
5
|
+
import { compareHistoryEntries } from '../wire/public-history-model.js';
|
|
6
|
+
import { inspectionProfileDigest } from './inspection-context.js';
|
|
7
|
+
import { reportRevision } from '../validation/report.js';
|
|
8
|
+
import { canonicalMetricDescriptor, metricProjection, unavailableStructureMetrics } from './metric-values.js';
|
|
9
|
+
import { summarySchema } from '../wire/summary-model.js';
|
|
10
|
+
export function commitSummary(report) {
|
|
11
|
+
const history = historyEntry(report);
|
|
12
|
+
const profileDigest = inspectionProfileDigest(report);
|
|
13
|
+
const metrics = metricProjection(report);
|
|
14
|
+
const security = securityCounts(report);
|
|
15
|
+
return {
|
|
16
|
+
...history,
|
|
17
|
+
...(report.commit === undefined ? {} : { subject: report.commit.subject, author: report.commit.author }),
|
|
18
|
+
revision: reportRevision(report),
|
|
19
|
+
...(profileDigest === undefined ? {} : { profileDigest }),
|
|
20
|
+
quality: qualitySummary(report),
|
|
21
|
+
counts: {
|
|
22
|
+
findingCount: report.findings?.length ?? 0,
|
|
23
|
+
diagnosticCount: report.diagnostics.length,
|
|
24
|
+
componentCount: 0,
|
|
25
|
+
hasCoverage: history.lineCoverage !== null,
|
|
26
|
+
...(security ? { security } : {}),
|
|
27
|
+
},
|
|
28
|
+
...(metrics === undefined ? {} : { metrics: metrics.catalog, values: metrics.values(),
|
|
29
|
+
...(metrics.privateMetrics === undefined ? {} : { privateMetrics: metrics.privateMetrics }) }),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// Earlier indices recorded zero effort before any file supplied all inputs for a grade.
|
|
33
|
+
export function needsMaintainabilityRefresh(row) {
|
|
34
|
+
const summary = row.quality.maintainability;
|
|
35
|
+
return summary?.grade === null && summary.debtRatio === null && summary.smells === 0 && summary.effortMinutes === 0;
|
|
36
|
+
}
|
|
37
|
+
export function orderSummaries(rows) {
|
|
38
|
+
return [...rows].sort(compareHistoryEntries);
|
|
39
|
+
}
|
|
40
|
+
/** Values recorded at analysis win; Git fills in missing metadata and adds current tag names. */
|
|
41
|
+
export async function withCommitMetadata(rows, read) {
|
|
42
|
+
if (!read || !rows.length)
|
|
43
|
+
return rows;
|
|
44
|
+
const metadata = await read(rows.map(row => row.sha));
|
|
45
|
+
return rows.map(row => {
|
|
46
|
+
const found = metadata.get(row.sha);
|
|
47
|
+
if (found === undefined)
|
|
48
|
+
return row;
|
|
49
|
+
const { committedAt: gitTime, ...gitFields } = found;
|
|
50
|
+
const { sha, generatedAt, committedAt = gitTime, ...rest } = row;
|
|
51
|
+
return { ...gitFields, sha, generatedAt, ...(committedAt === undefined ? {} : { committedAt }), ...rest,
|
|
52
|
+
...(gitFields.tags === undefined ? {} : { tags: gitFields.tags }) };
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function expandSummaryCatalog(summary) {
|
|
56
|
+
return orderSummaries(summary.commits).map(row => summary.metrics === undefined || row.values === undefined ? row
|
|
57
|
+
: { ...row, metrics: summary.metrics, ...(summary.privateMetrics === undefined ? {} : { privateMetrics: summary.privateMetrics }) });
|
|
58
|
+
}
|
|
59
|
+
export function repositorySummary(rows, pullReviewCount, includePrivateMetrics = true) {
|
|
60
|
+
const ordered = orderSummaries(rows);
|
|
61
|
+
const privateMetrics = new Set(ordered.flatMap(row => row.privateMetrics ?? []).map(canonicalMetricId));
|
|
62
|
+
const catalog = new Map();
|
|
63
|
+
for (const row of ordered) {
|
|
64
|
+
for (const descriptor of row.metrics ?? []) {
|
|
65
|
+
const metric = canonicalMetricDescriptor(descriptor);
|
|
66
|
+
if ((includePrivateMetrics || !privateMetrics.has(metric.id)) && !catalog.has(metric.id))
|
|
67
|
+
catalog.set(metric.id, metric);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const metrics = [...catalog.values()];
|
|
71
|
+
const positions = new Map(metrics.map(({ id }, index) => [id, index]));
|
|
72
|
+
const commits = ordered.map(({ metrics: local, values, privateMetrics: _private, ...row }) => {
|
|
73
|
+
if (!local || !values)
|
|
74
|
+
return row;
|
|
75
|
+
const mapped = {};
|
|
76
|
+
for (const [index, value] of Object.entries(values)) {
|
|
77
|
+
const id = local[Number(index)]?.id;
|
|
78
|
+
const canonical = id === undefined ? undefined : canonicalMetricId(id);
|
|
79
|
+
const position = canonical === undefined ? undefined : positions.get(canonical);
|
|
80
|
+
if (position !== undefined && (canonical === id || !Object.hasOwn(mapped, position)))
|
|
81
|
+
mapped[position] = value;
|
|
82
|
+
}
|
|
83
|
+
return Object.keys(mapped).length ? { ...row, values: mapped } : row;
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
schema: summarySchema,
|
|
87
|
+
commits,
|
|
88
|
+
...(metrics.length ? { metrics } : {}),
|
|
89
|
+
...(includePrivateMetrics && privateMetrics.size ? { privateMetrics: [...privateMetrics] } : {}),
|
|
90
|
+
...(pullReviewCount === undefined ? {} : { pullReviewCount }),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function historyEntry(report) {
|
|
94
|
+
let lines = null;
|
|
95
|
+
let functions = null;
|
|
96
|
+
let maxComplexity = null;
|
|
97
|
+
let lineCoverage = null;
|
|
98
|
+
for (const item of report.measurements) {
|
|
99
|
+
if (item.value === null || item.value < 0)
|
|
100
|
+
continue;
|
|
101
|
+
if (item.target === 'file' && Number.isSafeInteger(item.value)) {
|
|
102
|
+
if (item.definition === definitions.lines)
|
|
103
|
+
lines = (lines ?? 0) + item.value;
|
|
104
|
+
if (item.definition === definitions.functions)
|
|
105
|
+
functions = (functions ?? 0) + item.value;
|
|
106
|
+
}
|
|
107
|
+
if (item.target === 'function' && canonicalMetricId(item.definition) === definitions.complexity && Number.isSafeInteger(item.value)) {
|
|
108
|
+
maxComplexity = Math.max(maxComplexity ?? 0, item.value);
|
|
109
|
+
}
|
|
110
|
+
if (item.target === 'repository' && item.definition === definitions.coverage && item.covered !== undefined && item.total !== undefined && item.total > 0) {
|
|
111
|
+
lineCoverage = { covered: item.covered, total: item.total };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const unmeasured = new Set(report.pluginData?.inventory?.flatMap(unavailableStructureMetrics));
|
|
115
|
+
const measured = (id, value) => unmeasured.has(id) ? null : value;
|
|
116
|
+
const window = report.appliedConfig.churnWindow;
|
|
117
|
+
const endingAt = isRecord(window) && typeof window.endingAt === 'string' ? window.endingAt : '';
|
|
118
|
+
const committedAt = Date.parse(report.committedAt ?? endingAt);
|
|
119
|
+
const generatedAt = Date.parse(report.generatedAt);
|
|
120
|
+
return { sha: report.subject.id, generatedAt: Number.isFinite(generatedAt) ? new Date(generatedAt).toISOString() : '',
|
|
121
|
+
...(Number.isFinite(committedAt) ? { committedAt: new Date(committedAt).toISOString() } : {}), status: report.status,
|
|
122
|
+
files: report.scope.files, parsed: report.scope.parsed, lines: measured(definitions.lines, lines),
|
|
123
|
+
functions: measured(definitions.functions, functions), maxComplexity: measured(definitions.complexity, maxComplexity), lineCoverage };
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=commit-summary.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FileMetricsReport } from '../wire/file-metrics-model.js';
|
|
2
|
+
import type { Component, ComponentMetrics } from '../wire/component-model.js';
|
|
3
|
+
export type { Component, ComponentMetrics } from '../wire/component-model.js';
|
|
4
|
+
export declare function componentFiles(components: readonly Component[], metrics: FileMetricsReport): readonly ComponentMetrics[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function componentFiles(components, metrics) {
|
|
2
|
+
return components.map(component => {
|
|
3
|
+
const matchers = component.pathGlobs.map(matcher);
|
|
4
|
+
return { component, paths: metrics.files.filter(({ path }) => matchers.some(match => match(path))).map(({ path }) => path) };
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
function matcher(pattern) {
|
|
8
|
+
const parts = pattern.split(/\*+/);
|
|
9
|
+
if (parts.length === 1)
|
|
10
|
+
return path => path === pattern;
|
|
11
|
+
const first = parts[0];
|
|
12
|
+
const last = parts[parts.length - 1];
|
|
13
|
+
const middle = parts.slice(1, -1);
|
|
14
|
+
return path => {
|
|
15
|
+
if (!path.startsWith(first) || !path.endsWith(last))
|
|
16
|
+
return false;
|
|
17
|
+
const limit = path.length - last.length;
|
|
18
|
+
let position = first.length;
|
|
19
|
+
if (position > limit)
|
|
20
|
+
return false;
|
|
21
|
+
for (const part of middle) {
|
|
22
|
+
const found = path.indexOf(part, position);
|
|
23
|
+
if (found < 0 || found + part.length > limit)
|
|
24
|
+
return false;
|
|
25
|
+
position = found + part.length;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LanguageLookup } from '@repometry/core/internal/model/language.js';
|
|
2
|
+
import type { Report } from '../validation/report.js';
|
|
3
|
+
import type { FileMetricsReport } from '../wire/file-metrics-model.js';
|
|
4
|
+
export declare function fileMetrics(report: Report, registry?: LanguageLookup): FileMetricsReport;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { canonicalFileTypeId, fileTypeId, fileTypes } from '@repometry/core/internal/model/file-types.js';
|
|
2
|
+
import { isRecord } from '@repometry/core/internal/engine/plugin.js';
|
|
3
|
+
import { canonicalMetricId, definitions } from '@repometry/core/internal/model/measurement.js';
|
|
4
|
+
import { legacySyntaxPlugin } from './inspection-context.js';
|
|
5
|
+
import { comparePaths } from '@repometry/core/internal/model/snapshot.js';
|
|
6
|
+
import { metricProjection } from './metric-values.js';
|
|
7
|
+
import { fileMetricsSchema } from '../wire/file-metrics-model.js';
|
|
8
|
+
export function fileMetrics(report, registry = { id: fileTypeId, catalog: [] }) {
|
|
9
|
+
const byPath = new Map();
|
|
10
|
+
const pluginMetrics = metricProjection(report);
|
|
11
|
+
const languages = [];
|
|
12
|
+
const recorded = new Map(report.pluginData?.languages?.map(item => [canonicalFileTypeId(item.id), item]));
|
|
13
|
+
const languageCatalog = new Map([...fileTypes, ...registry.catalog, ...recorded.values()].map(item => [canonicalFileTypeId(item.id), item]));
|
|
14
|
+
const languageIndexes = new Map();
|
|
15
|
+
function file(path) {
|
|
16
|
+
const existing = byPath.get(path);
|
|
17
|
+
if (existing)
|
|
18
|
+
return existing;
|
|
19
|
+
const metrics = emptyMetrics(path);
|
|
20
|
+
byPath.set(path, metrics);
|
|
21
|
+
return metrics;
|
|
22
|
+
}
|
|
23
|
+
function languageIndex(id, analysed) {
|
|
24
|
+
const existing = languageIndexes.get(id);
|
|
25
|
+
if (existing !== undefined) {
|
|
26
|
+
languages[existing].analysed ||= analysed;
|
|
27
|
+
return existing;
|
|
28
|
+
}
|
|
29
|
+
const index = languages.length;
|
|
30
|
+
languageIndexes.set(id, index);
|
|
31
|
+
const display = languageCatalog.get(id);
|
|
32
|
+
languages.push({ id, label: display?.label ?? (id === 'other' ? 'Other' : id.toUpperCase()),
|
|
33
|
+
...(display?.color === undefined ? {} : { color: display.color }), analysed });
|
|
34
|
+
return index;
|
|
35
|
+
}
|
|
36
|
+
for (const { path, lines, bytes, language, analysed, provider } of report.pluginData?.inventory ?? []) {
|
|
37
|
+
const entry = file(path);
|
|
38
|
+
entry.lines = lines;
|
|
39
|
+
if (bytes !== undefined)
|
|
40
|
+
entry.bytes = bytes;
|
|
41
|
+
const id = canonicalFileTypeId(language);
|
|
42
|
+
entry.language = languageIndex(provider !== undefined || recorded.has(id) ? id : fileTypeId(path, id), analysed);
|
|
43
|
+
entry.analysed = analysed;
|
|
44
|
+
if (provider !== undefined)
|
|
45
|
+
entry.provider = provider;
|
|
46
|
+
}
|
|
47
|
+
const duplicatedLines = collectMeasurements(report.measurements, file, pluginMetrics !== undefined);
|
|
48
|
+
const skipped = new Set(report.ruleSkips?.map(({ path }) => path));
|
|
49
|
+
addFileQuality(byPath, duplicatedLines, report.findings, skipped);
|
|
50
|
+
let unassignedDiagnostics = 0;
|
|
51
|
+
for (const { path, operation } of report.diagnostics) {
|
|
52
|
+
const target = path === undefined ? undefined
|
|
53
|
+
: operation === `${legacySyntaxPlugin}/parse` || operation.startsWith('structure/') ? file(path) : byPath.get(path);
|
|
54
|
+
if (target)
|
|
55
|
+
target.diagnosticCount++;
|
|
56
|
+
else
|
|
57
|
+
unassignedDiagnostics++;
|
|
58
|
+
}
|
|
59
|
+
const files = [...byPath.values()].sort(byName);
|
|
60
|
+
const directories = new Map();
|
|
61
|
+
for (const entry of files) {
|
|
62
|
+
entry.language ??= languageIndex(registry.id(entry.path), entry.lines !== null || entry.lineCoverage !== null || entry.functions !== null);
|
|
63
|
+
if (pluginMetrics && entry.analysed !== false) {
|
|
64
|
+
const values = pluginMetrics.values(entry.path);
|
|
65
|
+
if (Object.keys(values).length)
|
|
66
|
+
entry.values = values;
|
|
67
|
+
}
|
|
68
|
+
if (entry.functions === 0 && !entry.complexity && pluginMetrics?.isAvailable(definitions.complexity, entry.path) !== false) {
|
|
69
|
+
entry.complexity = { sum: 0, maximum: null, measuredFunctions: 0 };
|
|
70
|
+
}
|
|
71
|
+
rollUpFile(directories, entry);
|
|
72
|
+
}
|
|
73
|
+
if (pluginMetrics) {
|
|
74
|
+
for (const entry of directories.values())
|
|
75
|
+
applyDirectoryProjection(entry, pluginMetrics);
|
|
76
|
+
}
|
|
77
|
+
const complexity = files.filter(entry => entry.complexity?.maximum != null)
|
|
78
|
+
.sort((left, right) => right.complexity.maximum - left.complexity.maximum
|
|
79
|
+
|| right.complexity.sum - left.complexity.sum || byName(left, right));
|
|
80
|
+
const coverage = ranked(files, ({ lineCoverage }) => lineCoverage && lineCoverage.covered < lineCoverage.total
|
|
81
|
+
? lineCoverage.total - lineCoverage.covered : undefined) ?? [];
|
|
82
|
+
const cognitive = ranked(files, entry => entry.quality?.cognitiveComplexity);
|
|
83
|
+
const duplication = ranked(files, entry => entry.quality?.duplication?.duplicatedLines);
|
|
84
|
+
const churn = ranked(files, entry => entry.quality?.churn);
|
|
85
|
+
const churnWindow = readChurnWindow(report.appliedConfig);
|
|
86
|
+
return { schema: fileMetricsSchema, subject: report.subject, generatedAt: report.generatedAt,
|
|
87
|
+
status: report.status, scope: report.scope, files, directories: [...directories.values()].sort(byName), unassignedDiagnostics,
|
|
88
|
+
...(pluginMetrics === undefined ? {} : { catalog: pluginMetrics.catalog }),
|
|
89
|
+
...(languages.length === 0 ? {} : { languages }),
|
|
90
|
+
...(churnWindow === undefined ? {} : { churnWindow }),
|
|
91
|
+
hotspots: { complexity: complexity.map(entry => entry.path), missedLines: coverage,
|
|
92
|
+
...(cognitive === undefined ? {} : { cognitive }), ...(duplication === undefined ? {} : { duplication }),
|
|
93
|
+
...(churn === undefined ? {} : { churn }) } };
|
|
94
|
+
}
|
|
95
|
+
const qualityFields = new Map([
|
|
96
|
+
[definitions.codeLines, 'codeLines'], [definitions.comments, 'commentLines'], [definitions.classes, 'classes'],
|
|
97
|
+
[definitions.cognitiveComplexity, 'cognitiveComplexity'], [definitions.churn, 'churn'],
|
|
98
|
+
]);
|
|
99
|
+
function collectMeasurements(rows, file, includeMeasuredFiles) {
|
|
100
|
+
const duplicated = new Map();
|
|
101
|
+
for (const { path, target, value, definition, covered, total } of rows) {
|
|
102
|
+
if (!path)
|
|
103
|
+
continue;
|
|
104
|
+
if (includeMeasuredFiles)
|
|
105
|
+
file(path);
|
|
106
|
+
const id = canonicalMetricId(definition);
|
|
107
|
+
if (target === 'file' && id === definitions.coverage && covered !== undefined && total !== undefined) {
|
|
108
|
+
file(path).lineCoverage = { covered, total };
|
|
109
|
+
}
|
|
110
|
+
if (value === null || !Number.isSafeInteger(value) || value < 0)
|
|
111
|
+
continue;
|
|
112
|
+
if (target === 'file') {
|
|
113
|
+
const field = qualityFields.get(id);
|
|
114
|
+
if (field)
|
|
115
|
+
quality(file(path))[field] = value;
|
|
116
|
+
else if (id === definitions.lines)
|
|
117
|
+
file(path).lines = value;
|
|
118
|
+
else if (id === definitions.functions)
|
|
119
|
+
file(path).functions = value;
|
|
120
|
+
else if (id === definitions.duplicatedLines)
|
|
121
|
+
duplicated.set(path, value);
|
|
122
|
+
}
|
|
123
|
+
else if (target === 'function' && id === definitions.complexity) {
|
|
124
|
+
const entry = file(path);
|
|
125
|
+
entry.complexity = addComplexity(entry.complexity, { sum: value, maximum: value, measuredFunctions: 1 });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return duplicated;
|
|
129
|
+
}
|
|
130
|
+
function applyDirectoryProjection(entry, projection) {
|
|
131
|
+
const values = projection.values(entry.path, true);
|
|
132
|
+
if (Object.keys(values).length)
|
|
133
|
+
entry.values = values;
|
|
134
|
+
const known = (id) => projection.isAvailable(id, entry.path, true);
|
|
135
|
+
if (!known(definitions.functions))
|
|
136
|
+
entry.functions = null;
|
|
137
|
+
if (!known(definitions.complexity))
|
|
138
|
+
entry.complexity = null;
|
|
139
|
+
if (!entry.quality)
|
|
140
|
+
return;
|
|
141
|
+
for (const [id, field] of qualityFields)
|
|
142
|
+
if (!known(id))
|
|
143
|
+
delete entry.quality[field];
|
|
144
|
+
if (!known(definitions.duplicatedLines) || !known(definitions.codeLines))
|
|
145
|
+
delete entry.quality.duplication;
|
|
146
|
+
}
|
|
147
|
+
function addFileQuality(byPath, duplicated, findings, skipped) {
|
|
148
|
+
for (const [path, duplicatedLines] of duplicated) {
|
|
149
|
+
const entry = byPath.get(path);
|
|
150
|
+
const codeLines = entry?.quality?.codeLines;
|
|
151
|
+
if (!entry || codeLines === undefined || duplicatedLines > codeLines)
|
|
152
|
+
continue;
|
|
153
|
+
const result = quality(entry);
|
|
154
|
+
result.duplication = { duplicatedLines, codeLines };
|
|
155
|
+
if (findings !== undefined && !skipped.has(path))
|
|
156
|
+
result.maintainability = { smells: 0, effortMinutes: 0 };
|
|
157
|
+
}
|
|
158
|
+
for (const finding of findings ?? []) {
|
|
159
|
+
if (!finding.path || (finding.category !== 'structure' && finding.category !== 'duplication'))
|
|
160
|
+
continue;
|
|
161
|
+
const observations = byPath.get(finding.path)?.quality;
|
|
162
|
+
if (!observations?.maintainability)
|
|
163
|
+
continue;
|
|
164
|
+
observations.maintainability = addMaintainability(observations.maintainability, {
|
|
165
|
+
smells: 1, effortMinutes: finding.effortMinutes ?? null,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function emptyMetrics(path) {
|
|
170
|
+
return { path, lines: null, functions: null, complexity: null, lineCoverage: null, diagnosticCount: 0 };
|
|
171
|
+
}
|
|
172
|
+
function byName(left, right) {
|
|
173
|
+
return comparePaths(left.path, right.path);
|
|
174
|
+
}
|
|
175
|
+
function rollUpFile(directories, file) {
|
|
176
|
+
let path = file.path;
|
|
177
|
+
do {
|
|
178
|
+
path = path.slice(0, Math.max(0, path.lastIndexOf('/')));
|
|
179
|
+
let directory = directories.get(path);
|
|
180
|
+
if (!directory) {
|
|
181
|
+
directory = { ...emptyMetrics(path), files: 0, sizeMeasuredFiles: 0, coverageMeasuredFiles: 0 };
|
|
182
|
+
directories.set(path, directory);
|
|
183
|
+
}
|
|
184
|
+
directory.files++;
|
|
185
|
+
if (file.lines !== null)
|
|
186
|
+
directory.sizeMeasuredFiles++;
|
|
187
|
+
directory.lines = sumKnown(directory.lines, file.lines);
|
|
188
|
+
if (file.bytes !== undefined)
|
|
189
|
+
directory.bytes = (directory.bytes ?? 0) + file.bytes;
|
|
190
|
+
directory.functions = sumKnown(directory.functions, file.functions);
|
|
191
|
+
directory.complexity = addComplexity(directory.complexity, file.complexity);
|
|
192
|
+
if (file.lineCoverage) {
|
|
193
|
+
directory.coverageMeasuredFiles++;
|
|
194
|
+
directory.lineCoverage = {
|
|
195
|
+
covered: (directory.lineCoverage?.covered ?? 0) + file.lineCoverage.covered,
|
|
196
|
+
total: (directory.lineCoverage?.total ?? 0) + file.lineCoverage.total,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
directory.diagnosticCount += file.diagnosticCount;
|
|
200
|
+
if (file.quality)
|
|
201
|
+
addQuality(quality(directory), file.quality);
|
|
202
|
+
} while (path !== '');
|
|
203
|
+
}
|
|
204
|
+
function quality(entry) {
|
|
205
|
+
return entry.quality ??= {};
|
|
206
|
+
}
|
|
207
|
+
function addQuality(target, source) {
|
|
208
|
+
for (const key of ['codeLines', 'commentLines', 'classes', 'cognitiveComplexity', 'churn']) {
|
|
209
|
+
const value = source[key];
|
|
210
|
+
if (value !== undefined)
|
|
211
|
+
target[key] = (target[key] ?? 0) + value;
|
|
212
|
+
}
|
|
213
|
+
if (source.duplication) {
|
|
214
|
+
target.duplication = {
|
|
215
|
+
duplicatedLines: (target.duplication?.duplicatedLines ?? 0) + source.duplication.duplicatedLines,
|
|
216
|
+
codeLines: (target.duplication?.codeLines ?? 0) + source.duplication.codeLines,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (source.maintainability) {
|
|
220
|
+
target.maintainability = addMaintainability(target.maintainability ?? { smells: 0, effortMinutes: 0 }, source.maintainability);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function readChurnWindow(config) {
|
|
224
|
+
const { churn, churnWindow } = config;
|
|
225
|
+
if (!isRecord(churn) || !isRecord(churnWindow))
|
|
226
|
+
return undefined;
|
|
227
|
+
const { lookbackDays, maxCommits } = churn;
|
|
228
|
+
const { endingAt, commits, shallow, capReached } = churnWindow;
|
|
229
|
+
if (typeof lookbackDays !== 'number' || !Number.isSafeInteger(lookbackDays) || lookbackDays < 1
|
|
230
|
+
|| typeof maxCommits !== 'number' || !Number.isSafeInteger(maxCommits) || maxCommits < 1
|
|
231
|
+
|| typeof commits !== 'number' || !Number.isSafeInteger(commits) || commits < 0 || commits > maxCommits
|
|
232
|
+
|| typeof endingAt !== 'string' || !Number.isFinite(Date.parse(endingAt))
|
|
233
|
+
|| typeof shallow !== 'boolean' || typeof capReached !== 'boolean')
|
|
234
|
+
return undefined;
|
|
235
|
+
return { lookbackDays, maxCommits, endingAt, commits, shallow, capReached };
|
|
236
|
+
}
|
|
237
|
+
function addMaintainability(left, right) {
|
|
238
|
+
return { smells: left.smells + right.smells, effortMinutes: left.effortMinutes === null || right.effortMinutes === null
|
|
239
|
+
? null : left.effortMinutes + right.effortMinutes };
|
|
240
|
+
}
|
|
241
|
+
function ranked(files, score) {
|
|
242
|
+
const entries = files.flatMap(entry => {
|
|
243
|
+
const value = score(entry);
|
|
244
|
+
return value === undefined ? [] : [{ entry, value }];
|
|
245
|
+
});
|
|
246
|
+
if (entries.length === 0)
|
|
247
|
+
return undefined;
|
|
248
|
+
return entries.filter(({ value }) => value > 0).sort((left, right) => right.value - left.value || byName(left.entry, right.entry))
|
|
249
|
+
.map(({ entry }) => entry.path);
|
|
250
|
+
}
|
|
251
|
+
function sumKnown(left, right) {
|
|
252
|
+
return right === null ? left : (left ?? 0) + right;
|
|
253
|
+
}
|
|
254
|
+
function addComplexity(left, right) {
|
|
255
|
+
if (!left || !right)
|
|
256
|
+
return left ?? right;
|
|
257
|
+
const maximum = left.maximum === null ? right.maximum : Math.max(left.maximum, right.maximum ?? left.maximum);
|
|
258
|
+
return { sum: left.sum + right.sum, maximum, measuredFunctions: left.measuredFunctions + right.measuredFunctions };
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=file-metrics.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isRecord } from '@repometry/core/internal/engine/plugin.js';
|
|
2
|
+
export function ignoreView(value) {
|
|
3
|
+
if (!Array.isArray(value))
|
|
4
|
+
return [];
|
|
5
|
+
return value.flatMap((entry) => {
|
|
6
|
+
if (!isRecord(entry))
|
|
7
|
+
return [];
|
|
8
|
+
const facts = Object.fromEntries(['tool', 'rule', 'reason'].flatMap(key => typeof entry[key] === 'string' ? [[key, entry[key]]] : []));
|
|
9
|
+
const paths = Array.isArray(entry.path) ? entry.path : [entry.path];
|
|
10
|
+
return paths.map(path => typeof path === 'string' ? { ...facts, path } : facts);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ignore-view.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Report } from '../validation/report.js';
|
|
2
|
+
import type { InspectionContext } from '../wire/inspection-context-model.js';
|
|
3
|
+
export declare function inspectionProfileDigest(report: Report): string | undefined;
|
|
4
|
+
export declare function inspectionContext(report: Report): InspectionContext | undefined;
|
|
5
|
+
export declare const legacySyntaxPlugin = "babel-syntax";
|