@repometry/cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +70 -2
- package/package.json +75 -4
- package/target/main/resources/language-catalog.json +77 -0
- package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
- package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
- package/target/main/resources/report/json/config-v2.schema.json +224 -0
- package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
- package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
- package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
- package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
- package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
- package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
- package/target/main/resources/report/json/report-v2.schema.json +534 -0
- package/target/main/resources/report/json/repository-summary-v1.schema.json +341 -0
- package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
- package/target/main/resources/viewer/files.css +616 -0
- package/target/main/resources/viewer/index.html +120 -0
- package/target/main/resources/viewer/projects.html +52 -0
- package/target/main/resources/viewer/styles.css +579 -0
- package/target/main/resources/viewer/viewer-pulls.css +64 -0
- package/target/main/ts/api/cache/root.d.ts +2 -0
- package/target/main/ts/api/cache/root.js +21 -0
- package/target/main/ts/api/gh/github.d.ts +4 -0
- package/target/main/ts/api/gh/github.js +47 -0
- package/target/main/ts/api/git/blob-batch.d.ts +10 -0
- package/target/main/ts/api/git/blob-batch.js +107 -0
- package/target/main/ts/api/git/blob-history.d.ts +20 -0
- package/target/main/ts/api/git/blob-history.js +54 -0
- package/target/main/ts/api/git/changes.d.ts +27 -0
- package/target/main/ts/api/git/changes.js +117 -0
- package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
- package/target/main/ts/api/git/commit-metadata.js +46 -0
- package/target/main/ts/api/git/git-churn.d.ts +9 -0
- package/target/main/ts/api/git/git-churn.js +72 -0
- package/target/main/ts/api/git/git-executable.d.ts +1 -0
- package/target/main/ts/api/git/git-executable.js +31 -0
- package/target/main/ts/api/git/git-reader.d.ts +24 -0
- package/target/main/ts/api/git/git-reader.js +113 -0
- package/target/main/ts/api/git/git.d.ts +47 -0
- package/target/main/ts/api/git/git.js +289 -0
- package/target/main/ts/api/git/inspection-source.d.ts +17 -0
- package/target/main/ts/api/git/inspection-source.js +36 -0
- package/target/main/ts/api/git/line-changes.d.ts +6 -0
- package/target/main/ts/api/git/line-changes.js +57 -0
- package/target/main/ts/api/git/local-sources.d.ts +5 -0
- package/target/main/ts/api/git/local-sources.js +48 -0
- package/target/main/ts/api/git/local.d.ts +7 -0
- package/target/main/ts/api/git/local.js +106 -0
- package/target/main/ts/api/git/source-cache.d.ts +1 -0
- package/target/main/ts/api/git/source-cache.js +42 -0
- package/target/main/ts/api/import/cobertura.d.ts +2 -0
- package/target/main/ts/api/import/cobertura.js +160 -0
- package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
- package/target/main/ts/api/import/coverage-xml.js +135 -0
- package/target/main/ts/api/import/finding-import.d.ts +9 -0
- package/target/main/ts/api/import/finding-import.js +227 -0
- package/target/main/ts/api/import/go-cover.d.ts +13 -0
- package/target/main/ts/api/import/go-cover.js +150 -0
- package/target/main/ts/api/import/lcov-files.d.ts +12 -0
- package/target/main/ts/api/import/lcov-files.js +53 -0
- package/target/main/ts/api/import/profile-file.d.ts +4 -0
- package/target/main/ts/api/import/profile-file.js +17 -0
- package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
- package/target/main/ts/api/process/docker-tool-runner.js +92 -0
- package/target/main/ts/api/process/failure.d.ts +1 -0
- package/target/main/ts/api/process/failure.js +12 -0
- package/target/main/ts/api/process/plugin.d.ts +13 -0
- package/target/main/ts/api/process/plugin.js +100 -0
- package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
- package/target/main/ts/api/process/tool-snapshot.js +26 -0
- package/target/main/ts/cli/arguments.d.ts +28 -0
- package/target/main/ts/cli/arguments.js +109 -0
- package/target/main/ts/cli/config.d.ts +63 -0
- package/target/main/ts/cli/config.js +165 -0
- package/target/main/ts/cli/imports.d.ts +9 -0
- package/target/main/ts/cli/imports.js +37 -0
- package/target/main/ts/cli/main.d.ts +2 -0
- package/target/main/ts/cli/main.js +4 -0
- package/target/main/ts/cli/range-inspection.d.ts +38 -0
- package/target/main/ts/cli/range-inspection.js +34 -0
- package/target/main/ts/cli/range-jobs.d.ts +23 -0
- package/target/main/ts/cli/range-jobs.js +152 -0
- package/target/main/ts/cli/range-worker.d.ts +1 -0
- package/target/main/ts/cli/range-worker.js +40 -0
- package/target/main/ts/cli/reporting.d.ts +42 -0
- package/target/main/ts/cli/reporting.js +98 -0
- package/target/main/ts/cli/revisions.d.ts +6 -0
- package/target/main/ts/cli/revisions.js +16 -0
- package/target/main/ts/cli/run.d.ts +2 -0
- package/target/main/ts/cli/run.js +306 -0
- package/target/main/ts/cli/store.d.ts +13 -0
- package/target/main/ts/cli/store.js +39 -0
- package/target/main/ts/compose/analysis-report.d.ts +6 -0
- package/target/main/ts/compose/analysis-report.js +132 -0
- package/target/main/ts/compose/analysis-results.d.ts +46 -0
- package/target/main/ts/compose/analysis-results.js +119 -0
- package/target/main/ts/compose/analysis-steps.d.ts +23 -0
- package/target/main/ts/compose/analysis-steps.js +217 -0
- package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
- package/target/main/ts/compose/analyze-snapshot.js +21 -0
- package/target/main/ts/compose/attach-churn.d.ts +2 -0
- package/target/main/ts/compose/attach-churn.js +50 -0
- package/target/main/ts/compose/built-ins.d.ts +6 -0
- package/target/main/ts/compose/built-ins.js +12 -0
- package/target/main/ts/compose/diff-coverage.d.ts +25 -0
- package/target/main/ts/compose/diff-coverage.js +82 -0
- package/target/main/ts/compose/distribution.d.ts +17 -0
- package/target/main/ts/compose/distribution.js +13 -0
- package/target/main/ts/compose/docker-image.d.ts +5 -0
- package/target/main/ts/compose/docker-image.js +49 -0
- package/target/main/ts/compose/file-selection.d.ts +9 -0
- package/target/main/ts/compose/file-selection.js +38 -0
- package/target/main/ts/compose/history-cache.d.ts +31 -0
- package/target/main/ts/compose/history-cache.js +62 -0
- package/target/main/ts/compose/inspect.d.ts +34 -0
- package/target/main/ts/compose/inspect.js +51 -0
- package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
- package/target/main/ts/compose/inspection-coverage.js +9 -0
- package/target/main/ts/compose/js-plugin.d.ts +113 -0
- package/target/main/ts/compose/js-plugin.js +99 -0
- package/target/main/ts/compose/language-discovery.d.ts +12 -0
- package/target/main/ts/compose/language-discovery.js +51 -0
- package/target/main/ts/compose/languages.d.ts +64 -0
- package/target/main/ts/compose/languages.js +98 -0
- package/target/main/ts/compose/load-plugins.d.ts +6 -0
- package/target/main/ts/compose/load-plugins.js +71 -0
- package/target/main/ts/compose/parser-order.d.ts +20 -0
- package/target/main/ts/compose/parser-order.js +90 -0
- package/target/main/ts/compose/phases.d.ts +140 -0
- package/target/main/ts/compose/phases.js +147 -0
- package/target/main/ts/compose/plugin-list.d.ts +37 -0
- package/target/main/ts/compose/plugin-list.js +30 -0
- package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
- package/target/main/ts/compose/plugin-manifest.js +50 -0
- package/target/main/ts/compose/plugin-options.d.ts +2 -0
- package/target/main/ts/compose/plugin-options.js +29 -0
- package/target/main/ts/compose/plugin-reference.d.ts +9 -0
- package/target/main/ts/compose/plugin-reference.js +40 -0
- package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
- package/target/main/ts/compose/plugin-requirements.js +83 -0
- package/target/main/ts/compose/plugin-scope.d.ts +9 -0
- package/target/main/ts/compose/plugin-scope.js +60 -0
- package/target/main/ts/compose/process-plugins.d.ts +89 -0
- package/target/main/ts/compose/process-plugins.js +74 -0
- package/target/main/ts/compose/registered-plugin.d.ts +17 -0
- package/target/main/ts/compose/registered-plugin.js +8 -0
- package/target/main/ts/compose/review.d.ts +26 -0
- package/target/main/ts/compose/review.js +54 -0
- package/target/main/ts/compose/schema-error.d.ts +2 -0
- package/target/main/ts/compose/schema-error.js +16 -0
- package/target/main/ts/compose/sources.d.ts +2 -0
- package/target/main/ts/compose/sources.js +32 -0
- package/target/main/ts/compose/structure-measures.d.ts +9 -0
- package/target/main/ts/compose/structure-measures.js +63 -0
- package/target/main/ts/index.d.ts +8 -0
- package/target/main/ts/index.js +5 -0
- package/target/main/ts/plugin.d.ts +2 -0
- package/target/main/ts/plugin.js +2 -0
- package/target/main/ts/plugins/built-in.d.ts +3 -0
- package/target/main/ts/plugins/built-in.js +19 -0
- package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
- package/target/main/ts/plugins/coverage/coverage.js +289 -0
- package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
- package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
- package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
- package/target/main/ts/plugins/duplication/duplication.js +95 -0
- package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
- package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
- package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
- package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
- package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
- package/target/main/ts/plugins/language-js/code-lines.js +36 -0
- package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
- package/target/main/ts/plugins/language-js/extensions.js +3 -0
- package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
- package/target/main/ts/plugins/language-js/function-facts.js +74 -0
- package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
- package/target/main/ts/plugins/language-js/js-security.js +497 -0
- package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
- package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
- package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
- package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
- package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
- package/target/main/ts/plugins/language-js/syntax.js +11 -0
- package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
- package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
- package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
- package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
- package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
- package/target/main/ts/plugins/security/actions-security.js +581 -0
- package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
- package/target/main/ts/plugins/security/dockerfile.js +487 -0
- package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
- package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
- package/target/main/ts/plugins/security/secrets.d.ts +12 -0
- package/target/main/ts/plugins/security/secrets.js +254 -0
- package/target/main/ts/plugins/source/forges.d.ts +4 -0
- package/target/main/ts/plugins/source/forges.js +80 -0
- package/target/main/ts/plugins/structure/structure.d.ts +2 -0
- package/target/main/ts/plugins/structure/structure.js +42 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
- package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
- package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
- package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
- package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
- package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
- package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
- package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
- package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-chart.js +50 -0
- package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
- package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
- package/target/main/ts/report/html/app/viewer-columns.js +97 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
- package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-commits.js +81 -0
- package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
- package/target/main/ts/report/html/app/viewer-controls.js +141 -0
- package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-copy.js +64 -0
- package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-data.js +78 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
- package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-dom.js +99 -0
- package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
- package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
- package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
- package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-files.js +40 -0
- package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
- package/target/main/ts/report/html/app/viewer-filter.js +161 -0
- package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
- package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
- package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
- package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
- package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-issues.js +173 -0
- package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
- package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
- package/target/main/ts/report/html/app/viewer-languages.js +97 -0
- package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
- package/target/main/ts/report/html/app/viewer-layout.js +134 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
- package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
- package/target/main/ts/report/html/app/viewer-locations.js +31 -0
- package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
- package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
- package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
- package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
- package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
- package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
- package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
- package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
- package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
- package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-profile.js +180 -0
- package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer-projects.js +90 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
- package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
- package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
- package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
- package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
- package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
- package/target/main/ts/report/html/app/viewer-route.js +55 -0
- package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-shell.js +113 -0
- package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
- package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
- package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-source.js +57 -0
- package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
- package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
- package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
- package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
- package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
- package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
- package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-totals.js +100 -0
- package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
- package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
- package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
- package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
- package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
- package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
- package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trends.js +89 -0
- package/target/main/ts/report/html/app/viewer.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer.js +222 -0
- package/target/main/ts/report/html/site/badges.d.ts +11 -0
- package/target/main/ts/report/html/site/badges.js +72 -0
- package/target/main/ts/report/html/site/export-site.d.ts +16 -0
- package/target/main/ts/report/html/site/export-site.js +129 -0
- package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
- package/target/main/ts/report/html/site/exported-server.js +72 -0
- package/target/main/ts/report/html/site/local-server.d.ts +7 -0
- package/target/main/ts/report/html/site/local-server.js +59 -0
- package/target/main/ts/report/html/site/projects.d.ts +1 -0
- package/target/main/ts/report/html/site/projects.js +69 -0
- package/target/main/ts/report/html/site/server.d.ts +4 -0
- package/target/main/ts/report/html/site/server.js +65 -0
- package/target/main/ts/report/html/site/source-route.d.ts +6 -0
- package/target/main/ts/report/html/site/source-route.js +23 -0
- package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
- package/target/main/ts/report/json/projections/commit-summary.js +126 -0
- package/target/main/ts/report/json/projections/components.d.ts +4 -0
- package/target/main/ts/report/json/projections/components.js +30 -0
- package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
- package/target/main/ts/report/json/projections/file-metrics.js +260 -0
- package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
- package/target/main/ts/report/json/projections/ignore-view.js +13 -0
- package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
- package/target/main/ts/report/json/projections/inspection-context.js +104 -0
- package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
- package/target/main/ts/report/json/projections/inspection-details.js +98 -0
- package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
- package/target/main/ts/report/json/projections/metric-values.js +104 -0
- package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
- package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
- package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
- package/target/main/ts/report/json/projections/security-summary.js +22 -0
- package/target/main/ts/report/json/store/directory.d.ts +3 -0
- package/target/main/ts/report/json/store/directory.js +19 -0
- package/target/main/ts/report/json/store/local-store.d.ts +25 -0
- package/target/main/ts/report/json/store/local-store.js +214 -0
- package/target/main/ts/report/json/store/object-store.d.ts +14 -0
- package/target/main/ts/report/json/store/object-store.js +73 -0
- package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
- package/target/main/ts/report/json/store/operation-cache.js +32 -0
- package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
- package/target/main/ts/report/json/store/pull-review-store.js +33 -0
- package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
- package/target/main/ts/report/json/store/replace-file.js +35 -0
- package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
- package/target/main/ts/report/json/store/report-tree.js +295 -0
- package/target/main/ts/report/json/store/store-check.d.ts +32 -0
- package/target/main/ts/report/json/store/store-check.js +153 -0
- package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
- package/target/main/ts/report/json/validation/metabranch.js +11 -0
- package/target/main/ts/report/json/validation/report.d.ts +20 -0
- package/target/main/ts/report/json/validation/report.js +82 -0
- package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
- package/target/main/ts/report/json/validation/summary-validation.js +30 -0
- package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
- package/target/main/ts/report/json/wire/compact-json.js +76 -0
- package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
- package/target/main/ts/report/json/wire/component-model.js +1 -0
- package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
- package/target/main/ts/report/json/wire/domain-types.js +1 -0
- package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
- package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
- package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
- package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
- package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
- package/target/main/ts/report/json/wire/project-model.js +1 -0
- package/target/main/ts/report/json/wire/public-history-model.d.ts +37 -0
- package/target/main/ts/report/json/wire/public-history-model.js +5 -0
- package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
- package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
- package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
- package/target/main/ts/report/json/wire/summary-model.js +1 -0
- package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
- package/target/main/ts/report/markdown/pull-review.js +132 -0
- package/target/main/ts/report.d.ts +23 -0
- package/target/main/ts/report.js +12 -0
- package/target/main/ts/runtime.d.ts +17 -0
- package/target/main/ts/runtime.js +30 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
+
import { isRecord } from '@repometry/core/internal/engine/plugin.js';
|
|
3
|
+
import { findingImportMethods } from '@repometry/core/internal/model/scanner-import.js';
|
|
4
|
+
import { nativeScanners, securityCounts } from './security-summary.js';
|
|
5
|
+
import { ignoreView } from './ignore-view.js';
|
|
6
|
+
import { normalizeFindingIgnore } from '@repometry/core/internal/model/finding-ignore.js';
|
|
7
|
+
import { comparePaths, digest } from '@repometry/core/internal/model/snapshot.js';
|
|
8
|
+
import { ordered, presentLanguages, presentSelectors, stringList } from './profile-selectors.js';
|
|
9
|
+
export function inspectionProfileDigest(report) {
|
|
10
|
+
const profile = readProfile(report);
|
|
11
|
+
return profile ? digest(JSON.stringify(profile.settings, (_key, value) => isRecord(value)
|
|
12
|
+
? Object.fromEntries(Object.entries(value).sort(([a], [b]) => comparePaths(a, b))) : value)) : undefined;
|
|
13
|
+
}
|
|
14
|
+
export function inspectionContext(report) {
|
|
15
|
+
if (report.subject.kind !== 'commit')
|
|
16
|
+
return undefined;
|
|
17
|
+
return { exclusions: readProfile(report)?.exclusions ?? null, boundary: null,
|
|
18
|
+
...scannerContext(report), ...ignoreContext(report) };
|
|
19
|
+
}
|
|
20
|
+
function ignoreContext(report) {
|
|
21
|
+
if (report.appliedConfig.findingIgnore === undefined)
|
|
22
|
+
return {};
|
|
23
|
+
try {
|
|
24
|
+
const rules = ignoreView(normalizeFindingIgnore(report.appliedConfig.findingIgnore));
|
|
25
|
+
return { ignores: { rules, count: report.ignoredFindings?.length ?? 0 } };
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function scannerContext(report) {
|
|
32
|
+
const methods = findingImportMethods(report.appliedConfig.findingImports);
|
|
33
|
+
const sources = [...methods.flatMap(({ tools }) => tools), ...nativeScanners(report)];
|
|
34
|
+
if (!methods.length && !sources.length)
|
|
35
|
+
return {};
|
|
36
|
+
const scanners = [...new Map(sources.map(tool => [JSON.stringify(tool), tool])).values()];
|
|
37
|
+
const security = securityCounts(report);
|
|
38
|
+
return security ? { scanners, security } : { scanners };
|
|
39
|
+
}
|
|
40
|
+
function readProfile({ appliedConfig: config, pluginData }) {
|
|
41
|
+
const source = config.source;
|
|
42
|
+
if (!isRecord(source))
|
|
43
|
+
return null;
|
|
44
|
+
// The original JS/TS profile recorded directory exclusions before path rules existed.
|
|
45
|
+
const recordedPaths = config.profile === 'js-ts/v1' && source.excludedPaths === undefined ? [] : source.excludedPaths;
|
|
46
|
+
const paths = stringList(recordedPaths);
|
|
47
|
+
const directories = stringList(source.excludedDirectories);
|
|
48
|
+
if (!paths || !directories)
|
|
49
|
+
return null;
|
|
50
|
+
const extensions = stringList(source.extensions);
|
|
51
|
+
let coverage = config.coverage;
|
|
52
|
+
if (isRecord(coverage)) {
|
|
53
|
+
const { inputDigest, inputDigests, pathBase, ...settings } = coverage;
|
|
54
|
+
coverage = settings;
|
|
55
|
+
}
|
|
56
|
+
const { churnWindow, securityScanners, ...settings } = config;
|
|
57
|
+
const toolchain = historicalPluginTools(settings.plugins);
|
|
58
|
+
const present = config.profile === 'repository/v4' ? presentLanguages(pluginData?.inventory) : undefined;
|
|
59
|
+
const plugins = Array.isArray(toolchain) ? toolchain.map(plugin => {
|
|
60
|
+
if (!isRecord(plugin))
|
|
61
|
+
return plugin;
|
|
62
|
+
const { providesLanguages, ...entry } = plugin;
|
|
63
|
+
if (present && typeof entry.id === 'string' && Array.isArray(providesLanguages)
|
|
64
|
+
&& Array.isArray(entry.kinds) && entry.kinds.every(kind => kind === 'language')) {
|
|
65
|
+
delete entry.claims;
|
|
66
|
+
entry.providesLanguages = ordered([...present.get(entry.id) ?? []]);
|
|
67
|
+
}
|
|
68
|
+
if (entry.id === legacySyntaxPlugin && isDeepStrictEqual(entry.settings, config.parser))
|
|
69
|
+
delete entry.settings;
|
|
70
|
+
return entry;
|
|
71
|
+
}) : toolchain;
|
|
72
|
+
// The policy is stable across commits; its matched paths describe this snapshot alone.
|
|
73
|
+
const { generatedExcluded, ...sourceSettings } = source;
|
|
74
|
+
const selectors = present ? presentSelectors(toolchain, present)
|
|
75
|
+
: { extensions: extensions ? ordered(extensions) : source.extensions };
|
|
76
|
+
return {
|
|
77
|
+
exclusions: { paths: [...new Set([...(stringList(source.defaultExclusions) ?? []), ...paths, ...(stringList(generatedExcluded) ?? [])])], directories },
|
|
78
|
+
settings: { ...settings, ...(plugins === undefined ? {} : { plugins }), coverage,
|
|
79
|
+
findingImports: findingImportMethods(config.findingImports), source: { ...sourceSettings,
|
|
80
|
+
...selectors,
|
|
81
|
+
excludedPaths: ordered(paths), excludedDirectories: ordered(directories),
|
|
82
|
+
} },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export const legacySyntaxPlugin = 'babel-syntax';
|
|
86
|
+
// Keep history comparable when the parser starts recording its own tool versions.
|
|
87
|
+
function historicalPluginTools(plugins) {
|
|
88
|
+
if (!Array.isArray(plugins))
|
|
89
|
+
return plugins;
|
|
90
|
+
const syntax = plugins.find(entry => isRecord(entry) && entry.id === legacySyntaxPlugin);
|
|
91
|
+
if (!isRecord(syntax?.tools))
|
|
92
|
+
return plugins;
|
|
93
|
+
const { '@babel/types': types, ...native } = syntax.tools;
|
|
94
|
+
if (typeof types !== 'string')
|
|
95
|
+
return plugins;
|
|
96
|
+
return plugins.map(entry => {
|
|
97
|
+
if (entry === syntax)
|
|
98
|
+
return { ...syntax, tools: native };
|
|
99
|
+
if (!isRecord(entry) || (entry.id !== 'structure' && entry.id !== 'maintainability') || !isRecord(entry.tools))
|
|
100
|
+
return entry;
|
|
101
|
+
return { ...entry, tools: { '@babel/types': types, ...entry.tools } };
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=inspection-context.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Report } from '../validation/report.js';
|
|
2
|
+
import type { LanguageLookup } from '@repometry/core/internal/model/language.js';
|
|
3
|
+
import type { ComplexFunction } from '../wire/public-history-model.js';
|
|
4
|
+
import type { Component } from './components.js';
|
|
5
|
+
import type { InspectionAsset, InspectionDetails, ProfileSettings } from '../wire/inspection-details-model.js';
|
|
6
|
+
export interface InspectionOptions {
|
|
7
|
+
readonly components?: readonly Component[];
|
|
8
|
+
readonly languages?: LanguageLookup;
|
|
9
|
+
}
|
|
10
|
+
export declare function inspectionAsset(report: Report, options?: InspectionOptions): InspectionAsset;
|
|
11
|
+
export declare function inspectionDetails(report: Report, { components, languages }?: InspectionOptions): InspectionDetails;
|
|
12
|
+
/** The applied configuration, field by field; whatever is missing or malformed is left out rather than guessed. */
|
|
13
|
+
export declare function profileSettings(applied: unknown): ProfileSettings | undefined;
|
|
14
|
+
export declare function complexFunctions(report: Report): readonly ComplexFunction[];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ignoreView } from './ignore-view.js';
|
|
2
|
+
import { javascriptType, typescriptType } from '@repometry/core/internal/model/file-types.js';
|
|
3
|
+
import { isRecord } from '@repometry/core/internal/model/plugin-data.js';
|
|
4
|
+
import { legacySyntaxPlugin } from './inspection-context.js';
|
|
5
|
+
import { canonicalMetricId, definitions } from '@repometry/core/internal/model/measurement.js';
|
|
6
|
+
import { lcovLines } from '@repometry/core/internal/model/line-coverage.js';
|
|
7
|
+
import { comparePaths } from '@repometry/core/internal/model/snapshot.js';
|
|
8
|
+
import { fileMetrics } from './file-metrics.js';
|
|
9
|
+
import { inspectionContext } from './inspection-context.js';
|
|
10
|
+
import { isLanguageDisplay } from '@repometry/core/internal/model/language.js';
|
|
11
|
+
import { componentFiles } from './components.js';
|
|
12
|
+
export function inspectionAsset(report, options) {
|
|
13
|
+
return { schema: 'urn:repometry:schema:viewer-inspection:1', sha: report.subject.id,
|
|
14
|
+
context: inspectionContext(report), inspection: inspectionDetails(report, options) };
|
|
15
|
+
}
|
|
16
|
+
export function inspectionDetails(report, { components = [], languages } = {}) {
|
|
17
|
+
const files = fileMetrics(report, languages);
|
|
18
|
+
const display = files.languages?.map(item => {
|
|
19
|
+
const syntax = languages?.syntax?.(item.id);
|
|
20
|
+
return syntax === undefined ? item : { ...item, syntax };
|
|
21
|
+
});
|
|
22
|
+
const metrics = display === undefined ? files : { ...files, languages: display };
|
|
23
|
+
const lineCoverage = report.pluginData?.products[lcovLines.id]?.[0]?.value;
|
|
24
|
+
const profile = profileSettings(report.appliedConfig);
|
|
25
|
+
const ruleCatalog = report.pluginData?.rules.flatMap(({ plugin, rules }) => rules.map(rule => ({
|
|
26
|
+
source: plugin, kind: 'check', rule: rule.id, category: rule.category,
|
|
27
|
+
...(rule.description === undefined ? {} : { title: rule.description }),
|
|
28
|
+
...(rule.defaults?.limit === undefined ? {} : { limit: rule.defaults.limit }),
|
|
29
|
+
...(rule.defaults?.cost === undefined ? {} : { minutesPerExcess: rule.defaults.cost }),
|
|
30
|
+
})));
|
|
31
|
+
return { metrics, functions: complexFunctions(report), diagnostics: report.diagnostics, findings: report.findings,
|
|
32
|
+
components: components.length ? componentFiles(components, metrics) : undefined,
|
|
33
|
+
...(lcovLines.accepts(lineCoverage) ? { lineCoverage } : {}),
|
|
34
|
+
...(profile ? { profile: { ...profile, ...(ruleCatalog?.length ? { ruleCatalog } : {}) } } : {}) };
|
|
35
|
+
}
|
|
36
|
+
/** The applied configuration, field by field; whatever is missing or malformed is left out rather than guessed. */
|
|
37
|
+
export function profileSettings(applied) {
|
|
38
|
+
if (!isRecord(applied))
|
|
39
|
+
return undefined;
|
|
40
|
+
const source = isRecord(applied.source) ? applied.source : {};
|
|
41
|
+
const maintainability = isRecord(applied.maintainability) ? applied.maintainability : {};
|
|
42
|
+
const rules = isRecord(maintainability.structuralRules) ? Object.entries(maintainability.structuralRules).flatMap(([rule, value]) => isRecord(value) && finite(value.limit) && finite(value.minutesPerExcess)
|
|
43
|
+
? [{ plugin: 'maintainability', rule, limit: value.limit, minutesPerExcess: value.minutesPerExcess }] : []) : [];
|
|
44
|
+
const duplication = maintainability.duplication;
|
|
45
|
+
const model = maintainability.debtModel;
|
|
46
|
+
const churn = applied.churn;
|
|
47
|
+
const plugins = Array.isArray(applied.plugins) ? applied.plugins.filter(isRecord) : [];
|
|
48
|
+
const languages = profileLanguages(plugins, new Set(strings(source.extensions)));
|
|
49
|
+
return {
|
|
50
|
+
id: typeof applied.profile === 'string' ? applied.profile : null,
|
|
51
|
+
...(languages.length ? { languages } : {}),
|
|
52
|
+
excludedPaths: [...new Set([...strings(source.defaultExclusions), ...strings(source.excludedPaths), ...strings(source.generatedExcluded)])],
|
|
53
|
+
excludedDirectories: strings(source.excludedDirectories),
|
|
54
|
+
rules,
|
|
55
|
+
duplication: isRecord(duplication) && finite(duplication.minCodeLines) && finite(duplication.minNodes) && finite(duplication.minutesPerRepeatedLine)
|
|
56
|
+
? { minCodeLines: duplication.minCodeLines, minNodes: duplication.minNodes, minutesPerRepeatedLine: duplication.minutesPerRepeatedLine } : null,
|
|
57
|
+
debtModel: isRecord(model) && typeof model.name === 'string' && finite(model.scale) && finite(model.exponent) && finite(model.minutesPerPersonMonth)
|
|
58
|
+
? { name: model.name, scale: model.scale, exponent: model.exponent, minutesPerPersonMonth: model.minutesPerPersonMonth } : null,
|
|
59
|
+
churn: isRecord(churn) && finite(churn.lookbackDays) && finite(churn.maxCommits) ? { lookbackDays: churn.lookbackDays, maxCommits: churn.maxCommits } : null,
|
|
60
|
+
ignore: ignoreView(applied.findingIgnore),
|
|
61
|
+
analyzers: plugins.flatMap(({ id, version, tools }) => typeof id === 'string' && typeof version === 'string'
|
|
62
|
+
? [{ id, version, tools: isRecord(tools)
|
|
63
|
+
? Object.fromEntries(Object.entries(tools).filter((entry) => typeof entry[1] === 'string')) : {} }] : []),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function profileLanguages(plugins, recordedExtensions) {
|
|
67
|
+
const recorded = plugins.flatMap(({ id: plugin, providesLanguages, unavailableReason }) => {
|
|
68
|
+
if (typeof plugin !== 'string' || !Array.isArray(providesLanguages))
|
|
69
|
+
return [];
|
|
70
|
+
return providesLanguages.flatMap(language => isRecord(language) && isLanguageDisplay(language)
|
|
71
|
+
? [{ plugin, id: language.id, label: language.label, extensions: strings(language.extensions), globs: strings(language.globs),
|
|
72
|
+
...(typeof unavailableReason === 'string' ? { unavailableReason } : {}) }]
|
|
73
|
+
: []);
|
|
74
|
+
});
|
|
75
|
+
if (recorded.length)
|
|
76
|
+
return recorded;
|
|
77
|
+
return [javascriptType, typescriptType].flatMap(({ id, label, extensions }) => {
|
|
78
|
+
const selected = extensions.filter(ext => recordedExtensions.has(ext));
|
|
79
|
+
return selected.length ? [{ plugin: legacySyntaxPlugin, id, label, extensions: selected, globs: [] }] : [];
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function finite(value) {
|
|
83
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
84
|
+
}
|
|
85
|
+
function strings(value) {
|
|
86
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === 'string') : [];
|
|
87
|
+
}
|
|
88
|
+
export function complexFunctions(report) {
|
|
89
|
+
const functions = [];
|
|
90
|
+
for (const row of report.measurements) {
|
|
91
|
+
if (canonicalMetricId(row.definition) === definitions.complexity && row.target === 'function' && row.path !== undefined && row.value !== null) {
|
|
92
|
+
functions.push({ name: row.name ?? '(anonymous)', path: row.path, line: row.line ?? null, complexity: row.value });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return functions.sort((left, right) => right.complexity - left.complexity
|
|
96
|
+
|| comparePaths(left.path, right.path) || (left.line ?? 0) - (right.line ?? 0));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=inspection-details.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MetricDescriptor, MetricValues } from '../wire/summary-model.js';
|
|
2
|
+
import type { StructureMeasure } from '@repometry/core/internal/model/code-structure.js';
|
|
3
|
+
import type { Report } from '@repometry/core/internal/model/report.js';
|
|
4
|
+
export declare function metricProjection(report: Report): {
|
|
5
|
+
catalog: MetricDescriptor[];
|
|
6
|
+
privateMetrics: string[] | undefined;
|
|
7
|
+
values: (path?: string, directory?: boolean) => MetricValues;
|
|
8
|
+
isAvailable: (id: string, path?: string, directory?: boolean) => boolean;
|
|
9
|
+
} | undefined;
|
|
10
|
+
export declare function unavailableStructureMetrics({ analysed, unmeasured }: {
|
|
11
|
+
readonly analysed: boolean;
|
|
12
|
+
readonly unmeasured?: readonly StructureMeasure[];
|
|
13
|
+
}): string[];
|
|
14
|
+
export declare function canonicalMetricDescriptor(metric: MetricDescriptor): MetricDescriptor;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { canonicalMetricId, definitions } from '@repometry/core/internal/model/measurement.js';
|
|
2
|
+
const structureMetricIds = {
|
|
3
|
+
functions: definitions.functions, cyclomaticComplexity: definitions.complexity,
|
|
4
|
+
cognitiveComplexity: definitions.cognitiveComplexity, classes: definitions.classes,
|
|
5
|
+
commentLines: definitions.comments, codeLines: definitions.codeLines, duplication: definitions.duplicatedLines,
|
|
6
|
+
};
|
|
7
|
+
export function metricProjection(report) {
|
|
8
|
+
const metadata = report.pluginData;
|
|
9
|
+
if (!metadata?.metrics.length)
|
|
10
|
+
return undefined;
|
|
11
|
+
const measured = new Set(metadata.measured.map(canonicalMetricId));
|
|
12
|
+
const metrics = metadata.metrics.map(canonicalMetricDescriptor).filter(metric => measured.has(metric.id));
|
|
13
|
+
if (metrics.length === 0)
|
|
14
|
+
return undefined;
|
|
15
|
+
const rows = new Map();
|
|
16
|
+
for (const row of report.measurements) {
|
|
17
|
+
const id = canonicalMetricId(row.definition);
|
|
18
|
+
const existing = rows.get(id);
|
|
19
|
+
if (existing)
|
|
20
|
+
existing.push(row);
|
|
21
|
+
else
|
|
22
|
+
rows.set(id, [row]);
|
|
23
|
+
}
|
|
24
|
+
const unavailable = new Map();
|
|
25
|
+
for (const file of metadata.inventory ?? []) {
|
|
26
|
+
for (const id of unavailableStructureMetrics(file)) {
|
|
27
|
+
let files = unavailable.get(id);
|
|
28
|
+
if (!files)
|
|
29
|
+
unavailable.set(id, files = new Set());
|
|
30
|
+
files.add(file.path);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function isAvailable(id, path, directory = false) {
|
|
34
|
+
const files = unavailable.get(id);
|
|
35
|
+
if (!files)
|
|
36
|
+
return true;
|
|
37
|
+
if (path === undefined || (directory && path === ''))
|
|
38
|
+
return false;
|
|
39
|
+
if (!directory)
|
|
40
|
+
return !files.has(path);
|
|
41
|
+
for (const file of files)
|
|
42
|
+
if (file.startsWith(path + '/'))
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
function values(path, directory = false) {
|
|
47
|
+
const result = {};
|
|
48
|
+
for (const [index, metric] of metrics.entries()) {
|
|
49
|
+
if (path !== undefined && metric.scope === 'repository')
|
|
50
|
+
continue;
|
|
51
|
+
const rowValues = (id) => rows.get(id) ?? [];
|
|
52
|
+
let value;
|
|
53
|
+
if (!isAvailable(metric.id, path, directory)) {
|
|
54
|
+
value = null;
|
|
55
|
+
}
|
|
56
|
+
else if (metric.ratio) {
|
|
57
|
+
const numerator = rollup(rowValues(metric.ratio.of), 'sum', path, directory);
|
|
58
|
+
const denominator = rollup(rowValues(metric.ratio.over), 'sum', path, directory);
|
|
59
|
+
value = denominator && numerator !== null ? numerator / denominator : null;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
value = rollup(rowValues(metric.id), metric.aggregate, path, directory);
|
|
63
|
+
}
|
|
64
|
+
if (path === undefined || value !== 0)
|
|
65
|
+
result[index] = value;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
const privateMetrics = metadata.privateMetrics?.map(canonicalMetricId).filter(id => measured.has(id));
|
|
70
|
+
return { catalog: metrics, privateMetrics: privateMetrics?.length ? privateMetrics : undefined, values, isAvailable };
|
|
71
|
+
}
|
|
72
|
+
export function unavailableStructureMetrics({ analysed, unmeasured = [] }) {
|
|
73
|
+
const metrics = unmeasured.flatMap(measure => structureMetricIds[measure] ?? []);
|
|
74
|
+
if (!analysed && unmeasured.length)
|
|
75
|
+
metrics.push(definitions.lines);
|
|
76
|
+
return metrics;
|
|
77
|
+
}
|
|
78
|
+
export function canonicalMetricDescriptor(metric) {
|
|
79
|
+
const id = canonicalMetricId(metric.id);
|
|
80
|
+
if (!metric.ratio)
|
|
81
|
+
return metric.id === id ? metric : { ...metric, id };
|
|
82
|
+
const { of, over } = metric.ratio;
|
|
83
|
+
const ratio = { of: canonicalMetricId(of), over: canonicalMetricId(over) };
|
|
84
|
+
return metric.id === id && ratio.of === of && ratio.over === over ? metric : { ...metric, id, ratio };
|
|
85
|
+
}
|
|
86
|
+
function rollup(rows, aggregate, path, directory) {
|
|
87
|
+
if (path === undefined) {
|
|
88
|
+
const explicit = rows.find(row => row.target === 'repository');
|
|
89
|
+
if (explicit)
|
|
90
|
+
return explicit.value;
|
|
91
|
+
}
|
|
92
|
+
const candidates = rows.filter(row => row.path !== undefined && (path === undefined || (directory
|
|
93
|
+
? path === '' || row.path.startsWith(path + '/') : row.path === path)));
|
|
94
|
+
// A file-level measurement already represents the function rows for that file.
|
|
95
|
+
const fileTotals = new Set(candidates.filter(row => row.target === 'file').map(row => row.path));
|
|
96
|
+
const selected = candidates.filter(row => row.target === 'file' || !fileTotals.has(row.path));
|
|
97
|
+
if (aggregate === 'none')
|
|
98
|
+
return path !== undefined && !directory && selected.length === 1 ? selected[0].value : null;
|
|
99
|
+
const values = selected.flatMap(row => row.value === null ? [] : [row.value]);
|
|
100
|
+
if (values.length === 0)
|
|
101
|
+
return selected.length === 0 && aggregate === 'sum' ? 0 : null;
|
|
102
|
+
return aggregate === 'sum' ? values.reduce((sum, value) => sum + value, 0) : values.reduce((max, value) => Math.max(max, value));
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=metric-values.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Report } from '../validation/report.js';
|
|
2
|
+
export declare function presentLanguages(inventory: NonNullable<Report['pluginData']>['inventory']): Map<string, Set<string>>;
|
|
3
|
+
export declare function presentSelectors(plugins: unknown, present: ReadonlyMap<string, ReadonlySet<string>>): {
|
|
4
|
+
extensions: readonly string[];
|
|
5
|
+
globs: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function stringList(value: unknown): readonly string[] | null;
|
|
8
|
+
export declare function ordered(values: readonly string[]): readonly string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isRecord } from '@repometry/core/internal/engine/plugin.js';
|
|
2
|
+
import { comparePaths } from '@repometry/core/internal/model/snapshot.js';
|
|
3
|
+
export function presentLanguages(inventory) {
|
|
4
|
+
const present = new Map();
|
|
5
|
+
for (const { provider, language } of inventory ?? []) {
|
|
6
|
+
if (!provider)
|
|
7
|
+
continue;
|
|
8
|
+
const id = provider.slice(0, provider.lastIndexOf('/'));
|
|
9
|
+
const languages = present.get(id) ?? new Set();
|
|
10
|
+
languages.add(language);
|
|
11
|
+
present.set(id, languages);
|
|
12
|
+
}
|
|
13
|
+
return present;
|
|
14
|
+
}
|
|
15
|
+
export function presentSelectors(plugins, present) {
|
|
16
|
+
const entries = Array.isArray(plugins) ? plugins : [];
|
|
17
|
+
const declarations = entries.filter(isRecord).flatMap(({ id, providesLanguages, claims }) => {
|
|
18
|
+
const languages = typeof id === 'string' ? present.get(id) : undefined;
|
|
19
|
+
if (!languages)
|
|
20
|
+
return [];
|
|
21
|
+
if (!Array.isArray(providesLanguages))
|
|
22
|
+
return isRecord(claims) ? [claims] : [];
|
|
23
|
+
return providesLanguages.filter(isRecord).filter(({ id }) => typeof id === 'string' && languages.has(id));
|
|
24
|
+
});
|
|
25
|
+
const values = (key) => ordered(declarations.flatMap(item => stringList(item[key]) ?? []));
|
|
26
|
+
return { extensions: values('extensions'), globs: values('globs') };
|
|
27
|
+
}
|
|
28
|
+
export function stringList(value) {
|
|
29
|
+
return Array.isArray(value) && value.every((item) => typeof item === 'string') ? value : null;
|
|
30
|
+
}
|
|
31
|
+
export function ordered(values) {
|
|
32
|
+
return [...new Set(values)].sort(comparePaths);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=profile-selectors.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Report } from '@repometry/core/internal/model/report.js';
|
|
2
|
+
export declare function nativeScanners(report: Report): readonly {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare function securityCounts(report: Report): {
|
|
7
|
+
low: number;
|
|
8
|
+
medium: number;
|
|
9
|
+
high: number;
|
|
10
|
+
unknown: number;
|
|
11
|
+
} | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isRecord } from '@repometry/core/internal/engine/plugin.js';
|
|
2
|
+
import { isSensitiveFinding } from '@repometry/core/internal/model/finding.js';
|
|
3
|
+
import { findingImportMethods } from '@repometry/core/internal/model/scanner-import.js';
|
|
4
|
+
export function nativeScanners(report) {
|
|
5
|
+
const scanners = report.appliedConfig.securityScanners;
|
|
6
|
+
if (!Array.isArray(scanners))
|
|
7
|
+
return [];
|
|
8
|
+
return scanners.flatMap((scanner) => isRecord(scanner) && typeof scanner.name === 'string' && typeof scanner.version === 'string'
|
|
9
|
+
? [{ name: scanner.name, version: scanner.version }] : []);
|
|
10
|
+
}
|
|
11
|
+
export function securityCounts(report) {
|
|
12
|
+
const imported = findingImportMethods(report.appliedConfig.findingImports).some(({ category }) => isSensitiveFinding(category));
|
|
13
|
+
if (!imported && !nativeScanners(report).length)
|
|
14
|
+
return undefined;
|
|
15
|
+
const counts = { low: 0, medium: 0, high: 0, unknown: 0 };
|
|
16
|
+
for (const finding of report.findings ?? []) {
|
|
17
|
+
if (isSensitiveFinding(finding.category))
|
|
18
|
+
counts[finding.level]++;
|
|
19
|
+
}
|
|
20
|
+
return counts;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=security-summary.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { lstat, mkdir } from 'node:fs/promises';
|
|
2
|
+
export function hasCode(error, code) {
|
|
3
|
+
return error instanceof Error && 'code' in error && error.code === code;
|
|
4
|
+
}
|
|
5
|
+
export async function ensureDirectory(path) {
|
|
6
|
+
try {
|
|
7
|
+
await mkdir(path, { mode: 0o700 });
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
if (!hasCode(error, 'EEXIST'))
|
|
11
|
+
throw error;
|
|
12
|
+
}
|
|
13
|
+
await checkDirectory(path);
|
|
14
|
+
}
|
|
15
|
+
export async function checkDirectory(path) {
|
|
16
|
+
if (!(await lstat(path)).isDirectory())
|
|
17
|
+
throw new Error(`Expected a directory: ${path}`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=directory.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Subject } from '@repometry/core/internal/model/snapshot.js';
|
|
2
|
+
import type { CommitSummary } from '../wire/summary-model.js';
|
|
3
|
+
import type { Report, ReportStore } from '../validation/report.js';
|
|
4
|
+
import { LocalObjectStore } from './object-store.js';
|
|
5
|
+
export declare class LocalReportStore implements ReportStore {
|
|
6
|
+
private readonly directory;
|
|
7
|
+
readonly objects: LocalObjectStore;
|
|
8
|
+
private readonly cache;
|
|
9
|
+
constructor(directory: string);
|
|
10
|
+
save(report: Report, { deferSummary }?: {
|
|
11
|
+
deferSummary?: boolean | undefined;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
read(subject: Subject): Promise<Report>;
|
|
14
|
+
list(): Promise<readonly Report[]>;
|
|
15
|
+
/** Saved subjects by folder name, whether or not their report is published yet. */
|
|
16
|
+
subjects(): Promise<readonly Subject[]>;
|
|
17
|
+
/** The saved report file of a subject. */
|
|
18
|
+
text(subject: Subject): Promise<string>;
|
|
19
|
+
listSummaries(): Promise<readonly CommitSummary[]>;
|
|
20
|
+
refreshSummary(): Promise<void>;
|
|
21
|
+
private readWith;
|
|
22
|
+
private folder;
|
|
23
|
+
}
|
|
24
|
+
/** The summary row a saved report keeps on its first line, unless it has none or it needs recalculating. */
|
|
25
|
+
export declare function headerSummary(text: string, sha: string): CommitSummary | undefined;
|