@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,180 @@
|
|
|
1
|
+
import { count, element } from './viewer-dom.js';
|
|
2
|
+
import { splitter } from './viewer-layout.js';
|
|
3
|
+
import { duration } from './viewer-metrics.js';
|
|
4
|
+
import { badges } from './viewer-profile-badges.js';
|
|
5
|
+
import { pagedTable } from './viewer-profile-table.js';
|
|
6
|
+
/** What each structural rule measures, and in what unit its limit and its cost are counted. */
|
|
7
|
+
const ruleNames = {
|
|
8
|
+
'function-complexity': ['Cognitive complexity of a function', 'point'],
|
|
9
|
+
'file-complexity': ['Cognitive complexity of a file', 'point'],
|
|
10
|
+
'function-parameters': ['Parameters of a function', 'parameter'],
|
|
11
|
+
'return-statements': ['Return statements in a function', 'return'],
|
|
12
|
+
'boolean-logic': ['Operators in one condition', 'operator'],
|
|
13
|
+
'nested-control-flow': ['Depth of nested control flow', 'level'],
|
|
14
|
+
};
|
|
15
|
+
const ruleOrder = Object.keys(ruleNames);
|
|
16
|
+
export function renderProfile(container, data) {
|
|
17
|
+
const view = element('div', 'fx-view');
|
|
18
|
+
const split = element('div', 'fx-split profile');
|
|
19
|
+
const main = element('div', 'fx-main profile-main');
|
|
20
|
+
const profile = data.details?.profile;
|
|
21
|
+
if (profile)
|
|
22
|
+
main.append(identity(profile), files(profile), rules(profile), exclusions(profile, data.context));
|
|
23
|
+
else
|
|
24
|
+
main.append(fallback(data));
|
|
25
|
+
const scanners = data.context?.scanners;
|
|
26
|
+
if (scanners?.length) {
|
|
27
|
+
const section = block('Imported scanners');
|
|
28
|
+
section.append(chips(scanners.map(({ name, version }) => version ? `${name} ${version}` : name)));
|
|
29
|
+
main.append(section);
|
|
30
|
+
}
|
|
31
|
+
split.append(main, splitter(split), badges(data.latest, data.details));
|
|
32
|
+
view.append(split);
|
|
33
|
+
container.replaceChildren(view);
|
|
34
|
+
}
|
|
35
|
+
/** The profile's name and the analyzers it ran, with their versions. */
|
|
36
|
+
function identity(profile) {
|
|
37
|
+
const section = block('Analyzers');
|
|
38
|
+
const facts = element('dl', 'profile-facts');
|
|
39
|
+
if (profile.id)
|
|
40
|
+
facts.append(row('Profile', code(profile.id)));
|
|
41
|
+
if (profile.analyzers.length) {
|
|
42
|
+
facts.append(row('Plugins', chips(profile.analyzers.map(analyzer => {
|
|
43
|
+
const tools = Object.entries(analyzer.tools).map(([tool, version]) => `${tool} ${version}`);
|
|
44
|
+
return `${analyzer.id} ${analyzer.version}${tools.length ? ` (${tools.join(', ')})` : ''}`;
|
|
45
|
+
}))));
|
|
46
|
+
}
|
|
47
|
+
if (profile.churn) {
|
|
48
|
+
facts.append(row('Change window', element('span', '', `${count(profile.churn.lookbackDays)} days, at most ${count(profile.churn.maxCommits)} commits`)));
|
|
49
|
+
}
|
|
50
|
+
section.append(facts);
|
|
51
|
+
return section;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The languages the plugins claim, each with the patterns of the files it reads; an older inspection did not record
|
|
55
|
+
* them. A language whose tool could not run says why, e.g. "go not found on PATH": its files were not analysed.
|
|
56
|
+
*/
|
|
57
|
+
function claims(languages) {
|
|
58
|
+
if (!languages)
|
|
59
|
+
return none('Not recorded for this inspection');
|
|
60
|
+
if (!languages.length)
|
|
61
|
+
return none('No language plugin');
|
|
62
|
+
const list = element('ul', 'profile-claims');
|
|
63
|
+
list.append(...languages.map(language => {
|
|
64
|
+
const item = element('li');
|
|
65
|
+
const patterns = element('div', 'profile-claim-patterns');
|
|
66
|
+
patterns.append(chips([...language.extensions.map(extension => `**/*${extension}`), ...language.globs]));
|
|
67
|
+
if (language.unavailableReason)
|
|
68
|
+
patterns.append(none(`Not analysed: ${language.unavailableReason}`));
|
|
69
|
+
item.append(element('span', 'profile-claim', language.label), patterns);
|
|
70
|
+
return item;
|
|
71
|
+
}));
|
|
72
|
+
return list;
|
|
73
|
+
}
|
|
74
|
+
/** What the inspection reads and what it leaves out, as the patterns the profile states. */
|
|
75
|
+
function files(profile) {
|
|
76
|
+
const section = block('Files');
|
|
77
|
+
const facts = element('dl', 'profile-facts');
|
|
78
|
+
facts.append(row('Included', claims(profile.languages)));
|
|
79
|
+
facts.append(row('Excluded paths', profile.excludedPaths.length ? chips(profile.excludedPaths) : none()));
|
|
80
|
+
facts.append(row('Excluded directories', profile.excludedDirectories.length
|
|
81
|
+
? chips(profile.excludedDirectories.map(directory => `**/${directory}/`)) : none()));
|
|
82
|
+
section.append(facts);
|
|
83
|
+
return section;
|
|
84
|
+
}
|
|
85
|
+
/** Every check the profile applies, from every plugin: what it measures, where its limit lies, what each unit past it costs. */
|
|
86
|
+
function rules(profile) {
|
|
87
|
+
const section = block('Rules');
|
|
88
|
+
const rows = profile.rules.map(rule => {
|
|
89
|
+
const [measure, unit] = ruleNames[rule.rule] ?? [null, 'unit'];
|
|
90
|
+
return { plugin: rule.plugin, rule: rule.rule, measure, limit: rule.limit, limitText: count(rule.limit),
|
|
91
|
+
minutes: rule.minutesPerExcess, cost: `${duration(rule.minutesPerExcess)} per ${unit} over` };
|
|
92
|
+
});
|
|
93
|
+
const duplication = profile.duplication;
|
|
94
|
+
if (duplication) {
|
|
95
|
+
rows.push({ plugin: 'duplication', rule: 'identical-code', measure: 'Repeated code', limit: duplication.minCodeLines,
|
|
96
|
+
limitText: `${count(duplication.minCodeLines)} lines, ${count(duplication.minNodes)} nodes`,
|
|
97
|
+
minutes: duplication.minutesPerRepeatedLine, cost: `${duration(duplication.minutesPerRepeatedLine)} per repeated line` });
|
|
98
|
+
}
|
|
99
|
+
rows.sort((a, b) => a.plugin.localeCompare(b.plugin) || order(a.rule) - order(b.rule) || a.rule.localeCompare(b.rule));
|
|
100
|
+
section.append(pagedTable({
|
|
101
|
+
label: 'Rules', noun: ['rule', 'rules'], rows, empty: 'The profile records no rules.', controls: true,
|
|
102
|
+
search: row => `${row.rule} ${row.plugin} ${row.measure ?? ''}`,
|
|
103
|
+
facet: { text: 'Plugin', all: 'All plugins', plural: 'plugins', key: row => row.plugin },
|
|
104
|
+
columns: [
|
|
105
|
+
{ label: 'Rule', cell: row => ruleCell(row.rule, row.measure), sort: row => row.rule },
|
|
106
|
+
{ label: 'Plugin', cell: row => element('span', 'profile-plugin', row.plugin), sort: row => row.plugin },
|
|
107
|
+
{ label: 'Limit', numeric: true, cell: row => row.limitText, sort: row => row.limit },
|
|
108
|
+
{ label: 'Cost', numeric: true, cell: row => row.cost, sort: row => row.minutes },
|
|
109
|
+
],
|
|
110
|
+
}));
|
|
111
|
+
return section;
|
|
112
|
+
}
|
|
113
|
+
function ruleCell(name, measure) {
|
|
114
|
+
const cell = element('span');
|
|
115
|
+
cell.append(element('code', 'profile-rule', name));
|
|
116
|
+
if (measure)
|
|
117
|
+
cell.append(element('span', 'profile-rule-meta', measure));
|
|
118
|
+
return cell;
|
|
119
|
+
}
|
|
120
|
+
/** The findings the profile tells the inspection to skip, by tool, rule and path. */
|
|
121
|
+
function exclusions(profile, context) {
|
|
122
|
+
const section = block('Rule exclusions');
|
|
123
|
+
const skipped = context?.ignores?.count;
|
|
124
|
+
if (profile.ignore.length && skipped !== undefined) {
|
|
125
|
+
section.append(element('p', 'detail', `${count(skipped)} ${skipped === 1 ? 'finding' : 'findings'} skipped at this commit.`));
|
|
126
|
+
}
|
|
127
|
+
section.append(pagedTable({
|
|
128
|
+
label: 'Rule exclusions', noun: ['exclusion', 'exclusions'], rows: profile.ignore,
|
|
129
|
+
empty: 'None. “Ignore rule” on an issue gives the entry to add to the profile’s ignore list.',
|
|
130
|
+
search: row => [row.tool, row.rule, row.path, row.reason].filter(Boolean).join(' '),
|
|
131
|
+
facet: { text: 'Tool', all: 'All tools', plural: 'tools', key: row => row.tool ?? 'Any tool' },
|
|
132
|
+
columns: [
|
|
133
|
+
{ label: 'Rule', cell: row => code([row.tool, row.rule].filter(Boolean).join(' / ') || 'Any rule'), sort: row => `${row.tool ?? ''} ${row.rule ?? ''}` },
|
|
134
|
+
{ label: 'Path', cell: row => row.path ? element('span', 'profile-ignore-path', row.path) : none('Everywhere'), sort: row => row.path ?? '' },
|
|
135
|
+
{ label: 'Reason', cell: row => row.reason ?? '', sort: row => row.reason ?? '' },
|
|
136
|
+
],
|
|
137
|
+
}));
|
|
138
|
+
return section;
|
|
139
|
+
}
|
|
140
|
+
/** Until the details arrive only the exclusions are known; the summary does not carry the profile itself. */
|
|
141
|
+
function fallback(data) {
|
|
142
|
+
const section = block('Files');
|
|
143
|
+
const exclusions = data.context?.exclusions;
|
|
144
|
+
if (exclusions) {
|
|
145
|
+
const facts = element('dl', 'profile-facts');
|
|
146
|
+
facts.append(row('Excluded paths', exclusions.paths.length ? chips(exclusions.paths) : none()));
|
|
147
|
+
facts.append(row('Excluded directories', exclusions.directories.length ? chips(exclusions.directories.map(directory => `**/${directory}/`)) : none()));
|
|
148
|
+
section.append(facts);
|
|
149
|
+
}
|
|
150
|
+
if (data.details)
|
|
151
|
+
section.append(element('p', 'detail', 'This inspection did not record its profile.'));
|
|
152
|
+
return section;
|
|
153
|
+
}
|
|
154
|
+
function order(rule) {
|
|
155
|
+
const index = ruleOrder.indexOf(rule);
|
|
156
|
+
return index < 0 ? ruleOrder.length : index;
|
|
157
|
+
}
|
|
158
|
+
function block(title) {
|
|
159
|
+
const section = element('section', 'profile-block');
|
|
160
|
+
section.append(element('h3', '', title));
|
|
161
|
+
return section;
|
|
162
|
+
}
|
|
163
|
+
function row(label, value) {
|
|
164
|
+
const item = element('div');
|
|
165
|
+
const detail = element('dd');
|
|
166
|
+
detail.append(value);
|
|
167
|
+
item.append(element('dt', '', label), detail);
|
|
168
|
+
return item;
|
|
169
|
+
}
|
|
170
|
+
function chips(values) {
|
|
171
|
+
const list = element('ul', 'profile-chips');
|
|
172
|
+
list.append(...values.map(value => element('li', '', value)));
|
|
173
|
+
return list;
|
|
174
|
+
}
|
|
175
|
+
function none(text = 'None') {
|
|
176
|
+
return element('span', 'detail', text);
|
|
177
|
+
}
|
|
178
|
+
function code(text) {
|
|
179
|
+
return element('code', '', text);
|
|
180
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const totals = new Intl.NumberFormat();
|
|
2
|
+
const percentage = new Intl.NumberFormat(undefined, { style: 'percent', maximumFractionDigits: 1 });
|
|
3
|
+
const date = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium' });
|
|
4
|
+
const search = document.querySelector('#search');
|
|
5
|
+
const sort = document.querySelector('#sort');
|
|
6
|
+
const rows = document.querySelector('#projects');
|
|
7
|
+
const summary = document.querySelector('#project-count');
|
|
8
|
+
const statusLabels = { complete: 'Complete', partial: 'Partial', 'not-applicable': 'Not applicable' };
|
|
9
|
+
try {
|
|
10
|
+
const response = await fetch('./projects.json');
|
|
11
|
+
if (!response.ok)
|
|
12
|
+
throw new Error('No index');
|
|
13
|
+
const data = await response.json();
|
|
14
|
+
if (data.schema !== 'urn:repometry:schema:projects:1' || !Array.isArray(data.projects))
|
|
15
|
+
throw new Error('Invalid index');
|
|
16
|
+
const render = () => {
|
|
17
|
+
const query = search.value.trim().toLowerCase();
|
|
18
|
+
const matches = data.projects.filter(project => project.name.toLowerCase().includes(query));
|
|
19
|
+
matches.sort(compare);
|
|
20
|
+
rows.replaceChildren(...matches.map(projectRow));
|
|
21
|
+
summary.textContent = matches.length === 0 ? 'No matching projects.' : `${matches.length} of ${data.projects.length} projects`;
|
|
22
|
+
};
|
|
23
|
+
search.addEventListener('input', render);
|
|
24
|
+
sort.addEventListener('change', render);
|
|
25
|
+
render();
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
summary.textContent = 'Could not load project reports.';
|
|
29
|
+
}
|
|
30
|
+
function compare(a, b) {
|
|
31
|
+
switch (sort.value) {
|
|
32
|
+
case 'date': return when(b).localeCompare(when(a));
|
|
33
|
+
case 'coverage': return (coverage(a) ?? Infinity) - (coverage(b) ?? Infinity);
|
|
34
|
+
case 'debt': return (b.quality?.maintainability?.debtRatio ?? -1) - (a.quality?.maintainability?.debtRatio ?? -1);
|
|
35
|
+
case 'size': return (b.quality?.codeLines ?? -1) - (a.quality?.codeLines ?? -1);
|
|
36
|
+
default: return a.name.localeCompare(b.name);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** The latest commit's time, falling back to the inspection time for exports without commit times. */
|
|
40
|
+
function when(project) {
|
|
41
|
+
return project.inspection?.committedAt ?? project.inspection?.generatedAt ?? '';
|
|
42
|
+
}
|
|
43
|
+
function projectRow(project) {
|
|
44
|
+
const { name, inspection, quality } = project;
|
|
45
|
+
const maintainability = quality?.maintainability ?? null;
|
|
46
|
+
const row = document.createElement('tr');
|
|
47
|
+
const key = document.createElement('th');
|
|
48
|
+
key.scope = 'row';
|
|
49
|
+
const link = document.createElement('a');
|
|
50
|
+
link.href = `./${encodeURIComponent(name)}/`;
|
|
51
|
+
link.textContent = name;
|
|
52
|
+
key.append(link);
|
|
53
|
+
row.append(key);
|
|
54
|
+
const debt = row.insertCell();
|
|
55
|
+
debt.className = 'numeric';
|
|
56
|
+
debt.textContent = formatPercent(maintainability?.debtRatio ?? null);
|
|
57
|
+
if (maintainability?.grade) {
|
|
58
|
+
const grade = document.createElement('abbr');
|
|
59
|
+
grade.className = 'grade grade-inline';
|
|
60
|
+
grade.title = 'Maintainability grade';
|
|
61
|
+
grade.dataset.grade = maintainability.grade;
|
|
62
|
+
grade.textContent = maintainability.grade;
|
|
63
|
+
debt.append(grade);
|
|
64
|
+
}
|
|
65
|
+
for (const value of [formatPercent(coverage(project)), formatPercent(quality?.duplication?.ratio ?? null),
|
|
66
|
+
quality?.codeLines == null ? '—' : totals.format(quality.codeLines)]) {
|
|
67
|
+
const cell = row.insertCell();
|
|
68
|
+
cell.className = 'numeric';
|
|
69
|
+
cell.textContent = value;
|
|
70
|
+
}
|
|
71
|
+
const last = row.insertCell();
|
|
72
|
+
if (inspection) {
|
|
73
|
+
const sha = document.createElement('code');
|
|
74
|
+
sha.textContent = inspection.sha.slice(0, 7);
|
|
75
|
+
last.append(sha, ` · ${date.format(new Date(when(project)))}`);
|
|
76
|
+
if (inspection.status !== 'complete')
|
|
77
|
+
last.append(` · ${statusLabels[inspection.status]}`);
|
|
78
|
+
}
|
|
79
|
+
else
|
|
80
|
+
last.textContent = 'Not inspected';
|
|
81
|
+
return row;
|
|
82
|
+
}
|
|
83
|
+
function coverage(project) {
|
|
84
|
+
const data = project.inspection?.lineCoverage;
|
|
85
|
+
return data && data.total > 0 ? data.covered / data.total : null;
|
|
86
|
+
}
|
|
87
|
+
function formatPercent(value) {
|
|
88
|
+
return value === null ? '—' : percentage.format(value);
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PullReview } from '../../json/wire/pull-review-model.js';
|
|
2
|
+
export declare function reviewFiles(review: PullReview): HTMLElement;
|
|
3
|
+
export declare function reviewIssues({ findings }: PullReview): HTMLElement;
|
|
4
|
+
export declare function node<K extends keyof HTMLElementTagNameMap>(name: K, text?: string, className?: string): HTMLElementTagNameMap[K];
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { lineCount } from './viewer-pull-trend.js';
|
|
2
|
+
const findingReasons = {
|
|
3
|
+
'reports-unavailable': 'Save inspections for the base and head commits to compare findings.',
|
|
4
|
+
'findings-unavailable': 'One or both revisions lack findings data.',
|
|
5
|
+
'partial-inspection': 'One or both revisions have incomplete analysis.',
|
|
6
|
+
'analysis-changed': 'The base and head used different analysis settings.',
|
|
7
|
+
};
|
|
8
|
+
export function reviewFiles(review) {
|
|
9
|
+
const section = node('section', '', 'pull-section');
|
|
10
|
+
const heading = node('h3', 'Changed files');
|
|
11
|
+
section.append(heading);
|
|
12
|
+
const { diff } = review;
|
|
13
|
+
if (diff.excludedPaths?.length) {
|
|
14
|
+
section.append(node('p', `Path exclusions · ${diff.excludedPaths.join(', ')}`, 'detail pull-exclusions'));
|
|
15
|
+
}
|
|
16
|
+
if (diff.files.length === 0 && diff.gaps.length === 0) {
|
|
17
|
+
section.append(node('p', diff.status === 'unavailable' ? 'Provide LCOV for this head revision to inspect its changed lines.'
|
|
18
|
+
: 'No added or modified source lines in the inspected scope.', 'detail'));
|
|
19
|
+
return section;
|
|
20
|
+
}
|
|
21
|
+
const files = new Map(diff.uncovered.map(file => [file.path, file.lines]));
|
|
22
|
+
const gaps = new Map(diff.gaps.map(gap => [gap.path, gap.reason]));
|
|
23
|
+
const rows = [...diff.files].sort((left, right) => missedCount(right) - missedCount(left) || right.addedLines - left.addedLines)
|
|
24
|
+
.map(record => {
|
|
25
|
+
const { path, addedLines, covered, total } = record;
|
|
26
|
+
const label = node('th');
|
|
27
|
+
const parts = path.split('/');
|
|
28
|
+
for (const [index, part] of parts.entries()) {
|
|
29
|
+
label.append(part);
|
|
30
|
+
if (index < parts.length - 1)
|
|
31
|
+
label.append('/', node('wbr'));
|
|
32
|
+
}
|
|
33
|
+
label.scope = 'row';
|
|
34
|
+
const missing = files.get(path);
|
|
35
|
+
const gap = gaps.get(path);
|
|
36
|
+
gaps.delete(path);
|
|
37
|
+
if (missing) {
|
|
38
|
+
const details = node('details', '', 'pull-missed-lines');
|
|
39
|
+
const ranges = lineRanges(missing);
|
|
40
|
+
details.append(node('summary', `${lineCount(missing.length)} missed ${missing.length === 1 ? 'line' : 'lines'}`), node('span', ranges.join(', ')));
|
|
41
|
+
label.append(details);
|
|
42
|
+
}
|
|
43
|
+
if (gap)
|
|
44
|
+
label.append(node('p', gap, 'detail'));
|
|
45
|
+
const row = node('tr');
|
|
46
|
+
row.append(label, cell(lineCount(addedLines), true), cell(covered === null || total === null ? '—' : `${lineCount(covered)} / ${lineCount(total)}`, true));
|
|
47
|
+
return row;
|
|
48
|
+
});
|
|
49
|
+
if (rows.length > 0)
|
|
50
|
+
section.append(table('Changed file coverage', ['File', 'Added lines', 'Covered / measured'], rows, 'pull-coverage-table'));
|
|
51
|
+
if (gaps.size > 0) {
|
|
52
|
+
const notes = node('ul', '', 'pull-gaps');
|
|
53
|
+
for (const [path, reason] of gaps)
|
|
54
|
+
notes.append(node('li', `${path} · ${reason}`));
|
|
55
|
+
section.append(node('h4', 'Coverage gaps'), notes);
|
|
56
|
+
}
|
|
57
|
+
return section;
|
|
58
|
+
}
|
|
59
|
+
export function reviewIssues({ findings }) {
|
|
60
|
+
const section = node('section', '', 'pull-section');
|
|
61
|
+
section.append(node('h3', 'New issues'));
|
|
62
|
+
if (findings.added === null || findings.added.length === 0) {
|
|
63
|
+
section.append(node('p', findings.reason ? findingReasons[findings.reason] : 'No new issues in the inspected scope.', 'detail'));
|
|
64
|
+
return section;
|
|
65
|
+
}
|
|
66
|
+
const rows = findings.added.map(finding => {
|
|
67
|
+
const row = node('tr');
|
|
68
|
+
const message = node('th', finding.message);
|
|
69
|
+
message.scope = 'row';
|
|
70
|
+
message.append(node('p', [finding.tool, finding.rule].join(' · '), 'detail'));
|
|
71
|
+
const location = finding.path ? `${finding.path}${finding.line ? `:${finding.line}` : ''}` : '—';
|
|
72
|
+
row.append(message, cell(location), cell(finding.level));
|
|
73
|
+
return row;
|
|
74
|
+
});
|
|
75
|
+
section.append(table('Newly introduced findings', ['Finding', 'Source', 'Severity'], rows));
|
|
76
|
+
return section;
|
|
77
|
+
}
|
|
78
|
+
function lineRanges(lines) {
|
|
79
|
+
const ranges = [];
|
|
80
|
+
for (let start = 0; start < lines.length;) {
|
|
81
|
+
let end = start;
|
|
82
|
+
while (lines[end + 1] === lines[end] + 1)
|
|
83
|
+
end++;
|
|
84
|
+
ranges.push(start === end ? String(lines[start]) : `${lines[start]}–${lines[end]}`);
|
|
85
|
+
start = end + 1;
|
|
86
|
+
}
|
|
87
|
+
return ranges;
|
|
88
|
+
}
|
|
89
|
+
function missedCount({ covered, total }) {
|
|
90
|
+
return covered === null || total === null ? -1 : total - covered;
|
|
91
|
+
}
|
|
92
|
+
function table(label, headers, rows, className = '') {
|
|
93
|
+
const table = node('table', '', `pull-table ${className}`.trim());
|
|
94
|
+
const thead = node('thead');
|
|
95
|
+
const headings = node('tr');
|
|
96
|
+
for (const text of headers) {
|
|
97
|
+
const th = node('th', text);
|
|
98
|
+
th.scope = 'col';
|
|
99
|
+
headings.append(th);
|
|
100
|
+
}
|
|
101
|
+
thead.append(headings);
|
|
102
|
+
const body = node('tbody');
|
|
103
|
+
body.append(...rows);
|
|
104
|
+
table.append(thead, body);
|
|
105
|
+
table.setAttribute('aria-label', label);
|
|
106
|
+
return table;
|
|
107
|
+
}
|
|
108
|
+
function cell(text, numeric = false) {
|
|
109
|
+
return node('td', text, numeric ? 'numeric' : '');
|
|
110
|
+
}
|
|
111
|
+
export function node(name, text = '', className = '') {
|
|
112
|
+
const element = document.createElement(name);
|
|
113
|
+
if (text)
|
|
114
|
+
element.textContent = text;
|
|
115
|
+
if (className)
|
|
116
|
+
element.className = className;
|
|
117
|
+
return element;
|
|
118
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PullReview } from '../../json/wire/pull-review-model.js';
|
|
2
|
+
/** A review's coverage as a percentage, from the 0–100 the review records. */
|
|
3
|
+
export declare function formatPercent(value: number | null): string;
|
|
4
|
+
export declare function lineCount(value: number): string;
|
|
5
|
+
export declare function renderDiffCoverageTrend(container: HTMLElement, records: readonly PullReview[]): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { element } from './viewer-dom.js';
|
|
2
|
+
const whole = new Intl.NumberFormat();
|
|
3
|
+
const percentage = new Intl.NumberFormat(undefined, { style: 'percent', maximumFractionDigits: 1 });
|
|
4
|
+
const date = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'short' });
|
|
5
|
+
/** A review's coverage as a percentage, from the 0–100 the review records. */
|
|
6
|
+
export function formatPercent(value) {
|
|
7
|
+
return value === null ? 'Unavailable' : percentage.format(value / 100);
|
|
8
|
+
}
|
|
9
|
+
export function lineCount(value) {
|
|
10
|
+
return whole.format(value);
|
|
11
|
+
}
|
|
12
|
+
/** Why a review has no changed-line coverage to show. */
|
|
13
|
+
const unmeasured = { partial: 'Partial · Unmeasured', 'not-applicable': 'No measurable changes' };
|
|
14
|
+
function trendSubject(review) {
|
|
15
|
+
const subject = element('div', 'pull-trend-subject');
|
|
16
|
+
const time = element('time', 'detail', date.format(new Date(review.generatedAt)));
|
|
17
|
+
time.dateTime = review.generatedAt;
|
|
18
|
+
subject.append(element('strong', '', review.number === null ? review.head.slice(0, 7) : `#${review.number}`), time);
|
|
19
|
+
return subject;
|
|
20
|
+
}
|
|
21
|
+
function trendResult(diff) {
|
|
22
|
+
const value = element('div', 'pull-trend-result');
|
|
23
|
+
const { percent, status, covered, total } = diff;
|
|
24
|
+
if (percent === null) {
|
|
25
|
+
value.append(element('span', 'detail', unmeasured[status] ?? 'Coverage unavailable'));
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
const result = `${whole.format(covered)} / ${whole.format(total)} lines`;
|
|
29
|
+
value.append(element('strong', '', formatPercent(percent)), element('span', 'detail', status === 'partial' ? `Partial · ${result}` : result));
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function trendTrack(diff) {
|
|
33
|
+
const track = element('div', 'pull-trend-track');
|
|
34
|
+
track.setAttribute('aria-hidden', 'true');
|
|
35
|
+
if (diff.percent === null) {
|
|
36
|
+
track.classList.add('pull-trend-empty');
|
|
37
|
+
return track;
|
|
38
|
+
}
|
|
39
|
+
const bar = element('div', 'pull-trend-bar');
|
|
40
|
+
bar.dataset.status = diff.status;
|
|
41
|
+
bar.style.inlineSize = `${diff.percent}%`;
|
|
42
|
+
track.append(bar);
|
|
43
|
+
return track;
|
|
44
|
+
}
|
|
45
|
+
export function renderDiffCoverageTrend(container, records) {
|
|
46
|
+
container.replaceChildren(element('h2', '', 'Changed-line coverage by pull request'));
|
|
47
|
+
const reviews = [...records].sort((left, right) => right.generatedAt.localeCompare(left.generatedAt)).slice(0, 12);
|
|
48
|
+
if (reviews.length === 0) {
|
|
49
|
+
container.append(element('p', 'detail', 'No saved PR reviews.'));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const list = element('ol', 'pull-trend-list');
|
|
53
|
+
const axis = element('div', 'pull-trend-axis');
|
|
54
|
+
axis.setAttribute('aria-hidden', 'true');
|
|
55
|
+
for (const value of [0, 25, 50, 75, 100])
|
|
56
|
+
axis.append(element('span', '', `${value}%`));
|
|
57
|
+
container.append(axis, list);
|
|
58
|
+
for (const review of reviews) {
|
|
59
|
+
const row = element('li', 'pull-trend-row');
|
|
60
|
+
row.append(trendSubject(review), trendTrack(review.diff), trendResult(review.diff));
|
|
61
|
+
list.append(row);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { node, reviewFiles, reviewIssues } from './viewer-pull-sections.js';
|
|
2
|
+
import { formatPercent, lineCount } from './viewer-pull-trend.js';
|
|
3
|
+
const points = new Intl.NumberFormat(undefined, { signDisplay: 'exceptZero', maximumFractionDigits: 1 });
|
|
4
|
+
const gateWords = {
|
|
5
|
+
passed: 'Gate passed', failed: 'Gate failed', 'not-applicable': 'Gate skipped', indeterminate: 'Gate pending data',
|
|
6
|
+
};
|
|
7
|
+
const gateStates = { passed: 'complete', indeterminate: 'partial' };
|
|
8
|
+
const coverageReasons = {
|
|
9
|
+
'reports-unavailable': 'Save inspections for the base and head commits to compare total coverage.',
|
|
10
|
+
'observations-unavailable': 'The saved inspections lack complete line coverage data.',
|
|
11
|
+
'source-scope-unknown': 'The inspected source scope is unavailable for one of the revisions.',
|
|
12
|
+
'source-scope-changed': 'The base and head used different source scopes.',
|
|
13
|
+
'method-unknown': 'The coverage method is unavailable for one of the revisions.',
|
|
14
|
+
'method-changed': 'The base and head used different coverage methods.',
|
|
15
|
+
'head-coverage-changed': 'The review used a different LCOV input than the saved head inspection.',
|
|
16
|
+
};
|
|
17
|
+
export function renderPulls(container, records) {
|
|
18
|
+
const heading = node('h2', 'Pull requests');
|
|
19
|
+
// The page title stands outside the card, as on every other page; the review picker shares its row.
|
|
20
|
+
const toolbar = node('div', '', 'section-heading pull-heading');
|
|
21
|
+
toolbar.append(heading);
|
|
22
|
+
const selection = node('section', '', 'panel');
|
|
23
|
+
container.replaceChildren(toolbar, selection);
|
|
24
|
+
if (records.length === 0) {
|
|
25
|
+
selection.append(node('p', 'No saved PR reviews. Run Repometry on a pull request with its base revision and PR number.', 'detail empty'));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const view = node('div');
|
|
29
|
+
selection.append(view);
|
|
30
|
+
const display = (review) => view.replaceChildren(reviewSummary(review), reviewFiles(review), reviewIssues(review));
|
|
31
|
+
display(records[0]);
|
|
32
|
+
if (records.length === 1) {
|
|
33
|
+
const number = records[0].number;
|
|
34
|
+
if (number !== null)
|
|
35
|
+
heading.append(node('span', ` #${number}`, 'pull-number'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const label = node('label', 'Saved review', 'pull-picker');
|
|
39
|
+
const select = node('select');
|
|
40
|
+
for (const [index, review] of records.entries()) {
|
|
41
|
+
select.append(new Option(`#${review.number} · ${review.head.slice(0, 7)}`, String(index)));
|
|
42
|
+
}
|
|
43
|
+
label.append(select);
|
|
44
|
+
toolbar.append(label);
|
|
45
|
+
select.addEventListener('change', () => {
|
|
46
|
+
const review = records[select.selectedIndex];
|
|
47
|
+
if (review)
|
|
48
|
+
display(review);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** Total coverage and how it moved from the base. */
|
|
52
|
+
function totalCoverage(coverage) {
|
|
53
|
+
const total = coverage.head?.value == null ? 'Unavailable' : formatPercent(coverage.head.value);
|
|
54
|
+
return [total, coverage.delta === null ? 'No comparable base coverage' : `${points.format(coverage.delta)} pp from base`];
|
|
55
|
+
}
|
|
56
|
+
/** Changed-line coverage, with the measured lines behind it or why there are none. */
|
|
57
|
+
function changedCoverage(diff) {
|
|
58
|
+
if (diff.percent === null)
|
|
59
|
+
return diff.status === 'not-applicable' ? 'No measured changed lines' : 'Coverage unavailable';
|
|
60
|
+
return `${lineCount(diff.covered)} of ${lineCount(diff.total)} measured lines${diff.status === 'partial' ? ' · Partial' : ''}`;
|
|
61
|
+
}
|
|
62
|
+
/** New issues; where the gate counted a different number of quality issues, the line under the figure says so. */
|
|
63
|
+
function newIssues({ added, gate, qualityCount }) {
|
|
64
|
+
const value = added === null ? 'Unavailable' : lineCount(added.length);
|
|
65
|
+
if (gate && qualityCount !== null && qualityCount !== added?.length)
|
|
66
|
+
return [value, `Gate counted ${lineCount(qualityCount)} quality issues`];
|
|
67
|
+
return [value, added === null ? '' : 'Compared with base'];
|
|
68
|
+
}
|
|
69
|
+
function reviewSummary({ base, head, coverage, diff, findings }) {
|
|
70
|
+
const header = node('div', '', 'pull-revisions');
|
|
71
|
+
header.append(node('p', 'Base ', 'detail'), node('code', base.slice(0, 7)), node('span', '→', 'detail'), node('p', 'Head ', 'detail'), node('code', head.slice(0, 7)));
|
|
72
|
+
const summary = node('div', '', 'pull-summary');
|
|
73
|
+
summary.append(summaryMetric('Total coverage', ...totalCoverage(coverage), coverage.gate?.status), summaryMetric('Changed-line coverage', formatPercent(diff.percent), changedCoverage(diff), diff.gate?.status), summaryMetric('New issues', ...newIssues(findings), findings.gate?.status));
|
|
74
|
+
const result = node('div', '', 'pull-summary-block');
|
|
75
|
+
result.append(header, summary);
|
|
76
|
+
const measured = coverage.base || coverage.head || coverage.gate;
|
|
77
|
+
if (coverage.reason && measured)
|
|
78
|
+
result.append(node('p', coverageReasons[coverage.reason], 'detail'));
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
function summaryMetric(label, value, detail, gate) {
|
|
82
|
+
const figure = node('div', '', 'pull-fact');
|
|
83
|
+
figure.append(node('span', label, 'detail'), node('strong', value, 'pull-value'));
|
|
84
|
+
if (detail)
|
|
85
|
+
figure.append(node('p', detail, 'detail'));
|
|
86
|
+
if (gate) {
|
|
87
|
+
const badge = node('span', gateWords[gate] ?? gate, 'status pull-gate');
|
|
88
|
+
badge.dataset.status = gateStates[gate] ?? gate;
|
|
89
|
+
figure.append(badge);
|
|
90
|
+
}
|
|
91
|
+
return figure;
|
|
92
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Clause } from './viewer-filter.js';
|
|
2
|
+
import type { Suggestion } from './viewer-suggest.js';
|
|
3
|
+
export interface QueryField {
|
|
4
|
+
readonly element: HTMLElement;
|
|
5
|
+
/** Text typed but not yet made a chip; it filters paths as you type. */
|
|
6
|
+
readonly text: () => string;
|
|
7
|
+
/** Replaces the chips from outside, as when a language is picked on the bar; reports the change as typing does. */
|
|
8
|
+
readonly set: (clauses: readonly Clause[]) => void;
|
|
9
|
+
}
|
|
10
|
+
interface FieldOptions {
|
|
11
|
+
readonly suggestions: (text: string) => Suggestion[];
|
|
12
|
+
readonly change: (clauses: readonly Clause[], text: string) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The field: chips for the chosen clauses, then a text input; the list of suggestions hangs from it in one frame.
|
|
16
|
+
* Backspace in an empty input takes the last chip back into text, so a chip can be edited, not just removed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function queryField(clauses: readonly Clause[], options: FieldOptions): QueryField;
|
|
19
|
+
export {};
|