@opencodehub/ingestion 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 +202 -0
- package/README.md +69 -0
- package/dist/extract/index.d.ts +8 -0
- package/dist/extract/index.d.ts.map +1 -0
- package/dist/extract/index.js +6 -0
- package/dist/extract/index.js.map +1 -0
- package/dist/extract/orm-detector.d.ts +19 -0
- package/dist/extract/orm-detector.d.ts.map +1 -0
- package/dist/extract/orm-detector.js +209 -0
- package/dist/extract/orm-detector.js.map +1 -0
- package/dist/extract/property-access.d.ts +76 -0
- package/dist/extract/property-access.d.ts.map +1 -0
- package/dist/extract/property-access.js +260 -0
- package/dist/extract/property-access.js.map +1 -0
- package/dist/extract/receiver-resolver.d.ts +86 -0
- package/dist/extract/receiver-resolver.d.ts.map +1 -0
- package/dist/extract/receiver-resolver.js +77 -0
- package/dist/extract/receiver-resolver.js.map +1 -0
- package/dist/extract/route-detector-java.d.ts +29 -0
- package/dist/extract/route-detector-java.d.ts.map +1 -0
- package/dist/extract/route-detector-java.js +190 -0
- package/dist/extract/route-detector-java.js.map +1 -0
- package/dist/extract/route-detector-nestjs.d.ts +30 -0
- package/dist/extract/route-detector-nestjs.d.ts.map +1 -0
- package/dist/extract/route-detector-nestjs.js +134 -0
- package/dist/extract/route-detector-nestjs.js.map +1 -0
- package/dist/extract/route-detector-python.d.ts +28 -0
- package/dist/extract/route-detector-python.d.ts.map +1 -0
- package/dist/extract/route-detector-python.js +100 -0
- package/dist/extract/route-detector-python.js.map +1 -0
- package/dist/extract/route-detector-rails.d.ts +28 -0
- package/dist/extract/route-detector-rails.d.ts.map +1 -0
- package/dist/extract/route-detector-rails.js +162 -0
- package/dist/extract/route-detector-rails.js.map +1 -0
- package/dist/extract/route-detector.d.ts +45 -0
- package/dist/extract/route-detector.d.ts.map +1 -0
- package/dist/extract/route-detector.js +467 -0
- package/dist/extract/route-detector.js.map +1 -0
- package/dist/extract/tool-detector.d.ts +26 -0
- package/dist/extract/tool-detector.d.ts.map +1 -0
- package/dist/extract/tool-detector.js +364 -0
- package/dist/extract/tool-detector.js.map +1 -0
- package/dist/extract/types.d.ts +89 -0
- package/dist/extract/types.d.ts.map +1 -0
- package/dist/extract/types.js +11 -0
- package/dist/extract/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/parse/cobol-regex.d.ts +85 -0
- package/dist/parse/cobol-regex.d.ts.map +1 -0
- package/dist/parse/cobol-regex.js +355 -0
- package/dist/parse/cobol-regex.js.map +1 -0
- package/dist/parse/grammar-registry.d.ts +115 -0
- package/dist/parse/grammar-registry.d.ts.map +1 -0
- package/dist/parse/grammar-registry.js +278 -0
- package/dist/parse/grammar-registry.js.map +1 -0
- package/dist/parse/index.d.ts +14 -0
- package/dist/parse/index.d.ts.map +1 -0
- package/dist/parse/index.js +10 -0
- package/dist/parse/index.js.map +1 -0
- package/dist/parse/language-detector.d.ts +17 -0
- package/dist/parse/language-detector.d.ts.map +1 -0
- package/dist/parse/language-detector.js +104 -0
- package/dist/parse/language-detector.js.map +1 -0
- package/dist/parse/parse-worker.d.ts +24 -0
- package/dist/parse/parse-worker.d.ts.map +1 -0
- package/dist/parse/parse-worker.js +230 -0
- package/dist/parse/parse-worker.js.map +1 -0
- package/dist/parse/types.d.ts +49 -0
- package/dist/parse/types.d.ts.map +1 -0
- package/dist/parse/types.js +11 -0
- package/dist/parse/types.js.map +1 -0
- package/dist/parse/unified-queries.d.ts +37 -0
- package/dist/parse/unified-queries.d.ts.map +1 -0
- package/dist/parse/unified-queries.js +623 -0
- package/dist/parse/unified-queries.js.map +1 -0
- package/dist/parse/wasm-fallback.d.ts +88 -0
- package/dist/parse/wasm-fallback.d.ts.map +1 -0
- package/dist/parse/wasm-fallback.js +258 -0
- package/dist/parse/wasm-fallback.js.map +1 -0
- package/dist/parse/worker-pool.d.ts +48 -0
- package/dist/parse/worker-pool.d.ts.map +1 -0
- package/dist/parse/worker-pool.js +97 -0
- package/dist/parse/worker-pool.js.map +1 -0
- package/dist/pipeline/dep-parsers/go.d.ts +25 -0
- package/dist/pipeline/dep-parsers/go.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/go.js +146 -0
- package/dist/pipeline/dep-parsers/go.js.map +1 -0
- package/dist/pipeline/dep-parsers/index.d.ts +17 -0
- package/dist/pipeline/dep-parsers/index.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/index.js +16 -0
- package/dist/pipeline/dep-parsers/index.js.map +1 -0
- package/dist/pipeline/dep-parsers/maven.d.ts +24 -0
- package/dist/pipeline/dep-parsers/maven.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/maven.js +131 -0
- package/dist/pipeline/dep-parsers/maven.js.map +1 -0
- package/dist/pipeline/dep-parsers/npm.d.ts +30 -0
- package/dist/pipeline/dep-parsers/npm.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/npm.js +309 -0
- package/dist/pipeline/dep-parsers/npm.js.map +1 -0
- package/dist/pipeline/dep-parsers/nuget.d.ts +24 -0
- package/dist/pipeline/dep-parsers/nuget.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/nuget.js +178 -0
- package/dist/pipeline/dep-parsers/nuget.js.map +1 -0
- package/dist/pipeline/dep-parsers/python.d.ts +21 -0
- package/dist/pipeline/dep-parsers/python.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/python.js +369 -0
- package/dist/pipeline/dep-parsers/python.js.map +1 -0
- package/dist/pipeline/dep-parsers/rust.d.ts +18 -0
- package/dist/pipeline/dep-parsers/rust.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/rust.js +134 -0
- package/dist/pipeline/dep-parsers/rust.js.map +1 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.d.ts +15 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.js +31 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.js.map +1 -0
- package/dist/pipeline/dep-parsers/types.d.ts +63 -0
- package/dist/pipeline/dep-parsers/types.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/types.js +56 -0
- package/dist/pipeline/dep-parsers/types.js.map +1 -0
- package/dist/pipeline/gitignore-stack.d.ts +44 -0
- package/dist/pipeline/gitignore-stack.d.ts.map +1 -0
- package/dist/pipeline/gitignore-stack.js +69 -0
- package/dist/pipeline/gitignore-stack.js.map +1 -0
- package/dist/pipeline/gitignore.d.ts +67 -0
- package/dist/pipeline/gitignore.d.ts.map +1 -0
- package/dist/pipeline/gitignore.js +210 -0
- package/dist/pipeline/gitignore.js.map +1 -0
- package/dist/pipeline/index.d.ts +53 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +29 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/orchestrator.d.ts +105 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.js +175 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/pipeline/ownership-helpers/drift.d.ts +41 -0
- package/dist/pipeline/ownership-helpers/drift.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/drift.js +122 -0
- package/dist/pipeline/ownership-helpers/drift.js.map +1 -0
- package/dist/pipeline/ownership-helpers/gini-community.d.ts +24 -0
- package/dist/pipeline/ownership-helpers/gini-community.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/gini-community.js +32 -0
- package/dist/pipeline/ownership-helpers/gini-community.js.map +1 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts +71 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.js +178 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.js.map +1 -0
- package/dist/pipeline/ownership-helpers/line-overlap.d.ts +35 -0
- package/dist/pipeline/ownership-helpers/line-overlap.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/line-overlap.js +62 -0
- package/dist/pipeline/ownership-helpers/line-overlap.js.map +1 -0
- package/dist/pipeline/ownership-helpers/orphan.d.ts +73 -0
- package/dist/pipeline/ownership-helpers/orphan.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/orphan.js +117 -0
- package/dist/pipeline/ownership-helpers/orphan.js.map +1 -0
- package/dist/pipeline/phases/accesses.d.ts +44 -0
- package/dist/pipeline/phases/accesses.d.ts.map +1 -0
- package/dist/pipeline/phases/accesses.js +194 -0
- package/dist/pipeline/phases/accesses.js.map +1 -0
- package/dist/pipeline/phases/annotate.d.ts +28 -0
- package/dist/pipeline/phases/annotate.d.ts.map +1 -0
- package/dist/pipeline/phases/annotate.js +60 -0
- package/dist/pipeline/phases/annotate.js.map +1 -0
- package/dist/pipeline/phases/cochange.d.ts +42 -0
- package/dist/pipeline/phases/cochange.d.ts.map +1 -0
- package/dist/pipeline/phases/cochange.js +0 -0
- package/dist/pipeline/phases/cochange.js.map +1 -0
- package/dist/pipeline/phases/communities.d.ts +34 -0
- package/dist/pipeline/phases/communities.d.ts.map +1 -0
- package/dist/pipeline/phases/communities.js +412 -0
- package/dist/pipeline/phases/communities.js.map +1 -0
- package/dist/pipeline/phases/complexity.d.ts +50 -0
- package/dist/pipeline/phases/complexity.d.ts.map +1 -0
- package/dist/pipeline/phases/complexity.js +794 -0
- package/dist/pipeline/phases/complexity.js.map +1 -0
- package/dist/pipeline/phases/confidence-demote.d.ts +23 -0
- package/dist/pipeline/phases/confidence-demote.d.ts.map +1 -0
- package/dist/pipeline/phases/confidence-demote.js +113 -0
- package/dist/pipeline/phases/confidence-demote.js.map +1 -0
- package/dist/pipeline/phases/content-cache.d.ts +166 -0
- package/dist/pipeline/phases/content-cache.d.ts.map +1 -0
- package/dist/pipeline/phases/content-cache.js +323 -0
- package/dist/pipeline/phases/content-cache.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts +25 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.js +139 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts +25 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.js +51 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts +32 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.js +98 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.d.ts +21 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.js +104 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/types.d.ts +27 -0
- package/dist/pipeline/phases/coverage-parsers/types.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/types.js +39 -0
- package/dist/pipeline/phases/coverage-parsers/types.js.map +1 -0
- package/dist/pipeline/phases/coverage.d.ts +39 -0
- package/dist/pipeline/phases/coverage.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage.js +154 -0
- package/dist/pipeline/phases/coverage.js.map +1 -0
- package/dist/pipeline/phases/cross-file.d.ts +40 -0
- package/dist/pipeline/phases/cross-file.d.ts.map +1 -0
- package/dist/pipeline/phases/cross-file.js +411 -0
- package/dist/pipeline/phases/cross-file.js.map +1 -0
- package/dist/pipeline/phases/dead-code.d.ts +28 -0
- package/dist/pipeline/phases/dead-code.d.ts.map +1 -0
- package/dist/pipeline/phases/dead-code.js +157 -0
- package/dist/pipeline/phases/dead-code.js.map +1 -0
- package/dist/pipeline/phases/default-set.d.ts +24 -0
- package/dist/pipeline/phases/default-set.d.ts.map +1 -0
- package/dist/pipeline/phases/default-set.js +133 -0
- package/dist/pipeline/phases/default-set.js.map +1 -0
- package/dist/pipeline/phases/dependencies.d.ts +59 -0
- package/dist/pipeline/phases/dependencies.d.ts.map +1 -0
- package/dist/pipeline/phases/dependencies.js +281 -0
- package/dist/pipeline/phases/dependencies.js.map +1 -0
- package/dist/pipeline/phases/embedder-pool.d.ts +31 -0
- package/dist/pipeline/phases/embedder-pool.d.ts.map +1 -0
- package/dist/pipeline/phases/embedder-pool.js +79 -0
- package/dist/pipeline/phases/embedder-pool.js.map +1 -0
- package/dist/pipeline/phases/embedder-worker.d.ts +28 -0
- package/dist/pipeline/phases/embedder-worker.d.ts.map +1 -0
- package/dist/pipeline/phases/embedder-worker.js +43 -0
- package/dist/pipeline/phases/embedder-worker.js.map +1 -0
- package/dist/pipeline/phases/embeddings.d.ts +117 -0
- package/dist/pipeline/phases/embeddings.d.ts.map +1 -0
- package/dist/pipeline/phases/embeddings.js +697 -0
- package/dist/pipeline/phases/embeddings.js.map +1 -0
- package/dist/pipeline/phases/fetches.d.ts +47 -0
- package/dist/pipeline/phases/fetches.d.ts.map +1 -0
- package/dist/pipeline/phases/fetches.js +207 -0
- package/dist/pipeline/phases/fetches.js.map +1 -0
- package/dist/pipeline/phases/incremental-helper.d.ts +96 -0
- package/dist/pipeline/phases/incremental-helper.d.ts.map +1 -0
- package/dist/pipeline/phases/incremental-helper.js +125 -0
- package/dist/pipeline/phases/incremental-helper.js.map +1 -0
- package/dist/pipeline/phases/incremental-scope.d.ts +67 -0
- package/dist/pipeline/phases/incremental-scope.d.ts.map +1 -0
- package/dist/pipeline/phases/incremental-scope.js +225 -0
- package/dist/pipeline/phases/incremental-scope.js.map +1 -0
- package/dist/pipeline/phases/markdown.d.ts +29 -0
- package/dist/pipeline/phases/markdown.d.ts.map +1 -0
- package/dist/pipeline/phases/markdown.js +298 -0
- package/dist/pipeline/phases/markdown.js.map +1 -0
- package/dist/pipeline/phases/mro.d.ts +24 -0
- package/dist/pipeline/phases/mro.d.ts.map +1 -0
- package/dist/pipeline/phases/mro.js +303 -0
- package/dist/pipeline/phases/mro.js.map +1 -0
- package/dist/pipeline/phases/openapi.d.ts +52 -0
- package/dist/pipeline/phases/openapi.d.ts.map +1 -0
- package/dist/pipeline/phases/openapi.js +285 -0
- package/dist/pipeline/phases/openapi.js.map +1 -0
- package/dist/pipeline/phases/orm.d.ts +26 -0
- package/dist/pipeline/phases/orm.d.ts.map +1 -0
- package/dist/pipeline/phases/orm.js +183 -0
- package/dist/pipeline/phases/orm.js.map +1 -0
- package/dist/pipeline/phases/ownership.d.ts +88 -0
- package/dist/pipeline/phases/ownership.d.ts.map +1 -0
- package/dist/pipeline/phases/ownership.js +479 -0
- package/dist/pipeline/phases/ownership.js.map +1 -0
- package/dist/pipeline/phases/parse.d.ts +63 -0
- package/dist/pipeline/phases/parse.d.ts.map +1 -0
- package/dist/pipeline/phases/parse.js +994 -0
- package/dist/pipeline/phases/parse.js.map +1 -0
- package/dist/pipeline/phases/processes.d.ts +47 -0
- package/dist/pipeline/phases/processes.d.ts.map +1 -0
- package/dist/pipeline/phases/processes.js +620 -0
- package/dist/pipeline/phases/processes.js.map +1 -0
- package/dist/pipeline/phases/profile.d.ts +33 -0
- package/dist/pipeline/phases/profile.d.ts.map +1 -0
- package/dist/pipeline/phases/profile.js +91 -0
- package/dist/pipeline/phases/profile.js.map +1 -0
- package/dist/pipeline/phases/repo-node.d.ts +112 -0
- package/dist/pipeline/phases/repo-node.d.ts.map +1 -0
- package/dist/pipeline/phases/repo-node.js +272 -0
- package/dist/pipeline/phases/repo-node.js.map +1 -0
- package/dist/pipeline/phases/risk-snapshot.d.ts +34 -0
- package/dist/pipeline/phases/risk-snapshot.d.ts.map +1 -0
- package/dist/pipeline/phases/risk-snapshot.js +63 -0
- package/dist/pipeline/phases/risk-snapshot.js.map +1 -0
- package/dist/pipeline/phases/routes.d.ts +31 -0
- package/dist/pipeline/phases/routes.d.ts.map +1 -0
- package/dist/pipeline/phases/routes.js +262 -0
- package/dist/pipeline/phases/routes.js.map +1 -0
- package/dist/pipeline/phases/sbom.d.ts +45 -0
- package/dist/pipeline/phases/sbom.d.ts.map +1 -0
- package/dist/pipeline/phases/sbom.js +289 -0
- package/dist/pipeline/phases/sbom.js.map +1 -0
- package/dist/pipeline/phases/scan.d.ts +54 -0
- package/dist/pipeline/phases/scan.d.ts.map +1 -0
- package/dist/pipeline/phases/scan.js +340 -0
- package/dist/pipeline/phases/scan.js.map +1 -0
- package/dist/pipeline/phases/scip-index.d.ts +54 -0
- package/dist/pipeline/phases/scip-index.d.ts.map +1 -0
- package/dist/pipeline/phases/scip-index.js +469 -0
- package/dist/pipeline/phases/scip-index.js.map +1 -0
- package/dist/pipeline/phases/structure.d.ts +21 -0
- package/dist/pipeline/phases/structure.d.ts.map +1 -0
- package/dist/pipeline/phases/structure.js +115 -0
- package/dist/pipeline/phases/structure.js.map +1 -0
- package/dist/pipeline/phases/summarize.d.ts +126 -0
- package/dist/pipeline/phases/summarize.d.ts.map +1 -0
- package/dist/pipeline/phases/summarize.js +401 -0
- package/dist/pipeline/phases/summarize.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts +42 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.js +96 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts +22 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.js +32 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts +21 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.js +37 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/gini.d.ts +32 -0
- package/dist/pipeline/phases/temporal-helpers/gini.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/gini.js +78 -0
- package/dist/pipeline/phases/temporal-helpers/gini.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts +14 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.js +25 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts +18 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.js +119 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.js.map +1 -0
- package/dist/pipeline/phases/temporal.d.ts +65 -0
- package/dist/pipeline/phases/temporal.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal.js +621 -0
- package/dist/pipeline/phases/temporal.js.map +1 -0
- package/dist/pipeline/phases/tools.d.ts +21 -0
- package/dist/pipeline/phases/tools.d.ts.map +1 -0
- package/dist/pipeline/phases/tools.js +118 -0
- package/dist/pipeline/phases/tools.js.map +1 -0
- package/dist/pipeline/profile-detectors/api-contracts.d.ts +18 -0
- package/dist/pipeline/profile-detectors/api-contracts.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/api-contracts.js +78 -0
- package/dist/pipeline/profile-detectors/api-contracts.js.map +1 -0
- package/dist/pipeline/profile-detectors/framework-detector.d.ts +11 -0
- package/dist/pipeline/profile-detectors/framework-detector.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/framework-detector.js +11 -0
- package/dist/pipeline/profile-detectors/framework-detector.js.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts +7 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.js +7 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.js.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks.d.ts +7 -0
- package/dist/pipeline/profile-detectors/frameworks.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks.js +7 -0
- package/dist/pipeline/profile-detectors/frameworks.js.map +1 -0
- package/dist/pipeline/profile-detectors/iac.d.ts +22 -0
- package/dist/pipeline/profile-detectors/iac.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/iac.js +97 -0
- package/dist/pipeline/profile-detectors/iac.js.map +1 -0
- package/dist/pipeline/profile-detectors/languages.d.ts +18 -0
- package/dist/pipeline/profile-detectors/languages.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/languages.js +60 -0
- package/dist/pipeline/profile-detectors/languages.js.map +1 -0
- package/dist/pipeline/profile-detectors/manifests.d.ts +7 -0
- package/dist/pipeline/profile-detectors/manifests.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/manifests.js +7 -0
- package/dist/pipeline/profile-detectors/manifests.js.map +1 -0
- package/dist/pipeline/profile-detectors/src-dirs.d.ts +17 -0
- package/dist/pipeline/profile-detectors/src-dirs.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/src-dirs.js +89 -0
- package/dist/pipeline/profile-detectors/src-dirs.js.map +1 -0
- package/dist/pipeline/profile-detectors/variant-detectors.d.ts +7 -0
- package/dist/pipeline/profile-detectors/variant-detectors.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/variant-detectors.js +7 -0
- package/dist/pipeline/profile-detectors/variant-detectors.js.map +1 -0
- package/dist/pipeline/runner.d.ts +54 -0
- package/dist/pipeline/runner.d.ts.map +1 -0
- package/dist/pipeline/runner.js +247 -0
- package/dist/pipeline/runner.js.map +1 -0
- package/dist/pipeline/types.d.ts +235 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +15 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/providers/c.d.ts +3 -0
- package/dist/providers/c.d.ts.map +1 -0
- package/dist/providers/c.js +162 -0
- package/dist/providers/c.js.map +1 -0
- package/dist/providers/cobol.d.ts +19 -0
- package/dist/providers/cobol.d.ts.map +1 -0
- package/dist/providers/cobol.js +44 -0
- package/dist/providers/cobol.js.map +1 -0
- package/dist/providers/cpp.d.ts +3 -0
- package/dist/providers/cpp.d.ts.map +1 -0
- package/dist/providers/cpp.js +200 -0
- package/dist/providers/cpp.js.map +1 -0
- package/dist/providers/csharp.d.ts +3 -0
- package/dist/providers/csharp.d.ts.map +1 -0
- package/dist/providers/csharp.js +292 -0
- package/dist/providers/csharp.js.map +1 -0
- package/dist/providers/dart.d.ts +3 -0
- package/dist/providers/dart.d.ts.map +1 -0
- package/dist/providers/dart.js +214 -0
- package/dist/providers/dart.js.map +1 -0
- package/dist/providers/definition-ids.d.ts +18 -0
- package/dist/providers/definition-ids.d.ts.map +1 -0
- package/dist/providers/definition-ids.js +23 -0
- package/dist/providers/definition-ids.js.map +1 -0
- package/dist/providers/extract-helpers.d.ts +60 -0
- package/dist/providers/extract-helpers.d.ts.map +1 -0
- package/dist/providers/extract-helpers.js +296 -0
- package/dist/providers/extract-helpers.js.map +1 -0
- package/dist/providers/extraction-types.d.ts +85 -0
- package/dist/providers/extraction-types.d.ts.map +1 -0
- package/dist/providers/extraction-types.js +13 -0
- package/dist/providers/extraction-types.js.map +1 -0
- package/dist/providers/go.d.ts +3 -0
- package/dist/providers/go.d.ts.map +1 -0
- package/dist/providers/go.js +359 -0
- package/dist/providers/go.js.map +1 -0
- package/dist/providers/http-detect.d.ts +44 -0
- package/dist/providers/http-detect.d.ts.map +1 -0
- package/dist/providers/http-detect.js +307 -0
- package/dist/providers/http-detect.js.map +1 -0
- package/dist/providers/index.d.ts +38 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +33 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/java.d.ts +3 -0
- package/dist/providers/java.d.ts.map +1 -0
- package/dist/providers/java.js +259 -0
- package/dist/providers/java.js.map +1 -0
- package/dist/providers/javascript.d.ts +3 -0
- package/dist/providers/javascript.d.ts.map +1 -0
- package/dist/providers/javascript.js +139 -0
- package/dist/providers/javascript.js.map +1 -0
- package/dist/providers/kotlin.d.ts +3 -0
- package/dist/providers/kotlin.d.ts.map +1 -0
- package/dist/providers/kotlin.js +175 -0
- package/dist/providers/kotlin.js.map +1 -0
- package/dist/providers/php.d.ts +3 -0
- package/dist/providers/php.d.ts.map +1 -0
- package/dist/providers/php.js +218 -0
- package/dist/providers/php.js.map +1 -0
- package/dist/providers/python-accesses.d.ts +9 -0
- package/dist/providers/python-accesses.d.ts.map +1 -0
- package/dist/providers/python-accesses.js +22 -0
- package/dist/providers/python-accesses.js.map +1 -0
- package/dist/providers/python.d.ts +3 -0
- package/dist/providers/python.d.ts.map +1 -0
- package/dist/providers/python.js +323 -0
- package/dist/providers/python.js.map +1 -0
- package/dist/providers/registry.d.ts +4 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +46 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/resolution/c3.d.ts +6 -0
- package/dist/providers/resolution/c3.d.ts.map +1 -0
- package/dist/providers/resolution/c3.js +76 -0
- package/dist/providers/resolution/c3.js.map +1 -0
- package/dist/providers/resolution/context.d.ts +38 -0
- package/dist/providers/resolution/context.d.ts.map +1 -0
- package/dist/providers/resolution/context.js +45 -0
- package/dist/providers/resolution/context.js.map +1 -0
- package/dist/providers/resolution/first-wins.d.ts +3 -0
- package/dist/providers/resolution/first-wins.d.ts.map +1 -0
- package/dist/providers/resolution/first-wins.js +27 -0
- package/dist/providers/resolution/first-wins.js.map +1 -0
- package/dist/providers/resolution/mro.d.ts +16 -0
- package/dist/providers/resolution/mro.d.ts.map +1 -0
- package/dist/providers/resolution/mro.js +14 -0
- package/dist/providers/resolution/mro.js.map +1 -0
- package/dist/providers/resolution/none.d.ts +3 -0
- package/dist/providers/resolution/none.d.ts.map +1 -0
- package/dist/providers/resolution/none.js +11 -0
- package/dist/providers/resolution/none.js.map +1 -0
- package/dist/providers/resolution/python-all-filter.d.ts +25 -0
- package/dist/providers/resolution/python-all-filter.d.ts.map +1 -0
- package/dist/providers/resolution/python-all-filter.js +64 -0
- package/dist/providers/resolution/python-all-filter.js.map +1 -0
- package/dist/providers/resolution/resolver-strategy.d.ts +42 -0
- package/dist/providers/resolution/resolver-strategy.d.ts.map +1 -0
- package/dist/providers/resolution/resolver-strategy.js +50 -0
- package/dist/providers/resolution/resolver-strategy.js.map +1 -0
- package/dist/providers/resolution/single-inheritance.d.ts +3 -0
- package/dist/providers/resolution/single-inheritance.d.ts.map +1 -0
- package/dist/providers/resolution/single-inheritance.js +21 -0
- package/dist/providers/resolution/single-inheritance.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts +16 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js +50 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/glue.d.ts +15 -0
- package/dist/providers/resolution/stack-graphs/glue.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/glue.js +44 -0
- package/dist/providers/resolution/stack-graphs/glue.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts +30 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.js +366 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts +9 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.js +152 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.d.ts +11 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.js +247 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/types.d.ts +93 -0
- package/dist/providers/resolution/stack-graphs/types.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/types.js +11 -0
- package/dist/providers/resolution/stack-graphs/types.js.map +1 -0
- package/dist/providers/resolution/stack-graphs-python.d.ts +27 -0
- package/dist/providers/resolution/stack-graphs-python.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs-python.js +104 -0
- package/dist/providers/resolution/stack-graphs-python.js.map +1 -0
- package/dist/providers/resolution/stack-graphs-ts.d.ts +134 -0
- package/dist/providers/resolution/stack-graphs-ts.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs-ts.js +372 -0
- package/dist/providers/resolution/stack-graphs-ts.js.map +1 -0
- package/dist/providers/ruby.d.ts +3 -0
- package/dist/providers/ruby.d.ts.map +1 -0
- package/dist/providers/ruby.js +259 -0
- package/dist/providers/ruby.js.map +1 -0
- package/dist/providers/rust.d.ts +3 -0
- package/dist/providers/rust.d.ts.map +1 -0
- package/dist/providers/rust.js +318 -0
- package/dist/providers/rust.js.map +1 -0
- package/dist/providers/swift.d.ts +3 -0
- package/dist/providers/swift.d.ts.map +1 -0
- package/dist/providers/swift.js +177 -0
- package/dist/providers/swift.js.map +1 -0
- package/dist/providers/test-helpers.d.ts +24 -0
- package/dist/providers/test-helpers.d.ts.map +1 -0
- package/dist/providers/test-helpers.js +33 -0
- package/dist/providers/test-helpers.js.map +1 -0
- package/dist/providers/ts-shared.d.ts +30 -0
- package/dist/providers/ts-shared.d.ts.map +1 -0
- package/dist/providers/ts-shared.js +328 -0
- package/dist/providers/ts-shared.js.map +1 -0
- package/dist/providers/tsx.d.ts +7 -0
- package/dist/providers/tsx.d.ts.map +1 -0
- package/dist/providers/tsx.js +79 -0
- package/dist/providers/tsx.js.map +1 -0
- package/dist/providers/types.d.ts +166 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +7 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/typescript-family-accesses.d.ts +14 -0
- package/dist/providers/typescript-family-accesses.d.ts.map +1 -0
- package/dist/providers/typescript-family-accesses.js +27 -0
- package/dist/providers/typescript-family-accesses.js.map +1 -0
- package/dist/providers/typescript.d.ts +9 -0
- package/dist/providers/typescript.d.ts.map +1 -0
- package/dist/providers/typescript.js +84 -0
- package/dist/providers/typescript.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JaCoCo XML parser.
|
|
3
|
+
*
|
|
4
|
+
* JaCoCo's XML report tree:
|
|
5
|
+
* <report>
|
|
6
|
+
* <package name="com/foo">
|
|
7
|
+
* <sourcefile name="Bar.java">
|
|
8
|
+
* <line nr="12" mi="0" ci="3" mb="0" cb="0"/>
|
|
9
|
+
* ...
|
|
10
|
+
* </sourcefile>
|
|
11
|
+
*
|
|
12
|
+
* Per the JaCoCo DTD, `mi` is missed-instructions, `ci` is covered-
|
|
13
|
+
* instructions. We treat a line as covered when `ci > 0`. Total is the
|
|
14
|
+
* count of `<line>` elements for the sourcefile.
|
|
15
|
+
*
|
|
16
|
+
* Path assembly: the JaCoCo `name` attribute on `<package>` is slash-joined
|
|
17
|
+
* (e.g. `com/foo`), and the `<sourcefile>` name is the basename. We join
|
|
18
|
+
* them into a single POSIX path for graph matching. Callers may additionally
|
|
19
|
+
* set a project-source-root prefix via `options.sourceRoot` so the returned
|
|
20
|
+
* path aligns with the scan output.
|
|
21
|
+
*/
|
|
22
|
+
import { XMLParser } from "fast-xml-parser";
|
|
23
|
+
import { canonLines, ratio } from "./types.js";
|
|
24
|
+
export function parseJacoco(raw, _repoRoot, options = {}) {
|
|
25
|
+
const parser = new XMLParser({
|
|
26
|
+
ignoreAttributes: false,
|
|
27
|
+
attributeNamePrefix: "@_",
|
|
28
|
+
isArray: (name) => name === "package" || name === "sourcefile" || name === "line",
|
|
29
|
+
});
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = parser.parse(raw);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return new Map();
|
|
36
|
+
}
|
|
37
|
+
const out = new Map();
|
|
38
|
+
const report = parsed?.report;
|
|
39
|
+
const packages = report?.package;
|
|
40
|
+
if (!Array.isArray(packages))
|
|
41
|
+
return out;
|
|
42
|
+
const sourceRoot = options.sourceRoot ?? "";
|
|
43
|
+
for (const pkg of packages) {
|
|
44
|
+
const pkgName = typeof pkg["@_name"] === "string"
|
|
45
|
+
? String(pkg["@_name"])
|
|
46
|
+
: "";
|
|
47
|
+
const sourcefiles = pkg?.sourcefile;
|
|
48
|
+
if (!Array.isArray(sourcefiles))
|
|
49
|
+
continue;
|
|
50
|
+
for (const sf of sourcefiles) {
|
|
51
|
+
const sfName = sf["@_name"];
|
|
52
|
+
if (typeof sfName !== "string" || sfName.length === 0)
|
|
53
|
+
continue;
|
|
54
|
+
const lines = sf?.line;
|
|
55
|
+
if (!Array.isArray(lines) || lines.length === 0)
|
|
56
|
+
continue;
|
|
57
|
+
let covered = 0;
|
|
58
|
+
const coveredLines = [];
|
|
59
|
+
let total = 0;
|
|
60
|
+
for (const l of lines) {
|
|
61
|
+
const rec = l;
|
|
62
|
+
const nr = numberAttr(rec["@_nr"]);
|
|
63
|
+
const ci = numberAttr(rec["@_ci"]) ?? 0;
|
|
64
|
+
if (nr === undefined)
|
|
65
|
+
continue;
|
|
66
|
+
total += 1;
|
|
67
|
+
if (ci > 0) {
|
|
68
|
+
covered += 1;
|
|
69
|
+
coveredLines.push(nr);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (total === 0)
|
|
73
|
+
continue;
|
|
74
|
+
const relPath = joinPath(sourceRoot, pkgName, sfName);
|
|
75
|
+
out.set(relPath, {
|
|
76
|
+
filePath: relPath,
|
|
77
|
+
coveredLines: canonLines(coveredLines),
|
|
78
|
+
totalLines: total,
|
|
79
|
+
coveragePercent: ratio(covered, total),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
function numberAttr(v) {
|
|
86
|
+
if (typeof v === "number")
|
|
87
|
+
return Number.isFinite(v) ? v : undefined;
|
|
88
|
+
if (typeof v === "string") {
|
|
89
|
+
const n = Number.parseInt(v, 10);
|
|
90
|
+
return Number.isInteger(n) ? n : undefined;
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
function joinPath(root, pkg, file) {
|
|
95
|
+
const segs = [root, pkg, file].filter((s) => s.length > 0);
|
|
96
|
+
return segs.join("/").replace(/\/+/g, "/");
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=jacoco.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jacoco.js","sourceRoot":"","sources":["../../../../src/pipeline/phases/coverage-parsers/jacoco.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAqB,KAAK,EAAE,MAAM,YAAY,CAAC;AAWlE,MAAM,UAAU,WAAW,CACzB,GAAW,EACX,SAAiB,EACjB,UAAyB,EAAE;IAE3B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,IAAI;QACzB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,MAAM;KAClF,CA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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW,EAAE,IAAY;IACvD,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lcov.info parser.
|
|
3
|
+
*
|
|
4
|
+
* lcov trace files are newline-delimited records grouped into per-file blocks:
|
|
5
|
+
* SF:<source file path>
|
|
6
|
+
* DA:<line>,<hit count>[,<md5>]
|
|
7
|
+
* ...
|
|
8
|
+
* end_of_record
|
|
9
|
+
*
|
|
10
|
+
* A file's covered-lines set is every DA line whose hit count > 0. We ignore
|
|
11
|
+
* the optional line-hash trailing field because it is irrelevant to the
|
|
12
|
+
* coverage ratio.
|
|
13
|
+
*
|
|
14
|
+
* Path resolution: lcov records may carry either relative or absolute paths.
|
|
15
|
+
* When the path is absolute and starts with `repoRoot`, we strip the prefix
|
|
16
|
+
* so the phase can match against scan output (repo-relative POSIX paths).
|
|
17
|
+
* Otherwise we pass the path through unchanged.
|
|
18
|
+
*/
|
|
19
|
+
import { type FileCoverage } from "./types.js";
|
|
20
|
+
export declare function parseLcov(raw: string, repoRoot: string): ReadonlyMap<string, FileCoverage>;
|
|
21
|
+
//# sourceMappingURL=lcov.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcov.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/phases/coverage-parsers/lcov.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAc,KAAK,YAAY,EAAS,MAAM,YAAY,CAAC;AAElE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAsE1F"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lcov.info parser.
|
|
3
|
+
*
|
|
4
|
+
* lcov trace files are newline-delimited records grouped into per-file blocks:
|
|
5
|
+
* SF:<source file path>
|
|
6
|
+
* DA:<line>,<hit count>[,<md5>]
|
|
7
|
+
* ...
|
|
8
|
+
* end_of_record
|
|
9
|
+
*
|
|
10
|
+
* A file's covered-lines set is every DA line whose hit count > 0. We ignore
|
|
11
|
+
* the optional line-hash trailing field because it is irrelevant to the
|
|
12
|
+
* coverage ratio.
|
|
13
|
+
*
|
|
14
|
+
* Path resolution: lcov records may carry either relative or absolute paths.
|
|
15
|
+
* When the path is absolute and starts with `repoRoot`, we strip the prefix
|
|
16
|
+
* so the phase can match against scan output (repo-relative POSIX paths).
|
|
17
|
+
* Otherwise we pass the path through unchanged.
|
|
18
|
+
*/
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import { canonLines, ratio } from "./types.js";
|
|
21
|
+
export function parseLcov(raw, repoRoot) {
|
|
22
|
+
const out = new Map();
|
|
23
|
+
let currentFile;
|
|
24
|
+
let covered = 0;
|
|
25
|
+
let total = 0;
|
|
26
|
+
let lines = [];
|
|
27
|
+
const reset = () => {
|
|
28
|
+
currentFile = undefined;
|
|
29
|
+
covered = 0;
|
|
30
|
+
total = 0;
|
|
31
|
+
lines = [];
|
|
32
|
+
};
|
|
33
|
+
for (const rawLine of raw.split(/\r?\n/)) {
|
|
34
|
+
const line = rawLine.trim();
|
|
35
|
+
if (line.length === 0)
|
|
36
|
+
continue;
|
|
37
|
+
if (line.startsWith("SF:")) {
|
|
38
|
+
currentFile = normalisePath(line.slice(3).trim(), repoRoot);
|
|
39
|
+
covered = 0;
|
|
40
|
+
total = 0;
|
|
41
|
+
lines = [];
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (line.startsWith("DA:")) {
|
|
45
|
+
if (currentFile === undefined)
|
|
46
|
+
continue;
|
|
47
|
+
const rest = line.slice(3);
|
|
48
|
+
const comma = rest.indexOf(",");
|
|
49
|
+
if (comma === -1)
|
|
50
|
+
continue;
|
|
51
|
+
const lineNum = Number.parseInt(rest.slice(0, comma), 10);
|
|
52
|
+
// Hit count may be followed by an extra `,md5`. Parse only up to the
|
|
53
|
+
// next comma or end-of-line.
|
|
54
|
+
const tail = rest.slice(comma + 1);
|
|
55
|
+
const nextComma = tail.indexOf(",");
|
|
56
|
+
const hitStr = nextComma === -1 ? tail : tail.slice(0, nextComma);
|
|
57
|
+
const hits = Number.parseInt(hitStr, 10);
|
|
58
|
+
if (!Number.isInteger(lineNum) || !Number.isInteger(hits))
|
|
59
|
+
continue;
|
|
60
|
+
total += 1;
|
|
61
|
+
if (hits > 0) {
|
|
62
|
+
covered += 1;
|
|
63
|
+
lines.push(lineNum);
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (line === "end_of_record") {
|
|
68
|
+
if (currentFile !== undefined && total > 0) {
|
|
69
|
+
const clean = canonLines(lines);
|
|
70
|
+
out.set(currentFile, {
|
|
71
|
+
filePath: currentFile,
|
|
72
|
+
coveredLines: clean,
|
|
73
|
+
totalLines: total,
|
|
74
|
+
coveragePercent: ratio(covered, total),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
reset();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Trailing block without `end_of_record` still matters — flush it.
|
|
81
|
+
if (currentFile !== undefined && total > 0) {
|
|
82
|
+
const clean = canonLines(lines);
|
|
83
|
+
out.set(currentFile, {
|
|
84
|
+
filePath: currentFile,
|
|
85
|
+
coveredLines: clean,
|
|
86
|
+
totalLines: total,
|
|
87
|
+
coveragePercent: ratio(covered, total),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
function normalisePath(raw, repoRoot) {
|
|
93
|
+
// Always emit POSIX forward slashes so downstream matching against scan
|
|
94
|
+
// output (which uses POSIX separators) works on every platform.
|
|
95
|
+
const posix = raw.replace(/\\/g, "/");
|
|
96
|
+
if (!path.isAbsolute(posix))
|
|
97
|
+
return posix;
|
|
98
|
+
const rootPosix = repoRoot.replace(/\\/g, "/");
|
|
99
|
+
const prefix = rootPosix.endsWith("/") ? rootPosix : `${rootPosix}/`;
|
|
100
|
+
if (posix.startsWith(prefix))
|
|
101
|
+
return posix.slice(prefix.length);
|
|
102
|
+
return posix;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=lcov.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcov.js","sourceRoot":"","sources":["../../../../src/pipeline/phases/coverage-parsers/lcov.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAqB,KAAK,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,QAAgB;IACrD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC5C,IAAI,WAA+B,CAAC;IACpC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAa,EAAE,CAAC;IAEzB,MAAM,KAAK,GAAG,GAAS,EAAE;QACvB,WAAW,GAAG,SAAS,CAAC;QACxB,OAAO,GAAG,CAAC,CAAC;QACZ,KAAK,GAAG,CAAC,CAAC;QACV,KAAK,GAAG,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,KAAK,CA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IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC;IACrE,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared coverage-parser contract.
|
|
3
|
+
*
|
|
4
|
+
* Every format-specific parser ingests a raw payload (plus the repo root,
|
|
5
|
+
* which the parser may need to resolve absolute → relative paths) and
|
|
6
|
+
* returns a map keyed by repo-relative POSIX file path. `FileCoverage`
|
|
7
|
+
* carries the minimal information needed to populate
|
|
8
|
+
* `FileNode.coveragePercent` + `FileNode.coveredLines` downstream.
|
|
9
|
+
*
|
|
10
|
+
* Invariants the phase relies on:
|
|
11
|
+
* - `coveredLines` is sorted ascending with duplicates removed.
|
|
12
|
+
* - `totalLines` is the count of instrumented lines (hit or miss), NOT
|
|
13
|
+
* the file's raw line count — a partial-coverage report must still
|
|
14
|
+
* compute a sensible ratio.
|
|
15
|
+
* - `coveragePercent` is in `[0, 1]`. Parsers are free to return their
|
|
16
|
+
* own ratio; the phase validates + clamps before writing to the graph.
|
|
17
|
+
*/
|
|
18
|
+
export interface FileCoverage {
|
|
19
|
+
readonly filePath: string;
|
|
20
|
+
readonly coveredLines: readonly number[];
|
|
21
|
+
readonly totalLines: number;
|
|
22
|
+
readonly coveragePercent: number;
|
|
23
|
+
}
|
|
24
|
+
/** Sort ascending + dedupe. Used by every parser before construction. */
|
|
25
|
+
export declare function canonLines(raw: readonly number[]): readonly number[];
|
|
26
|
+
export declare function ratio(covered: number, total: number): number;
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/phases/coverage-parsers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CAMpE;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAO5D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared coverage-parser contract.
|
|
3
|
+
*
|
|
4
|
+
* Every format-specific parser ingests a raw payload (plus the repo root,
|
|
5
|
+
* which the parser may need to resolve absolute → relative paths) and
|
|
6
|
+
* returns a map keyed by repo-relative POSIX file path. `FileCoverage`
|
|
7
|
+
* carries the minimal information needed to populate
|
|
8
|
+
* `FileNode.coveragePercent` + `FileNode.coveredLines` downstream.
|
|
9
|
+
*
|
|
10
|
+
* Invariants the phase relies on:
|
|
11
|
+
* - `coveredLines` is sorted ascending with duplicates removed.
|
|
12
|
+
* - `totalLines` is the count of instrumented lines (hit or miss), NOT
|
|
13
|
+
* the file's raw line count — a partial-coverage report must still
|
|
14
|
+
* compute a sensible ratio.
|
|
15
|
+
* - `coveragePercent` is in `[0, 1]`. Parsers are free to return their
|
|
16
|
+
* own ratio; the phase validates + clamps before writing to the graph.
|
|
17
|
+
*/
|
|
18
|
+
/** Sort ascending + dedupe. Used by every parser before construction. */
|
|
19
|
+
export function canonLines(raw) {
|
|
20
|
+
const seen = new Set();
|
|
21
|
+
for (const n of raw) {
|
|
22
|
+
if (Number.isInteger(n) && n > 0)
|
|
23
|
+
seen.add(n);
|
|
24
|
+
}
|
|
25
|
+
return [...seen].sort((a, b) => a - b);
|
|
26
|
+
}
|
|
27
|
+
export function ratio(covered, total) {
|
|
28
|
+
if (total <= 0)
|
|
29
|
+
return 0;
|
|
30
|
+
const r = covered / total;
|
|
31
|
+
if (!Number.isFinite(r))
|
|
32
|
+
return 0;
|
|
33
|
+
if (r < 0)
|
|
34
|
+
return 0;
|
|
35
|
+
if (r > 1)
|
|
36
|
+
return 1;
|
|
37
|
+
return r;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/pipeline/phases/coverage-parsers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,yEAAyE;AACzE,MAAM,UAAU,UAAU,CAAC,GAAsB;IAC/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QACpB,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,KAAa;IAClD,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACzB,MAAM,CAAC,GAAG,OAAO,GAAG,KAAK,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpB,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coverage overlay phase.
|
|
3
|
+
*
|
|
4
|
+
* Consumes a coverage report produced by an external test runner and
|
|
5
|
+
* annotates each `File` node with:
|
|
6
|
+
* - `coveragePercent` — covered / total, clamped to [0, 1].
|
|
7
|
+
* - `coveredLines` — sorted, deduped list of covered 1-based line
|
|
8
|
+
* numbers.
|
|
9
|
+
*
|
|
10
|
+
* Format auto-detection looks at a fixed set of well-known paths (in
|
|
11
|
+
* priority order):
|
|
12
|
+
* 1. `coverage/lcov.info` → lcov.
|
|
13
|
+
* 2. `lcov.info` → lcov.
|
|
14
|
+
* 3. `coverage.xml` → cobertura.
|
|
15
|
+
* 4. `build/reports/jacoco/test/jacocoTestReport.xml` → jacoco.
|
|
16
|
+
* 5. `coverage.json` → coverage.py.
|
|
17
|
+
*
|
|
18
|
+
* The phase is a silent no-op unless `options.coverage === true`; runs after
|
|
19
|
+
* `scan` and `profile` so a later framework-aware detection tier can refine
|
|
20
|
+
* search paths per-language if needed (e.g. pytest vs Jest).
|
|
21
|
+
*
|
|
22
|
+
* Failure posture: parse errors and missing reports log a warning via
|
|
23
|
+
* `ctx.onProgress` and still return a zero-result envelope — coverage is an
|
|
24
|
+
* optional overlay and must never crash analyze.
|
|
25
|
+
*/
|
|
26
|
+
import type { PipelinePhase } from "../types.js";
|
|
27
|
+
export declare const COVERAGE_PHASE_NAME: "coverage";
|
|
28
|
+
export type CoverageFormat = "lcov" | "cobertura" | "jacoco" | "coverage-py";
|
|
29
|
+
export interface CoverageOutput {
|
|
30
|
+
readonly ran: boolean;
|
|
31
|
+
readonly format?: CoverageFormat;
|
|
32
|
+
readonly reportPath?: string;
|
|
33
|
+
/** Count of File nodes that received a coverage annotation. */
|
|
34
|
+
readonly annotatedFileCount: number;
|
|
35
|
+
/** Count of entries in the report that did not match any File node. */
|
|
36
|
+
readonly unmatchedFileCount: number;
|
|
37
|
+
}
|
|
38
|
+
export declare const coveragePhase: PipelinePhase<CoverageOutput>;
|
|
39
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAUlE,eAAO,MAAM,mBAAmB,EAAG,UAAmB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE7E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACrC;AAcD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,cAAc,CASvD,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coverage overlay phase.
|
|
3
|
+
*
|
|
4
|
+
* Consumes a coverage report produced by an external test runner and
|
|
5
|
+
* annotates each `File` node with:
|
|
6
|
+
* - `coveragePercent` — covered / total, clamped to [0, 1].
|
|
7
|
+
* - `coveredLines` — sorted, deduped list of covered 1-based line
|
|
8
|
+
* numbers.
|
|
9
|
+
*
|
|
10
|
+
* Format auto-detection looks at a fixed set of well-known paths (in
|
|
11
|
+
* priority order):
|
|
12
|
+
* 1. `coverage/lcov.info` → lcov.
|
|
13
|
+
* 2. `lcov.info` → lcov.
|
|
14
|
+
* 3. `coverage.xml` → cobertura.
|
|
15
|
+
* 4. `build/reports/jacoco/test/jacocoTestReport.xml` → jacoco.
|
|
16
|
+
* 5. `coverage.json` → coverage.py.
|
|
17
|
+
*
|
|
18
|
+
* The phase is a silent no-op unless `options.coverage === true`; runs after
|
|
19
|
+
* `scan` and `profile` so a later framework-aware detection tier can refine
|
|
20
|
+
* search paths per-language if needed (e.g. pytest vs Jest).
|
|
21
|
+
*
|
|
22
|
+
* Failure posture: parse errors and missing reports log a warning via
|
|
23
|
+
* `ctx.onProgress` and still return a zero-result envelope — coverage is an
|
|
24
|
+
* optional overlay and must never crash analyze.
|
|
25
|
+
*/
|
|
26
|
+
import { promises as fs } from "node:fs";
|
|
27
|
+
import path from "node:path";
|
|
28
|
+
import { parseCobertura } from "./coverage-parsers/cobertura.js";
|
|
29
|
+
import { parseCoveragePy } from "./coverage-parsers/coverage-py.js";
|
|
30
|
+
import { parseJacoco } from "./coverage-parsers/jacoco.js";
|
|
31
|
+
import { parseLcov } from "./coverage-parsers/lcov.js";
|
|
32
|
+
import { PROFILE_PHASE_NAME } from "./profile.js";
|
|
33
|
+
import { SCAN_PHASE_NAME } from "./scan.js";
|
|
34
|
+
import { STRUCTURE_PHASE_NAME } from "./structure.js";
|
|
35
|
+
export const COVERAGE_PHASE_NAME = "coverage";
|
|
36
|
+
/**
|
|
37
|
+
* Detection table, sorted by priority. Each entry names the on-disk probe
|
|
38
|
+
* path (relative to repoPath) plus its dispatch identifier.
|
|
39
|
+
*/
|
|
40
|
+
const CANDIDATES = [
|
|
41
|
+
{ rel: "coverage/lcov.info", format: "lcov" },
|
|
42
|
+
{ rel: "lcov.info", format: "lcov" },
|
|
43
|
+
{ rel: "coverage.xml", format: "cobertura" },
|
|
44
|
+
{ rel: "build/reports/jacoco/test/jacocoTestReport.xml", format: "jacoco" },
|
|
45
|
+
{ rel: "coverage.json", format: "coverage-py" },
|
|
46
|
+
];
|
|
47
|
+
export const coveragePhase = {
|
|
48
|
+
name: COVERAGE_PHASE_NAME,
|
|
49
|
+
deps: [SCAN_PHASE_NAME, PROFILE_PHASE_NAME, STRUCTURE_PHASE_NAME],
|
|
50
|
+
async run(ctx) {
|
|
51
|
+
if (ctx.options.coverage !== true) {
|
|
52
|
+
return { ran: false, annotatedFileCount: 0, unmatchedFileCount: 0 };
|
|
53
|
+
}
|
|
54
|
+
return runCoverage(ctx);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
async function runCoverage(ctx) {
|
|
58
|
+
const detected = await detectReport(ctx.repoPath);
|
|
59
|
+
if (detected === undefined) {
|
|
60
|
+
ctx.onProgress?.({
|
|
61
|
+
phase: COVERAGE_PHASE_NAME,
|
|
62
|
+
kind: "warn",
|
|
63
|
+
message: "coverage: enabled but no report found (looked for coverage/lcov.info, lcov.info, coverage.xml, build/reports/jacoco/test/jacocoTestReport.xml, coverage.json)",
|
|
64
|
+
});
|
|
65
|
+
return { ran: true, annotatedFileCount: 0, unmatchedFileCount: 0 };
|
|
66
|
+
}
|
|
67
|
+
let raw;
|
|
68
|
+
try {
|
|
69
|
+
raw = await fs.readFile(detected.absPath, "utf8");
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
ctx.onProgress?.({
|
|
73
|
+
phase: COVERAGE_PHASE_NAME,
|
|
74
|
+
kind: "warn",
|
|
75
|
+
message: `coverage: failed to read ${detected.relPath}: ${err.message}`,
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
ran: true,
|
|
79
|
+
format: detected.format,
|
|
80
|
+
reportPath: detected.relPath,
|
|
81
|
+
annotatedFileCount: 0,
|
|
82
|
+
unmatchedFileCount: 0,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const parsed = dispatchParser(detected.format, raw, ctx.repoPath);
|
|
86
|
+
// Apply parsed coverage to matching File nodes. Track both sides so
|
|
87
|
+
// operators can surface mismatches (e.g. path-root drift in jacoco reports).
|
|
88
|
+
const fileNodesByPath = new Map();
|
|
89
|
+
for (const n of ctx.graph.nodes()) {
|
|
90
|
+
if (n.kind === "File")
|
|
91
|
+
fileNodesByPath.set(n.filePath, n);
|
|
92
|
+
}
|
|
93
|
+
let annotated = 0;
|
|
94
|
+
let unmatched = 0;
|
|
95
|
+
// Sort by path so graph mutation order stays deterministic.
|
|
96
|
+
const sortedPaths = [...parsed.keys()].sort();
|
|
97
|
+
for (const filePath of sortedPaths) {
|
|
98
|
+
const cov = parsed.get(filePath);
|
|
99
|
+
if (cov === undefined)
|
|
100
|
+
continue;
|
|
101
|
+
const fileNode = fileNodesByPath.get(filePath);
|
|
102
|
+
if (fileNode === undefined) {
|
|
103
|
+
unmatched += 1;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const merged = {
|
|
107
|
+
...fileNode,
|
|
108
|
+
coveragePercent: cov.coveragePercent,
|
|
109
|
+
coveredLines: cov.coveredLines,
|
|
110
|
+
};
|
|
111
|
+
ctx.graph.addNode(merged);
|
|
112
|
+
annotated += 1;
|
|
113
|
+
}
|
|
114
|
+
ctx.onProgress?.({
|
|
115
|
+
phase: COVERAGE_PHASE_NAME,
|
|
116
|
+
kind: "note",
|
|
117
|
+
message: `coverage: ${detected.format} report → ${annotated} files annotated, ${unmatched} unmatched`,
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
ran: true,
|
|
121
|
+
format: detected.format,
|
|
122
|
+
reportPath: detected.relPath,
|
|
123
|
+
annotatedFileCount: annotated,
|
|
124
|
+
unmatchedFileCount: unmatched,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
async function detectReport(repoRoot) {
|
|
128
|
+
for (const cand of CANDIDATES) {
|
|
129
|
+
const abs = path.join(repoRoot, cand.rel);
|
|
130
|
+
try {
|
|
131
|
+
const stat = await fs.stat(abs);
|
|
132
|
+
if (stat.isFile()) {
|
|
133
|
+
return { format: cand.format, absPath: abs, relPath: cand.rel };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Missing file — try next candidate.
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
function dispatchParser(format, raw, repoRoot) {
|
|
143
|
+
switch (format) {
|
|
144
|
+
case "lcov":
|
|
145
|
+
return parseLcov(raw, repoRoot);
|
|
146
|
+
case "cobertura":
|
|
147
|
+
return parseCobertura(raw, repoRoot);
|
|
148
|
+
case "jacoco":
|
|
149
|
+
return parseJacoco(raw, repoRoot);
|
|
150
|
+
case "coverage-py":
|
|
151
|
+
return parseCoveragePy(raw, repoRoot);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../../src/pipeline/phases/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,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CAAC;QAAC,MAAM,CAAC;YACP,qCAAqC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CACrB,MAAsB,EACtB,GAAW,EACX,QAAgB;IAEhB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClC,KAAK,WAAW;YACd,OAAO,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACvC,KAAK,QAAQ;YACX,OAAO,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACpC,KAAK,aAAa;YAChB,OAAO,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-file phase — upgrade low-confidence CALLS edges after every file
|
|
3
|
+
* has contributed its exports.
|
|
4
|
+
*
|
|
5
|
+
* At parse time every call site is resolved through the three-tier
|
|
6
|
+
* {@link resolve} helper (same-file → import-scoped → global). A call that
|
|
7
|
+
* only matches at the global tier is emitted with confidence 0.5 because we
|
|
8
|
+
* cannot prove which declaration the call targets. Once the whole repo has
|
|
9
|
+
* been parsed we can do better: if the caller file imports a module that
|
|
10
|
+
* now exports a matching identifier, the call is *import-scoped* in
|
|
11
|
+
* hindsight and deserves confidence 0.9.
|
|
12
|
+
*
|
|
13
|
+
* Strategy:
|
|
14
|
+
* 1. Build a directed import graph of repository files (skip external npm
|
|
15
|
+
* specifiers — they were already dropped at parse time).
|
|
16
|
+
* 2. Run Tarjan's SCC algorithm on that graph. Circular imports collapse
|
|
17
|
+
* into a single component; we still visit every file in a component.
|
|
18
|
+
* 3. Topologically sort the condensation so dependencies of file F are
|
|
19
|
+
* processed before F. Inside a component, order by filename for
|
|
20
|
+
* determinism.
|
|
21
|
+
* 4. For each file, walk every low-confidence (0.5) CALLS edge. Re-run
|
|
22
|
+
* the resolution strategy with the symbol index. If it now produces a
|
|
23
|
+
* higher-tier candidate, re-add the edge with the better confidence;
|
|
24
|
+
* the graph's dedupe keeps the stronger edge.
|
|
25
|
+
*
|
|
26
|
+
* Determinism: SCC discovery order is driven by sorted file iteration, and
|
|
27
|
+
* condensation order is produced by Kahn's algorithm with a lexical tie
|
|
28
|
+
* break. Two runs on the same repo produce identical edge upgrades.
|
|
29
|
+
*/
|
|
30
|
+
import type { PipelinePhase } from "../types.js";
|
|
31
|
+
export declare const CROSS_FILE_PHASE_NAME = "crossFile";
|
|
32
|
+
export interface CrossFileOutput {
|
|
33
|
+
readonly upgradedCallsCount: number;
|
|
34
|
+
readonly unresolvedRemaining: number;
|
|
35
|
+
readonly sccCount: number;
|
|
36
|
+
/** File SCCs with more than five members — typically cyclic import webs. */
|
|
37
|
+
readonly largeSccs: readonly string[];
|
|
38
|
+
}
|
|
39
|
+
export declare const crossFilePhase: PipelinePhase<CrossFileOutput>;
|
|
40
|
+
//# sourceMappingURL=cross-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-file.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/cross-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AASH,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAYlE,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,eAAe,CAgBzD,CAAC"}
|