driftdetect-core 0.4.5 → 0.5.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/dist/boundaries/boundary-scanner.d.ts.map +1 -1
- package/dist/boundaries/boundary-scanner.js +184 -18
- package/dist/boundaries/boundary-scanner.js.map +1 -1
- package/dist/boundaries/types.d.ts +34 -2
- package/dist/boundaries/types.d.ts.map +1 -1
- package/dist/call-graph/analysis/graph-builder.d.ts +3 -0
- package/dist/call-graph/analysis/graph-builder.d.ts.map +1 -1
- package/dist/call-graph/analysis/graph-builder.js +81 -18
- package/dist/call-graph/analysis/graph-builder.js.map +1 -1
- package/dist/call-graph/extractors/csharp-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/csharp-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/csharp-data-access-extractor.js +18 -5
- package/dist/call-graph/extractors/csharp-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/csharp-extractor.d.ts +35 -0
- package/dist/call-graph/extractors/csharp-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/csharp-extractor.js +362 -4
- package/dist/call-graph/extractors/csharp-extractor.js.map +1 -1
- package/dist/call-graph/extractors/csharp-hybrid-extractor.d.ts +37 -0
- package/dist/call-graph/extractors/csharp-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/csharp-hybrid-extractor.js +408 -0
- package/dist/call-graph/extractors/csharp-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/data-access-extractor.d.ts +16 -2
- package/dist/call-graph/extractors/data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/data-access-extractor.js +114 -5
- package/dist/call-graph/extractors/data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/hybrid-extractor-base.d.ts +102 -0
- package/dist/call-graph/extractors/hybrid-extractor-base.d.ts.map +1 -0
- package/dist/call-graph/extractors/hybrid-extractor-base.js +289 -0
- package/dist/call-graph/extractors/hybrid-extractor-base.js.map +1 -0
- package/dist/call-graph/extractors/index.d.ts +17 -13
- package/dist/call-graph/extractors/index.d.ts.map +1 -1
- package/dist/call-graph/extractors/index.js +24 -23
- package/dist/call-graph/extractors/index.js.map +1 -1
- package/dist/call-graph/extractors/java-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/java-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/java-data-access-extractor.js +20 -6
- package/dist/call-graph/extractors/java-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/java-extractor.d.ts +15 -0
- package/dist/call-graph/extractors/java-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/java-extractor.js +120 -4
- package/dist/call-graph/extractors/java-extractor.js.map +1 -1
- package/dist/call-graph/extractors/java-hybrid-extractor.d.ts +36 -0
- package/dist/call-graph/extractors/java-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/java-hybrid-extractor.js +426 -0
- package/dist/call-graph/extractors/java-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/php-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/php-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/php-data-access-extractor.js +20 -6
- package/dist/call-graph/extractors/php-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/php-extractor.d.ts +48 -1
- package/dist/call-graph/extractors/php-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/php-extractor.js +460 -6
- package/dist/call-graph/extractors/php-extractor.js.map +1 -1
- package/dist/call-graph/extractors/php-hybrid-extractor.d.ts +35 -0
- package/dist/call-graph/extractors/php-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/php-hybrid-extractor.js +393 -0
- package/dist/call-graph/extractors/php-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/python-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/python-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/python-data-access-extractor.js +20 -6
- package/dist/call-graph/extractors/python-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/python-hybrid-extractor.d.ts +85 -0
- package/dist/call-graph/extractors/python-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/python-hybrid-extractor.js +462 -0
- package/dist/call-graph/extractors/python-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.d.ts +154 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.js +346 -0
- package/dist/call-graph/extractors/regex/base-regex-extractor.js.map +1 -0
- package/dist/call-graph/extractors/regex/csharp-regex.d.ts +34 -0
- package/dist/call-graph/extractors/regex/csharp-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/csharp-regex.js +393 -0
- package/dist/call-graph/extractors/regex/csharp-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/index.d.ts +25 -0
- package/dist/call-graph/extractors/regex/index.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/index.js +66 -0
- package/dist/call-graph/extractors/regex/index.js.map +1 -0
- package/dist/call-graph/extractors/regex/java-regex.d.ts +34 -0
- package/dist/call-graph/extractors/regex/java-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/java-regex.js +327 -0
- package/dist/call-graph/extractors/regex/java-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/php-regex.d.ts +30 -0
- package/dist/call-graph/extractors/regex/php-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/php-regex.js +333 -0
- package/dist/call-graph/extractors/regex/php-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/python-regex.d.ts +46 -0
- package/dist/call-graph/extractors/regex/python-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/python-regex.js +380 -0
- package/dist/call-graph/extractors/regex/python-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/typescript-regex.d.ts +27 -0
- package/dist/call-graph/extractors/regex/typescript-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/typescript-regex.js +349 -0
- package/dist/call-graph/extractors/regex/typescript-regex.js.map +1 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts +11 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts.map +1 -1
- package/dist/call-graph/extractors/semantic-data-access-scanner.js +53 -2
- package/dist/call-graph/extractors/semantic-data-access-scanner.js.map +1 -1
- package/dist/call-graph/extractors/types.d.ts +111 -0
- package/dist/call-graph/extractors/types.d.ts.map +1 -0
- package/dist/call-graph/extractors/types.js +68 -0
- package/dist/call-graph/extractors/types.js.map +1 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts +8 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts.map +1 -1
- package/dist/call-graph/extractors/typescript-data-access-extractor.js +31 -10
- package/dist/call-graph/extractors/typescript-data-access-extractor.js.map +1 -1
- package/dist/call-graph/extractors/typescript-hybrid-extractor.d.ts +116 -0
- package/dist/call-graph/extractors/typescript-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/typescript-hybrid-extractor.js +635 -0
- package/dist/call-graph/extractors/typescript-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/index.d.ts +2 -4
- package/dist/call-graph/index.d.ts.map +1 -1
- package/dist/call-graph/index.js +5 -6
- package/dist/call-graph/index.js.map +1 -1
- package/dist/error-handling/error-handling-analyzer.d.ts +73 -0
- package/dist/error-handling/error-handling-analyzer.d.ts.map +1 -0
- package/dist/error-handling/error-handling-analyzer.js +706 -0
- package/dist/error-handling/error-handling-analyzer.js.map +1 -0
- package/dist/error-handling/index.d.ts +8 -0
- package/dist/error-handling/index.d.ts.map +1 -0
- package/dist/error-handling/index.js +8 -0
- package/dist/error-handling/index.js.map +1 -0
- package/dist/error-handling/types.d.ts +307 -0
- package/dist/error-handling/types.d.ts.map +1 -0
- package/dist/error-handling/types.js +7 -0
- package/dist/error-handling/types.js.map +1 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -5
- package/dist/index.js.map +1 -1
- package/dist/lake/pattern-shard-store.d.ts +6 -0
- package/dist/lake/pattern-shard-store.d.ts.map +1 -1
- package/dist/lake/pattern-shard-store.js +6 -0
- package/dist/lake/pattern-shard-store.js.map +1 -1
- package/dist/language-intelligence/base-normalizer.d.ts +68 -0
- package/dist/language-intelligence/base-normalizer.d.ts.map +1 -0
- package/dist/language-intelligence/base-normalizer.js +210 -0
- package/dist/language-intelligence/base-normalizer.js.map +1 -0
- package/dist/language-intelligence/framework-registry.d.ts +89 -0
- package/dist/language-intelligence/framework-registry.d.ts.map +1 -0
- package/dist/language-intelligence/framework-registry.js +165 -0
- package/dist/language-intelligence/framework-registry.js.map +1 -0
- package/dist/language-intelligence/frameworks/aspnet.d.ts +11 -0
- package/dist/language-intelligence/frameworks/aspnet.d.ts.map +1 -0
- package/dist/language-intelligence/frameworks/aspnet.js +325 -0
- package/dist/language-intelligence/frameworks/aspnet.js.map +1 -0
- package/dist/language-intelligence/frameworks/fastapi.d.ts +11 -0
- package/dist/language-intelligence/frameworks/fastapi.d.ts.map +1 -0
- package/dist/language-intelligence/frameworks/fastapi.js +188 -0
- package/dist/language-intelligence/frameworks/fastapi.js.map +1 -0
- package/dist/language-intelligence/frameworks/index.d.ts +32 -0
- package/dist/language-intelligence/frameworks/index.d.ts.map +1 -0
- package/dist/language-intelligence/frameworks/index.js +51 -0
- package/dist/language-intelligence/frameworks/index.js.map +1 -0
- package/dist/language-intelligence/frameworks/laravel.d.ts +12 -0
- package/dist/language-intelligence/frameworks/laravel.d.ts.map +1 -0
- package/dist/language-intelligence/frameworks/laravel.js +194 -0
- package/dist/language-intelligence/frameworks/laravel.js.map +1 -0
- package/dist/language-intelligence/frameworks/nestjs.d.ts +11 -0
- package/dist/language-intelligence/frameworks/nestjs.d.ts.map +1 -0
- package/dist/language-intelligence/frameworks/nestjs.js +307 -0
- package/dist/language-intelligence/frameworks/nestjs.js.map +1 -0
- package/dist/language-intelligence/frameworks/spring.d.ts +11 -0
- package/dist/language-intelligence/frameworks/spring.d.ts.map +1 -0
- package/dist/language-intelligence/frameworks/spring.js +369 -0
- package/dist/language-intelligence/frameworks/spring.js.map +1 -0
- package/dist/language-intelligence/index.d.ts +33 -0
- package/dist/language-intelligence/index.d.ts.map +1 -0
- package/dist/language-intelligence/index.js +37 -0
- package/dist/language-intelligence/index.js.map +1 -0
- package/dist/language-intelligence/language-intelligence.d.ts +99 -0
- package/dist/language-intelligence/language-intelligence.d.ts.map +1 -0
- package/dist/language-intelligence/language-intelligence.js +239 -0
- package/dist/language-intelligence/language-intelligence.js.map +1 -0
- package/dist/language-intelligence/normalizers/csharp-normalizer.d.ts +39 -0
- package/dist/language-intelligence/normalizers/csharp-normalizer.d.ts.map +1 -0
- package/dist/language-intelligence/normalizers/csharp-normalizer.js +86 -0
- package/dist/language-intelligence/normalizers/csharp-normalizer.js.map +1 -0
- package/dist/language-intelligence/normalizers/index.d.ts +25 -0
- package/dist/language-intelligence/normalizers/index.d.ts.map +1 -0
- package/dist/language-intelligence/normalizers/index.js +60 -0
- package/dist/language-intelligence/normalizers/index.js.map +1 -0
- package/dist/language-intelligence/normalizers/java-normalizer.d.ts +39 -0
- package/dist/language-intelligence/normalizers/java-normalizer.d.ts.map +1 -0
- package/dist/language-intelligence/normalizers/java-normalizer.js +96 -0
- package/dist/language-intelligence/normalizers/java-normalizer.js.map +1 -0
- package/dist/language-intelligence/normalizers/php-normalizer.d.ts +39 -0
- package/dist/language-intelligence/normalizers/php-normalizer.d.ts.map +1 -0
- package/dist/language-intelligence/normalizers/php-normalizer.js +86 -0
- package/dist/language-intelligence/normalizers/php-normalizer.js.map +1 -0
- package/dist/language-intelligence/normalizers/python-normalizer.d.ts +39 -0
- package/dist/language-intelligence/normalizers/python-normalizer.d.ts.map +1 -0
- package/dist/language-intelligence/normalizers/python-normalizer.js +95 -0
- package/dist/language-intelligence/normalizers/python-normalizer.js.map +1 -0
- package/dist/language-intelligence/normalizers/typescript-normalizer.d.ts +39 -0
- package/dist/language-intelligence/normalizers/typescript-normalizer.d.ts.map +1 -0
- package/dist/language-intelligence/normalizers/typescript-normalizer.js +84 -0
- package/dist/language-intelligence/normalizers/typescript-normalizer.js.map +1 -0
- package/dist/language-intelligence/types.d.ts +270 -0
- package/dist/language-intelligence/types.d.ts.map +1 -0
- package/dist/language-intelligence/types.js +9 -0
- package/dist/language-intelligence/types.js.map +1 -0
- package/dist/module-coupling/coupling-analyzer.d.ts +73 -0
- package/dist/module-coupling/coupling-analyzer.d.ts.map +1 -0
- package/dist/module-coupling/coupling-analyzer.js +668 -0
- package/dist/module-coupling/coupling-analyzer.js.map +1 -0
- package/dist/module-coupling/index.d.ts +9 -0
- package/dist/module-coupling/index.d.ts.map +1 -0
- package/dist/module-coupling/index.js +9 -0
- package/dist/module-coupling/index.js.map +1 -0
- package/dist/module-coupling/types.d.ts +273 -0
- package/dist/module-coupling/types.d.ts.map +1 -0
- package/dist/module-coupling/types.js +8 -0
- package/dist/module-coupling/types.js.map +1 -0
- package/dist/patterns/adapters/index.d.ts +11 -0
- package/dist/patterns/adapters/index.d.ts.map +1 -0
- package/dist/patterns/adapters/index.js +11 -0
- package/dist/patterns/adapters/index.js.map +1 -0
- package/dist/patterns/adapters/pattern-store-adapter.d.ts +59 -0
- package/dist/patterns/adapters/pattern-store-adapter.d.ts.map +1 -0
- package/dist/patterns/adapters/pattern-store-adapter.js +468 -0
- package/dist/patterns/adapters/pattern-store-adapter.js.map +1 -0
- package/dist/patterns/adapters/service-factory.d.ts +40 -0
- package/dist/patterns/adapters/service-factory.d.ts.map +1 -0
- package/dist/patterns/adapters/service-factory.js +144 -0
- package/dist/patterns/adapters/service-factory.js.map +1 -0
- package/dist/patterns/errors.d.ts +32 -0
- package/dist/patterns/errors.d.ts.map +1 -0
- package/dist/patterns/errors.js +45 -0
- package/dist/patterns/errors.js.map +1 -0
- package/dist/patterns/impl/cached-repository.d.ts +79 -0
- package/dist/patterns/impl/cached-repository.d.ts.map +1 -0
- package/dist/patterns/impl/cached-repository.js +296 -0
- package/dist/patterns/impl/cached-repository.js.map +1 -0
- package/dist/patterns/impl/file-repository.d.ts +75 -0
- package/dist/patterns/impl/file-repository.d.ts.map +1 -0
- package/dist/patterns/impl/file-repository.js +507 -0
- package/dist/patterns/impl/file-repository.js.map +1 -0
- package/dist/patterns/impl/index.d.ts +16 -0
- package/dist/patterns/impl/index.d.ts.map +1 -0
- package/dist/patterns/impl/index.js +21 -0
- package/dist/patterns/impl/index.js.map +1 -0
- package/dist/patterns/impl/memory-repository.d.ts +56 -0
- package/dist/patterns/impl/memory-repository.d.ts.map +1 -0
- package/dist/patterns/impl/memory-repository.js +323 -0
- package/dist/patterns/impl/memory-repository.js.map +1 -0
- package/dist/patterns/impl/pattern-service.d.ts +52 -0
- package/dist/patterns/impl/pattern-service.d.ts.map +1 -0
- package/dist/patterns/impl/pattern-service.js +382 -0
- package/dist/patterns/impl/pattern-service.js.map +1 -0
- package/dist/patterns/impl/repository-factory.d.ts +44 -0
- package/dist/patterns/impl/repository-factory.d.ts.map +1 -0
- package/dist/patterns/impl/repository-factory.js +140 -0
- package/dist/patterns/impl/repository-factory.js.map +1 -0
- package/dist/patterns/impl/unified-file-repository.d.ts +111 -0
- package/dist/patterns/impl/unified-file-repository.d.ts.map +1 -0
- package/dist/patterns/impl/unified-file-repository.js +677 -0
- package/dist/patterns/impl/unified-file-repository.js.map +1 -0
- package/dist/patterns/index.d.ts +23 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +41 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/repository.d.ts +241 -0
- package/dist/patterns/repository.d.ts.map +1 -0
- package/dist/patterns/repository.js +23 -0
- package/dist/patterns/repository.js.map +1 -0
- package/dist/patterns/service.d.ts +245 -0
- package/dist/patterns/service.d.ts.map +1 -0
- package/dist/patterns/service.js +25 -0
- package/dist/patterns/service.js.map +1 -0
- package/dist/patterns/types.d.ts +227 -0
- package/dist/patterns/types.d.ts.map +1 -0
- package/dist/patterns/types.js +117 -0
- package/dist/patterns/types.js.map +1 -0
- package/dist/scanner/file-processor-worker.d.ts +66 -0
- package/dist/scanner/file-processor-worker.d.ts.map +1 -0
- package/dist/scanner/file-processor-worker.js +189 -0
- package/dist/scanner/file-processor-worker.js.map +1 -0
- package/dist/scanner/index.d.ts +2 -0
- package/dist/scanner/index.d.ts.map +1 -1
- package/dist/scanner/index.js +2 -0
- package/dist/scanner/index.js.map +1 -1
- package/dist/scanner/threaded-worker-pool.d.ts +182 -0
- package/dist/scanner/threaded-worker-pool.d.ts.map +1 -0
- package/dist/scanner/threaded-worker-pool.js +243 -0
- package/dist/scanner/threaded-worker-pool.js.map +1 -0
- package/dist/store/pattern-store.d.ts +6 -0
- package/dist/store/pattern-store.d.ts.map +1 -1
- package/dist/store/pattern-store.js +6 -0
- package/dist/store/pattern-store.js.map +1 -1
- package/dist/store/types.d.ts +6 -3
- package/dist/store/types.d.ts.map +1 -1
- package/dist/store/types.js.map +1 -1
- package/dist/test-topology/extractors/base-test-extractor.d.ts +89 -0
- package/dist/test-topology/extractors/base-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/base-test-extractor.js +187 -0
- package/dist/test-topology/extractors/base-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/csharp-test-extractor.d.ts +23 -0
- package/dist/test-topology/extractors/csharp-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/csharp-test-extractor.js +367 -0
- package/dist/test-topology/extractors/csharp-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/index.d.ts +12 -0
- package/dist/test-topology/extractors/index.d.ts.map +1 -0
- package/dist/test-topology/extractors/index.js +12 -0
- package/dist/test-topology/extractors/index.js.map +1 -0
- package/dist/test-topology/extractors/java-test-extractor.d.ts +20 -0
- package/dist/test-topology/extractors/java-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/java-test-extractor.js +275 -0
- package/dist/test-topology/extractors/java-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/php-test-extractor.d.ts +24 -0
- package/dist/test-topology/extractors/php-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/php-test-extractor.js +409 -0
- package/dist/test-topology/extractors/php-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/python-test-extractor.d.ts +23 -0
- package/dist/test-topology/extractors/python-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/python-test-extractor.js +342 -0
- package/dist/test-topology/extractors/python-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.d.ts +51 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.js +383 -0
- package/dist/test-topology/extractors/regex/csharp-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/index.d.ts +18 -0
- package/dist/test-topology/extractors/regex/index.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/index.js +43 -0
- package/dist/test-topology/extractors/regex/index.js.map +1 -0
- package/dist/test-topology/extractors/regex/java-test-regex.d.ts +50 -0
- package/dist/test-topology/extractors/regex/java-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/java-test-regex.js +370 -0
- package/dist/test-topology/extractors/regex/java-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/php-test-regex.d.ts +56 -0
- package/dist/test-topology/extractors/regex/php-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/php-test-regex.js +503 -0
- package/dist/test-topology/extractors/regex/php-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/python-test-regex.d.ts +57 -0
- package/dist/test-topology/extractors/regex/python-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/python-test-regex.js +381 -0
- package/dist/test-topology/extractors/regex/python-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.d.ts +60 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.js +368 -0
- package/dist/test-topology/extractors/regex/typescript-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/typescript-test-extractor.d.ts +24 -0
- package/dist/test-topology/extractors/typescript-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/typescript-test-extractor.js +266 -0
- package/dist/test-topology/extractors/typescript-test-extractor.js.map +1 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.d.ts +98 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.d.ts.map +1 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.js +555 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.js.map +1 -0
- package/dist/test-topology/index.d.ts +16 -0
- package/dist/test-topology/index.d.ts.map +1 -0
- package/dist/test-topology/index.js +19 -0
- package/dist/test-topology/index.js.map +1 -0
- package/dist/test-topology/test-topology-analyzer.d.ts +85 -0
- package/dist/test-topology/test-topology-analyzer.d.ts.map +1 -0
- package/dist/test-topology/test-topology-analyzer.js +538 -0
- package/dist/test-topology/test-topology-analyzer.js.map +1 -0
- package/dist/test-topology/types.d.ts +300 -0
- package/dist/test-topology/types.d.ts.map +1 -0
- package/dist/test-topology/types.js +7 -0
- package/dist/test-topology/types.js.map +1 -0
- package/dist/unified-provider/compat/index.d.ts +11 -0
- package/dist/unified-provider/compat/index.d.ts.map +1 -0
- package/dist/unified-provider/compat/index.js +13 -0
- package/dist/unified-provider/compat/index.js.map +1 -0
- package/dist/unified-provider/compat/legacy-extractors.d.ts +63 -0
- package/dist/unified-provider/compat/legacy-extractors.d.ts.map +1 -0
- package/dist/unified-provider/compat/legacy-extractors.js +80 -0
- package/dist/unified-provider/compat/legacy-extractors.js.map +1 -0
- package/dist/unified-provider/compat/legacy-scanner.d.ts +28 -0
- package/dist/unified-provider/compat/legacy-scanner.d.ts.map +1 -0
- package/dist/unified-provider/compat/legacy-scanner.js +31 -0
- package/dist/unified-provider/compat/legacy-scanner.js.map +1 -0
- package/dist/unified-provider/index.d.ts +28 -0
- package/dist/unified-provider/index.d.ts.map +1 -0
- package/dist/unified-provider/index.js +47 -0
- package/dist/unified-provider/index.js.map +1 -0
- package/dist/unified-provider/integration/index.d.ts +9 -0
- package/dist/unified-provider/integration/index.d.ts.map +1 -0
- package/dist/unified-provider/integration/index.js +11 -0
- package/dist/unified-provider/integration/index.js.map +1 -0
- package/dist/unified-provider/integration/unified-data-access-adapter.d.ts +75 -0
- package/dist/unified-provider/integration/unified-data-access-adapter.d.ts.map +1 -0
- package/dist/unified-provider/integration/unified-data-access-adapter.js +210 -0
- package/dist/unified-provider/integration/unified-data-access-adapter.js.map +1 -0
- package/dist/unified-provider/integration/unified-scanner.d.ts +90 -0
- package/dist/unified-provider/integration/unified-scanner.d.ts.map +1 -0
- package/dist/unified-provider/integration/unified-scanner.js +369 -0
- package/dist/unified-provider/integration/unified-scanner.js.map +1 -0
- package/dist/unified-provider/matching/base-matcher.d.ts +80 -0
- package/dist/unified-provider/matching/base-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/base-matcher.js +196 -0
- package/dist/unified-provider/matching/base-matcher.js.map +1 -0
- package/dist/unified-provider/matching/django-matcher.d.ts +32 -0
- package/dist/unified-provider/matching/django-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/django-matcher.js +107 -0
- package/dist/unified-provider/matching/django-matcher.js.map +1 -0
- package/dist/unified-provider/matching/drizzle-matcher.d.ts +25 -0
- package/dist/unified-provider/matching/drizzle-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/drizzle-matcher.js +123 -0
- package/dist/unified-provider/matching/drizzle-matcher.js.map +1 -0
- package/dist/unified-provider/matching/efcore-matcher.d.ts +27 -0
- package/dist/unified-provider/matching/efcore-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/efcore-matcher.js +88 -0
- package/dist/unified-provider/matching/efcore-matcher.js.map +1 -0
- package/dist/unified-provider/matching/eloquent-matcher.d.ts +32 -0
- package/dist/unified-provider/matching/eloquent-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/eloquent-matcher.js +162 -0
- package/dist/unified-provider/matching/eloquent-matcher.js.map +1 -0
- package/dist/unified-provider/matching/index.d.ts +19 -0
- package/dist/unified-provider/matching/index.d.ts.map +1 -0
- package/dist/unified-provider/matching/index.js +24 -0
- package/dist/unified-provider/matching/index.js.map +1 -0
- package/dist/unified-provider/matching/knex-matcher.d.ts +26 -0
- package/dist/unified-provider/matching/knex-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/knex-matcher.js +109 -0
- package/dist/unified-provider/matching/knex-matcher.js.map +1 -0
- package/dist/unified-provider/matching/matcher-registry.d.ts +55 -0
- package/dist/unified-provider/matching/matcher-registry.d.ts.map +1 -0
- package/dist/unified-provider/matching/matcher-registry.js +130 -0
- package/dist/unified-provider/matching/matcher-registry.js.map +1 -0
- package/dist/unified-provider/matching/mongoose-matcher.d.ts +30 -0
- package/dist/unified-provider/matching/mongoose-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/mongoose-matcher.js +132 -0
- package/dist/unified-provider/matching/mongoose-matcher.js.map +1 -0
- package/dist/unified-provider/matching/prisma-matcher.d.ts +31 -0
- package/dist/unified-provider/matching/prisma-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/prisma-matcher.js +123 -0
- package/dist/unified-provider/matching/prisma-matcher.js.map +1 -0
- package/dist/unified-provider/matching/raw-sql-matcher.d.ts +31 -0
- package/dist/unified-provider/matching/raw-sql-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/raw-sql-matcher.js +173 -0
- package/dist/unified-provider/matching/raw-sql-matcher.js.map +1 -0
- package/dist/unified-provider/matching/sequelize-matcher.d.ts +28 -0
- package/dist/unified-provider/matching/sequelize-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/sequelize-matcher.js +132 -0
- package/dist/unified-provider/matching/sequelize-matcher.js.map +1 -0
- package/dist/unified-provider/matching/spring-data-matcher.d.ts +32 -0
- package/dist/unified-provider/matching/spring-data-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/spring-data-matcher.js +112 -0
- package/dist/unified-provider/matching/spring-data-matcher.js.map +1 -0
- package/dist/unified-provider/matching/sqlalchemy-matcher.d.ts +32 -0
- package/dist/unified-provider/matching/sqlalchemy-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/sqlalchemy-matcher.js +201 -0
- package/dist/unified-provider/matching/sqlalchemy-matcher.js.map +1 -0
- package/dist/unified-provider/matching/supabase-matcher.d.ts +27 -0
- package/dist/unified-provider/matching/supabase-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/supabase-matcher.js +122 -0
- package/dist/unified-provider/matching/supabase-matcher.js.map +1 -0
- package/dist/unified-provider/matching/typeorm-matcher.d.ts +32 -0
- package/dist/unified-provider/matching/typeorm-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/typeorm-matcher.js +169 -0
- package/dist/unified-provider/matching/typeorm-matcher.js.map +1 -0
- package/dist/unified-provider/migration/deprecated-extractors.d.ts +104 -0
- package/dist/unified-provider/migration/deprecated-extractors.d.ts.map +1 -0
- package/dist/unified-provider/migration/deprecated-extractors.js +129 -0
- package/dist/unified-provider/migration/deprecated-extractors.js.map +1 -0
- package/dist/unified-provider/migration/deprecated-scanner.d.ts +40 -0
- package/dist/unified-provider/migration/deprecated-scanner.d.ts.map +1 -0
- package/dist/unified-provider/migration/deprecated-scanner.js +49 -0
- package/dist/unified-provider/migration/deprecated-scanner.js.map +1 -0
- package/dist/unified-provider/migration/index.d.ts +41 -0
- package/dist/unified-provider/migration/index.d.ts.map +1 -0
- package/dist/unified-provider/migration/index.js +43 -0
- package/dist/unified-provider/migration/index.js.map +1 -0
- package/dist/unified-provider/normalization/base-normalizer.d.ts +188 -0
- package/dist/unified-provider/normalization/base-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/base-normalizer.js +339 -0
- package/dist/unified-provider/normalization/base-normalizer.js.map +1 -0
- package/dist/unified-provider/normalization/csharp-normalizer.d.ts +58 -0
- package/dist/unified-provider/normalization/csharp-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/csharp-normalizer.js +467 -0
- package/dist/unified-provider/normalization/csharp-normalizer.js.map +1 -0
- package/dist/unified-provider/normalization/index.d.ts +23 -0
- package/dist/unified-provider/normalization/index.d.ts.map +1 -0
- package/dist/unified-provider/normalization/index.js +62 -0
- package/dist/unified-provider/normalization/index.js.map +1 -0
- package/dist/unified-provider/normalization/java-normalizer.d.ts +54 -0
- package/dist/unified-provider/normalization/java-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/java-normalizer.js +453 -0
- package/dist/unified-provider/normalization/java-normalizer.js.map +1 -0
- package/dist/unified-provider/normalization/php-normalizer.d.ts +54 -0
- package/dist/unified-provider/normalization/php-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/php-normalizer.js +489 -0
- package/dist/unified-provider/normalization/php-normalizer.js.map +1 -0
- package/dist/unified-provider/normalization/python-normalizer.d.ts +61 -0
- package/dist/unified-provider/normalization/python-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/python-normalizer.js +548 -0
- package/dist/unified-provider/normalization/python-normalizer.js.map +1 -0
- package/dist/unified-provider/normalization/typescript-normalizer.d.ts +60 -0
- package/dist/unified-provider/normalization/typescript-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/typescript-normalizer.js +608 -0
- package/dist/unified-provider/normalization/typescript-normalizer.js.map +1 -0
- package/dist/unified-provider/parsing/index.d.ts +5 -0
- package/dist/unified-provider/parsing/index.d.ts.map +1 -0
- package/dist/unified-provider/parsing/index.js +5 -0
- package/dist/unified-provider/parsing/index.js.map +1 -0
- package/dist/unified-provider/parsing/parser-registry.d.ts +70 -0
- package/dist/unified-provider/parsing/parser-registry.d.ts.map +1 -0
- package/dist/unified-provider/parsing/parser-registry.js +260 -0
- package/dist/unified-provider/parsing/parser-registry.js.map +1 -0
- package/dist/unified-provider/provider/index.d.ts +5 -0
- package/dist/unified-provider/provider/index.d.ts.map +1 -0
- package/dist/unified-provider/provider/index.js +5 -0
- package/dist/unified-provider/provider/index.js.map +1 -0
- package/dist/unified-provider/provider/unified-language-provider.d.ts +56 -0
- package/dist/unified-provider/provider/unified-language-provider.d.ts.map +1 -0
- package/dist/unified-provider/provider/unified-language-provider.js +212 -0
- package/dist/unified-provider/provider/unified-language-provider.js.map +1 -0
- package/dist/unified-provider/types.d.ts +389 -0
- package/dist/unified-provider/types.d.ts.map +1 -0
- package/dist/unified-provider/types.js +9 -0
- package/dist/unified-provider/types.js.map +1 -0
- package/dist/wrappers/clustering/clusterer.d.ts +43 -0
- package/dist/wrappers/clustering/clusterer.d.ts.map +1 -0
- package/dist/wrappers/clustering/clusterer.js +374 -0
- package/dist/wrappers/clustering/clusterer.js.map +1 -0
- package/dist/wrappers/clustering/exclusions.d.ts +47 -0
- package/dist/wrappers/clustering/exclusions.d.ts.map +1 -0
- package/dist/wrappers/clustering/exclusions.js +318 -0
- package/dist/wrappers/clustering/exclusions.js.map +1 -0
- package/dist/wrappers/clustering/index.d.ts +6 -0
- package/dist/wrappers/clustering/index.d.ts.map +1 -0
- package/dist/wrappers/clustering/index.js +6 -0
- package/dist/wrappers/clustering/index.js.map +1 -0
- package/dist/wrappers/detection/detector.d.ts +69 -0
- package/dist/wrappers/detection/detector.d.ts.map +1 -0
- package/dist/wrappers/detection/detector.js +279 -0
- package/dist/wrappers/detection/detector.js.map +1 -0
- package/dist/wrappers/detection/index.d.ts +5 -0
- package/dist/wrappers/detection/index.d.ts.map +1 -0
- package/dist/wrappers/detection/index.js +5 -0
- package/dist/wrappers/detection/index.js.map +1 -0
- package/dist/wrappers/export/index.d.ts +5 -0
- package/dist/wrappers/export/index.d.ts.map +1 -0
- package/dist/wrappers/export/index.js +5 -0
- package/dist/wrappers/export/index.js.map +1 -0
- package/dist/wrappers/export/json.d.ts +127 -0
- package/dist/wrappers/export/json.d.ts.map +1 -0
- package/dist/wrappers/export/json.js +160 -0
- package/dist/wrappers/export/json.js.map +1 -0
- package/dist/wrappers/index.d.ts +56 -0
- package/dist/wrappers/index.d.ts.map +1 -0
- package/dist/wrappers/index.js +159 -0
- package/dist/wrappers/index.js.map +1 -0
- package/dist/wrappers/integration/adapter.d.ts +52 -0
- package/dist/wrappers/integration/adapter.d.ts.map +1 -0
- package/dist/wrappers/integration/adapter.js +209 -0
- package/dist/wrappers/integration/adapter.js.map +1 -0
- package/dist/wrappers/integration/index.d.ts +9 -0
- package/dist/wrappers/integration/index.d.ts.map +1 -0
- package/dist/wrappers/integration/index.js +12 -0
- package/dist/wrappers/integration/index.js.map +1 -0
- package/dist/wrappers/integration/pattern-adapter.d.ts +52 -0
- package/dist/wrappers/integration/pattern-adapter.d.ts.map +1 -0
- package/dist/wrappers/integration/pattern-adapter.js +192 -0
- package/dist/wrappers/integration/pattern-adapter.js.map +1 -0
- package/dist/wrappers/integration/scanner.d.ts +85 -0
- package/dist/wrappers/integration/scanner.d.ts.map +1 -0
- package/dist/wrappers/integration/scanner.js +367 -0
- package/dist/wrappers/integration/scanner.js.map +1 -0
- package/dist/wrappers/primitives/discovery.d.ts +57 -0
- package/dist/wrappers/primitives/discovery.d.ts.map +1 -0
- package/dist/wrappers/primitives/discovery.js +389 -0
- package/dist/wrappers/primitives/discovery.js.map +1 -0
- package/dist/wrappers/primitives/index.d.ts +6 -0
- package/dist/wrappers/primitives/index.d.ts.map +1 -0
- package/dist/wrappers/primitives/index.js +6 -0
- package/dist/wrappers/primitives/index.js.map +1 -0
- package/dist/wrappers/primitives/registry.d.ts +63 -0
- package/dist/wrappers/primitives/registry.d.ts.map +1 -0
- package/dist/wrappers/primitives/registry.js +447 -0
- package/dist/wrappers/primitives/registry.js.map +1 -0
- package/dist/wrappers/types.d.ts +137 -0
- package/dist/wrappers/types.d.ts.map +1 -0
- package/dist/wrappers/types.js +7 -0
- package/dist/wrappers/types.js.map +1 -0
- package/package.json +23 -18
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python Test Regex Extractor
|
|
3
|
+
*
|
|
4
|
+
* Regex-based fallback for extracting test information when tree-sitter is unavailable.
|
|
5
|
+
* Supports pytest, unittest, and nose frameworks.
|
|
6
|
+
*/
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Extractor
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export class PythonTestRegexExtractor {
|
|
11
|
+
language = 'python';
|
|
12
|
+
extensions = ['.py'];
|
|
13
|
+
/**
|
|
14
|
+
* Extract test information using regex patterns
|
|
15
|
+
*/
|
|
16
|
+
extract(content, filePath) {
|
|
17
|
+
const framework = this.detectFramework(content);
|
|
18
|
+
const testCases = this.extractTestCases(content, filePath, framework);
|
|
19
|
+
const mocks = this.extractMocks(content);
|
|
20
|
+
const setupBlocks = this.extractSetupBlocks(content, framework);
|
|
21
|
+
const fixtures = framework === 'pytest' ? this.extractFixtures(content) : undefined;
|
|
22
|
+
// Enrich test cases with quality
|
|
23
|
+
for (const test of testCases) {
|
|
24
|
+
const testMocks = mocks.filter(m => m.line >= test.line && m.line <= test.line + 100);
|
|
25
|
+
test.quality = this.calculateQuality(test.assertions, testMocks, test.directCalls);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
file: filePath,
|
|
29
|
+
framework,
|
|
30
|
+
language: 'python',
|
|
31
|
+
testCases,
|
|
32
|
+
mocks,
|
|
33
|
+
setupBlocks,
|
|
34
|
+
fixtures,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Detect test framework
|
|
39
|
+
*/
|
|
40
|
+
detectFramework(content) {
|
|
41
|
+
// Check imports
|
|
42
|
+
if (/import\s+pytest|from\s+pytest/.test(content))
|
|
43
|
+
return 'pytest';
|
|
44
|
+
if (/import\s+unittest|from\s+unittest/.test(content))
|
|
45
|
+
return 'unittest';
|
|
46
|
+
if (/import\s+nose|from\s+nose/.test(content))
|
|
47
|
+
return 'nose';
|
|
48
|
+
// Check for pytest fixtures
|
|
49
|
+
if (/@pytest\.fixture/.test(content))
|
|
50
|
+
return 'pytest';
|
|
51
|
+
// Check for unittest class
|
|
52
|
+
if (/class\s+\w+\s*\(\s*(?:unittest\.)?TestCase\s*\)/.test(content))
|
|
53
|
+
return 'unittest';
|
|
54
|
+
// Check for test_ functions (pytest style)
|
|
55
|
+
if (/^def\s+test_/m.test(content))
|
|
56
|
+
return 'pytest';
|
|
57
|
+
return 'unknown';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Extract test cases
|
|
61
|
+
*/
|
|
62
|
+
extractTestCases(content, filePath, framework) {
|
|
63
|
+
const testCases = [];
|
|
64
|
+
const lines = content.split('\n');
|
|
65
|
+
// Track current class for unittest style
|
|
66
|
+
let currentClass;
|
|
67
|
+
let classIndent = 0;
|
|
68
|
+
for (let i = 0; i < lines.length; i++) {
|
|
69
|
+
const line = lines[i];
|
|
70
|
+
const lineNum = i + 1;
|
|
71
|
+
const indent = line.search(/\S/);
|
|
72
|
+
// Check for class definition
|
|
73
|
+
const classMatch = line.match(/^(\s*)class\s+(\w+)/);
|
|
74
|
+
if (classMatch) {
|
|
75
|
+
currentClass = classMatch[2];
|
|
76
|
+
classIndent = classMatch[1].length;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
// Reset class if we're back at base indent
|
|
80
|
+
if (indent <= classIndent && currentClass && line.trim() && !line.trim().startsWith('#')) {
|
|
81
|
+
currentClass = undefined;
|
|
82
|
+
}
|
|
83
|
+
// Check for test function
|
|
84
|
+
const testMatch = line.match(/^(\s*)(?:async\s+)?def\s+(test_\w+)\s*\(/);
|
|
85
|
+
if (testMatch) {
|
|
86
|
+
const testName = testMatch[2];
|
|
87
|
+
const qualifiedName = currentClass
|
|
88
|
+
? `${currentClass}.${testName}`
|
|
89
|
+
: testName;
|
|
90
|
+
// Extract test body
|
|
91
|
+
const testBody = this.extractFunctionBody(lines, i);
|
|
92
|
+
const directCalls = this.extractFunctionCalls(testBody);
|
|
93
|
+
const assertions = this.extractAssertions(testBody, lineNum, framework);
|
|
94
|
+
testCases.push({
|
|
95
|
+
id: `${filePath}:${testName}:${lineNum}`,
|
|
96
|
+
name: testName,
|
|
97
|
+
parentBlock: currentClass,
|
|
98
|
+
qualifiedName,
|
|
99
|
+
file: filePath,
|
|
100
|
+
line: lineNum,
|
|
101
|
+
directCalls,
|
|
102
|
+
transitiveCalls: [],
|
|
103
|
+
assertions,
|
|
104
|
+
quality: {
|
|
105
|
+
assertionCount: assertions.length,
|
|
106
|
+
hasErrorCases: false,
|
|
107
|
+
hasEdgeCases: false,
|
|
108
|
+
mockRatio: 0,
|
|
109
|
+
setupRatio: 0,
|
|
110
|
+
score: 50,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return testCases;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Extract function body based on indentation
|
|
119
|
+
*/
|
|
120
|
+
extractFunctionBody(lines, startIndex) {
|
|
121
|
+
const bodyLines = [];
|
|
122
|
+
const defLine = lines[startIndex];
|
|
123
|
+
const defIndent = defLine.search(/\S/);
|
|
124
|
+
// Start from next line
|
|
125
|
+
for (let i = startIndex + 1; i < Math.min(startIndex + 100, lines.length); i++) {
|
|
126
|
+
const line = lines[i];
|
|
127
|
+
const lineIndent = line.search(/\S/);
|
|
128
|
+
// Empty lines are okay
|
|
129
|
+
if (line.trim() === '') {
|
|
130
|
+
bodyLines.push(line);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
// If we're back to same or less indent, we're done
|
|
134
|
+
if (lineIndent <= defIndent) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
bodyLines.push(line);
|
|
138
|
+
}
|
|
139
|
+
return bodyLines.join('\n');
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Extract function calls from test body
|
|
143
|
+
*/
|
|
144
|
+
extractFunctionCalls(body) {
|
|
145
|
+
const calls = [];
|
|
146
|
+
const seen = new Set();
|
|
147
|
+
// Pattern for function calls
|
|
148
|
+
const callPattern = /\b([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/g;
|
|
149
|
+
let match;
|
|
150
|
+
while ((match = callPattern.exec(body)) !== null) {
|
|
151
|
+
const name = match[1];
|
|
152
|
+
if (this.isTestFrameworkCall(name))
|
|
153
|
+
continue;
|
|
154
|
+
if (!seen.has(name)) {
|
|
155
|
+
seen.add(name);
|
|
156
|
+
calls.push(name);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Pattern for method calls
|
|
160
|
+
const methodPattern = /\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/g;
|
|
161
|
+
while ((match = methodPattern.exec(body)) !== null) {
|
|
162
|
+
const name = match[1];
|
|
163
|
+
if (this.isTestFrameworkCall(name))
|
|
164
|
+
continue;
|
|
165
|
+
if (!seen.has(name)) {
|
|
166
|
+
seen.add(name);
|
|
167
|
+
calls.push(name);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return calls;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Extract assertions
|
|
174
|
+
*/
|
|
175
|
+
extractAssertions(body, baseLineNum, _framework) {
|
|
176
|
+
const assertions = [];
|
|
177
|
+
const lines = body.split('\n');
|
|
178
|
+
for (let i = 0; i < lines.length; i++) {
|
|
179
|
+
const line = lines[i];
|
|
180
|
+
const lineNum = baseLineNum + i + 1;
|
|
181
|
+
// pytest assert
|
|
182
|
+
if (/\bassert\s+/.test(line)) {
|
|
183
|
+
const isError = /raises|exception/i.test(line);
|
|
184
|
+
const isEdge = /None|is\s+None|==\s*None|==\s*\[\]|==\s*\{\}|==\s*''|==\s*0/.test(line);
|
|
185
|
+
assertions.push({
|
|
186
|
+
matcher: 'assert',
|
|
187
|
+
line: lineNum,
|
|
188
|
+
isErrorAssertion: isError,
|
|
189
|
+
isEdgeCaseAssertion: isEdge,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
// unittest assertions
|
|
193
|
+
const unittestMatch = line.match(/self\.(assert\w+)/);
|
|
194
|
+
if (unittestMatch) {
|
|
195
|
+
const matcher = unittestMatch[1];
|
|
196
|
+
assertions.push({
|
|
197
|
+
matcher,
|
|
198
|
+
line: lineNum,
|
|
199
|
+
isErrorAssertion: this.isErrorMatcher(matcher),
|
|
200
|
+
isEdgeCaseAssertion: this.isEdgeCaseMatcher(matcher),
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
// pytest.raises
|
|
204
|
+
if (/pytest\.raises/.test(line)) {
|
|
205
|
+
assertions.push({
|
|
206
|
+
matcher: 'pytest.raises',
|
|
207
|
+
line: lineNum,
|
|
208
|
+
isErrorAssertion: true,
|
|
209
|
+
isEdgeCaseAssertion: false,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return assertions;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Extract mock statements
|
|
217
|
+
*/
|
|
218
|
+
extractMocks(content) {
|
|
219
|
+
const mocks = [];
|
|
220
|
+
const lines = content.split('\n');
|
|
221
|
+
for (let i = 0; i < lines.length; i++) {
|
|
222
|
+
const line = lines[i];
|
|
223
|
+
const lineNum = i + 1;
|
|
224
|
+
// @patch decorator
|
|
225
|
+
const patchMatch = line.match(/@(?:mock\.)?patch\s*\(\s*['"]([^'"]+)['"]/);
|
|
226
|
+
if (patchMatch) {
|
|
227
|
+
mocks.push({
|
|
228
|
+
target: patchMatch[1],
|
|
229
|
+
mockType: '@patch',
|
|
230
|
+
line: lineNum,
|
|
231
|
+
isExternal: this.isExternalModule(patchMatch[1]),
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
// patch() context manager or function
|
|
235
|
+
const patchCallMatch = line.match(/(?:mock\.)?patch\s*\(\s*['"]([^'"]+)['"]/);
|
|
236
|
+
if (patchCallMatch && !line.includes('@')) {
|
|
237
|
+
mocks.push({
|
|
238
|
+
target: patchCallMatch[1],
|
|
239
|
+
mockType: 'patch()',
|
|
240
|
+
line: lineNum,
|
|
241
|
+
isExternal: this.isExternalModule(patchCallMatch[1]),
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// MagicMock / Mock
|
|
245
|
+
const mockMatch = line.match(/(\w+)\s*=\s*(?:Mock|MagicMock)\s*\(/);
|
|
246
|
+
if (mockMatch) {
|
|
247
|
+
mocks.push({
|
|
248
|
+
target: mockMatch[1],
|
|
249
|
+
mockType: 'Mock',
|
|
250
|
+
line: lineNum,
|
|
251
|
+
isExternal: false,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
// mocker.patch (pytest-mock)
|
|
255
|
+
const mockerMatch = line.match(/mocker\.patch\s*\(\s*['"]([^'"]+)['"]/);
|
|
256
|
+
if (mockerMatch) {
|
|
257
|
+
mocks.push({
|
|
258
|
+
target: mockerMatch[1],
|
|
259
|
+
mockType: 'mocker.patch',
|
|
260
|
+
line: lineNum,
|
|
261
|
+
isExternal: this.isExternalModule(mockerMatch[1]),
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return mocks;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Extract setup blocks
|
|
269
|
+
*/
|
|
270
|
+
extractSetupBlocks(content, framework) {
|
|
271
|
+
const blocks = [];
|
|
272
|
+
const lines = content.split('\n');
|
|
273
|
+
const setupFns = framework === 'unittest'
|
|
274
|
+
? ['setUp', 'tearDown', 'setUpClass', 'tearDownClass']
|
|
275
|
+
: ['setup_method', 'teardown_method', 'setup_function', 'teardown_function'];
|
|
276
|
+
for (let i = 0; i < lines.length; i++) {
|
|
277
|
+
const line = lines[i];
|
|
278
|
+
const lineNum = i + 1;
|
|
279
|
+
for (const fn of setupFns) {
|
|
280
|
+
const pattern = new RegExp(`def\\s+${fn}\\s*\\(`);
|
|
281
|
+
if (pattern.test(line)) {
|
|
282
|
+
const body = this.extractFunctionBody(lines, i);
|
|
283
|
+
const calls = this.extractFunctionCalls(body);
|
|
284
|
+
const type = fn.toLowerCase().includes('setup') ? 'setUp' : 'tearDown';
|
|
285
|
+
blocks.push({
|
|
286
|
+
type: type,
|
|
287
|
+
line: lineNum,
|
|
288
|
+
calls,
|
|
289
|
+
});
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return blocks;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Extract pytest fixtures
|
|
298
|
+
*/
|
|
299
|
+
extractFixtures(content) {
|
|
300
|
+
const fixtures = [];
|
|
301
|
+
const lines = content.split('\n');
|
|
302
|
+
for (let i = 0; i < lines.length; i++) {
|
|
303
|
+
const line = lines[i];
|
|
304
|
+
const lineNum = i + 1;
|
|
305
|
+
// @pytest.fixture
|
|
306
|
+
const fixtureMatch = line.match(/@pytest\.fixture(?:\s*\(\s*(?:scope\s*=\s*['"](\w+)['"])?\s*\))?/);
|
|
307
|
+
if (fixtureMatch) {
|
|
308
|
+
// Get the function name from next line
|
|
309
|
+
const nextLine = lines[i + 1];
|
|
310
|
+
if (nextLine) {
|
|
311
|
+
const fnMatch = nextLine.match(/def\s+(\w+)\s*\(/);
|
|
312
|
+
if (fnMatch) {
|
|
313
|
+
fixtures.push({
|
|
314
|
+
name: fnMatch[1],
|
|
315
|
+
scope: fixtureMatch[1] ?? 'function',
|
|
316
|
+
line: lineNum,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return fixtures;
|
|
323
|
+
}
|
|
324
|
+
isTestFrameworkCall(name) {
|
|
325
|
+
const frameworkCalls = [
|
|
326
|
+
'assert', 'assertEqual', 'assertTrue', 'assertFalse', 'assertIsNone',
|
|
327
|
+
'assertIsNotNone', 'assertRaises', 'assertIn', 'assertNotIn',
|
|
328
|
+
'pytest', 'fixture', 'mark', 'parametrize', 'raises',
|
|
329
|
+
'patch', 'Mock', 'MagicMock', 'mocker',
|
|
330
|
+
];
|
|
331
|
+
return frameworkCalls.includes(name);
|
|
332
|
+
}
|
|
333
|
+
isErrorMatcher(matcher) {
|
|
334
|
+
return /raises|exception/i.test(matcher);
|
|
335
|
+
}
|
|
336
|
+
isEdgeCaseMatcher(matcher) {
|
|
337
|
+
return /none|null|empty|zero|false/i.test(matcher);
|
|
338
|
+
}
|
|
339
|
+
isExternalModule(modulePath) {
|
|
340
|
+
if (modulePath.startsWith('.'))
|
|
341
|
+
return false;
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
calculateQuality(assertions, mocks, directCalls) {
|
|
345
|
+
const assertionCount = assertions.length;
|
|
346
|
+
const hasErrorCases = assertions.some(a => a.isErrorAssertion);
|
|
347
|
+
const hasEdgeCases = assertions.some(a => a.isEdgeCaseAssertion);
|
|
348
|
+
const totalCalls = mocks.length + directCalls.length;
|
|
349
|
+
const mockRatio = totalCalls > 0 ? mocks.length / totalCalls : 0;
|
|
350
|
+
let score = 50;
|
|
351
|
+
if (assertionCount >= 1)
|
|
352
|
+
score += 10;
|
|
353
|
+
if (assertionCount >= 3)
|
|
354
|
+
score += 10;
|
|
355
|
+
if (hasErrorCases)
|
|
356
|
+
score += 15;
|
|
357
|
+
if (hasEdgeCases)
|
|
358
|
+
score += 10;
|
|
359
|
+
if (mockRatio > 0.7)
|
|
360
|
+
score -= 15;
|
|
361
|
+
else if (mockRatio > 0.5)
|
|
362
|
+
score -= 5;
|
|
363
|
+
if (assertionCount === 0)
|
|
364
|
+
score -= 20;
|
|
365
|
+
return {
|
|
366
|
+
assertionCount,
|
|
367
|
+
hasErrorCases,
|
|
368
|
+
hasEdgeCases,
|
|
369
|
+
mockRatio: Math.round(mockRatio * 100) / 100,
|
|
370
|
+
setupRatio: 0,
|
|
371
|
+
score: Math.max(0, Math.min(100, score)),
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Factory function
|
|
377
|
+
*/
|
|
378
|
+
export function createPythonTestRegexExtractor() {
|
|
379
|
+
return new PythonTestRegexExtractor();
|
|
380
|
+
}
|
|
381
|
+
//# sourceMappingURL=python-test-regex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-test-regex.js","sourceRoot":"","sources":["../../../../src/test-topology/extractors/regex/python-test-regex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,OAAO,wBAAwB;IAC1B,QAAQ,GAAG,QAAiB,CAAC;IAC7B,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC;IAE9B;;OAEG;IACH,OAAO,CAAC,OAAe,EAAE,QAAgB;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QACtE,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEpF,iCAAiC;QACjC,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACjC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,GAAG,CACjD,CAAC;YACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,gBAAgB,CA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5
|
+
* Supports Jest, Vitest, Mocha, and other JS test frameworks.
|
|
6
|
+
*/
|
|
7
|
+
import type { TestExtraction, TestCase, MockStatement, SetupBlock, TestFramework } from '../../types.js';
|
|
8
|
+
export declare class TypeScriptTestRegexExtractor {
|
|
9
|
+
readonly language: "typescript";
|
|
10
|
+
readonly extensions: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Extract test information using regex patterns
|
|
13
|
+
*/
|
|
14
|
+
extract(content: string, filePath: string): TestExtraction;
|
|
15
|
+
private getLanguageFromPath;
|
|
16
|
+
/**
|
|
17
|
+
* Detect test framework from imports
|
|
18
|
+
*/
|
|
19
|
+
detectFramework(content: string): TestFramework;
|
|
20
|
+
/**
|
|
21
|
+
* Extract test cases using regex
|
|
22
|
+
*/
|
|
23
|
+
extractTestCases(content: string, filePath: string): TestCase[];
|
|
24
|
+
/**
|
|
25
|
+
* Extract the body of a test (rough approximation)
|
|
26
|
+
*/
|
|
27
|
+
private extractTestBody;
|
|
28
|
+
/**
|
|
29
|
+
* Extract function calls from test body
|
|
30
|
+
*/
|
|
31
|
+
private extractFunctionCalls;
|
|
32
|
+
/**
|
|
33
|
+
* Extract assertions from test body
|
|
34
|
+
*/
|
|
35
|
+
private extractAssertions;
|
|
36
|
+
/**
|
|
37
|
+
* Extract mock statements
|
|
38
|
+
*/
|
|
39
|
+
extractMocks(content: string, framework: TestFramework): MockStatement[];
|
|
40
|
+
/**
|
|
41
|
+
* Extract setup blocks
|
|
42
|
+
*/
|
|
43
|
+
extractSetupBlocks(content: string): SetupBlock[];
|
|
44
|
+
/**
|
|
45
|
+
* Check if a call is a test framework call
|
|
46
|
+
*/
|
|
47
|
+
private isTestFrameworkCall;
|
|
48
|
+
private isErrorMatcher;
|
|
49
|
+
private isEdgeCaseMatcher;
|
|
50
|
+
private isExternalModule;
|
|
51
|
+
/**
|
|
52
|
+
* Calculate test quality signals
|
|
53
|
+
*/
|
|
54
|
+
private calculateQuality;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Factory function
|
|
58
|
+
*/
|
|
59
|
+
export declare function createTypeScriptTestRegexExtractor(): TypeScriptTestRegexExtractor;
|
|
60
|
+
//# sourceMappingURL=typescript-test-regex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-test-regex.d.ts","sourceRoot":"","sources":["../../../../src/test-topology/extractors/regex/typescript-test-regex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EAGV,aAAa,EACd,MAAM,gBAAgB,CAAC;AAoBxB,qBAAa,4BAA4B;IACvC,QAAQ,CAAC,QAAQ,EAAG,YAAY,CAAU;IAC1C,QAAQ,CAAC,UAAU,WAAkE;IAErF;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc;IAwB1D,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa;IA4B/C;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE;IAiF/D;;OAEG;IACH,OAAO,CAAC,eAAe;IA2BvB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAkC5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAyBzB;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,aAAa,EAAE;IA2CxE;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE;IA4BjD;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CA8BzB;AAED;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,4BAA4B,CAEjF"}
|