@opensip-cli/checks-typescript 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/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/all-checks-execute.test.d.ts +12 -0
- package/dist/__tests__/all-checks-execute.test.d.ts.map +1 -0
- package/dist/__tests__/all-checks-execute.test.js +846 -0
- package/dist/__tests__/all-checks-execute.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-2.test.d.ts +9 -0
- package/dist/__tests__/behavior-fixtures-2.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-2.test.js +625 -0
- package/dist/__tests__/behavior-fixtures-2.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-3.test.d.ts +7 -0
- package/dist/__tests__/behavior-fixtures-3.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-3.test.js +658 -0
- package/dist/__tests__/behavior-fixtures-3.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-4.test.d.ts +8 -0
- package/dist/__tests__/behavior-fixtures-4.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-4.test.js +590 -0
- package/dist/__tests__/behavior-fixtures-4.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-5.test.d.ts +7 -0
- package/dist/__tests__/behavior-fixtures-5.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-5.test.js +548 -0
- package/dist/__tests__/behavior-fixtures-5.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-6.test.d.ts +18 -0
- package/dist/__tests__/behavior-fixtures-6.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-6.test.js +1700 -0
- package/dist/__tests__/behavior-fixtures-6.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures.test.d.ts +10 -0
- package/dist/__tests__/behavior-fixtures.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures.test.js +812 -0
- package/dist/__tests__/behavior-fixtures.test.js.map +1 -0
- package/dist/__tests__/branch-fixtures-2.test.d.ts +6 -0
- package/dist/__tests__/branch-fixtures-2.test.d.ts.map +1 -0
- package/dist/__tests__/branch-fixtures-2.test.js +1369 -0
- package/dist/__tests__/branch-fixtures-2.test.js.map +1 -0
- package/dist/__tests__/branch-fixtures-3.test.d.ts +7 -0
- package/dist/__tests__/branch-fixtures-3.test.d.ts.map +1 -0
- package/dist/__tests__/branch-fixtures-3.test.js +877 -0
- package/dist/__tests__/branch-fixtures-3.test.js.map +1 -0
- package/dist/__tests__/branch-fixtures.test.d.ts +6 -0
- package/dist/__tests__/branch-fixtures.test.d.ts.map +1 -0
- package/dist/__tests__/branch-fixtures.test.js +1072 -0
- package/dist/__tests__/branch-fixtures.test.js.map +1 -0
- package/dist/__tests__/checks.test.d.ts +2 -0
- package/dist/__tests__/checks.test.d.ts.map +1 -0
- package/dist/__tests__/checks.test.js +39 -0
- package/dist/__tests__/checks.test.js.map +1 -0
- package/dist/__tests__/fixture-coverage.allowlist.d.ts +19 -0
- package/dist/__tests__/fixture-coverage.allowlist.d.ts.map +1 -0
- package/dist/__tests__/fixture-coverage.allowlist.js +27 -0
- package/dist/__tests__/fixture-coverage.allowlist.js.map +1 -0
- package/dist/__tests__/fixture-coverage.test.d.ts +13 -0
- package/dist/__tests__/fixture-coverage.test.d.ts.map +1 -0
- package/dist/__tests__/fixture-coverage.test.js +57 -0
- package/dist/__tests__/fixture-coverage.test.js.map +1 -0
- package/dist/__tests__/no-bootstrap-tool-import.test.d.ts +2 -0
- package/dist/__tests__/no-bootstrap-tool-import.test.d.ts.map +1 -0
- package/dist/__tests__/no-bootstrap-tool-import.test.js +75 -0
- package/dist/__tests__/no-bootstrap-tool-import.test.js.map +1 -0
- package/dist/__tests__/phantom-dependency-detection.test.d.ts +12 -0
- package/dist/__tests__/phantom-dependency-detection.test.d.ts.map +1 -0
- package/dist/__tests__/phantom-dependency-detection.test.js +112 -0
- package/dist/__tests__/phantom-dependency-detection.test.js.map +1 -0
- package/dist/__tests__/typescript-frontend.test.d.ts +8 -0
- package/dist/__tests__/typescript-frontend.test.d.ts.map +1 -0
- package/dist/__tests__/typescript-frontend.test.js +57 -0
- package/dist/__tests__/typescript-frontend.test.js.map +1 -0
- package/dist/checks/architecture/circular-import-detection.d.ts +14 -0
- package/dist/checks/architecture/circular-import-detection.d.ts.map +1 -0
- package/dist/checks/architecture/circular-import-detection.js +55 -0
- package/dist/checks/architecture/circular-import-detection.js.map +1 -0
- package/dist/checks/architecture/contracts-schema-consistency.d.ts +11 -0
- package/dist/checks/architecture/contracts-schema-consistency.d.ts.map +1 -0
- package/dist/checks/architecture/contracts-schema-consistency.js +75 -0
- package/dist/checks/architecture/contracts-schema-consistency.js.map +1 -0
- package/dist/checks/architecture/drizzle-orm-migration-guardrails.d.ts +12 -0
- package/dist/checks/architecture/drizzle-orm-migration-guardrails.d.ts.map +1 -0
- package/dist/checks/architecture/drizzle-orm-migration-guardrails.js +92 -0
- package/dist/checks/architecture/drizzle-orm-migration-guardrails.js.map +1 -0
- package/dist/checks/architecture/index.d.ts +10 -0
- package/dist/checks/architecture/index.d.ts.map +1 -0
- package/dist/checks/architecture/index.js +10 -0
- package/dist/checks/architecture/index.js.map +1 -0
- package/dist/checks/architecture/missing-type-exports.d.ts +13 -0
- package/dist/checks/architecture/missing-type-exports.d.ts.map +1 -0
- package/dist/checks/architecture/missing-type-exports.js +245 -0
- package/dist/checks/architecture/missing-type-exports.js.map +1 -0
- package/dist/checks/architecture/module-coupling-fan-out.d.ts +20 -0
- package/dist/checks/architecture/module-coupling-fan-out.d.ts.map +1 -0
- package/dist/checks/architecture/module-coupling-fan-out.js +120 -0
- package/dist/checks/architecture/module-coupling-fan-out.js.map +1 -0
- package/dist/checks/architecture/no-bootstrap-tool-import.d.ts +38 -0
- package/dist/checks/architecture/no-bootstrap-tool-import.d.ts.map +1 -0
- package/dist/checks/architecture/no-bootstrap-tool-import.js +95 -0
- package/dist/checks/architecture/no-bootstrap-tool-import.js.map +1 -0
- package/dist/checks/architecture/package-json-exports-field.d.ts +10 -0
- package/dist/checks/architecture/package-json-exports-field.d.ts.map +1 -0
- package/dist/checks/architecture/package-json-exports-field.js +56 -0
- package/dist/checks/architecture/package-json-exports-field.js.map +1 -0
- package/dist/checks/architecture/phantom-dependency-detection.d.ts +22 -0
- package/dist/checks/architecture/phantom-dependency-detection.d.ts.map +1 -0
- package/dist/checks/architecture/phantom-dependency-detection.js +330 -0
- package/dist/checks/architecture/phantom-dependency-detection.js.map +1 -0
- package/dist/checks/architecture/tsconfig-extends-validation.d.ts +10 -0
- package/dist/checks/architecture/tsconfig-extends-validation.d.ts.map +1 -0
- package/dist/checks/architecture/tsconfig-extends-validation.js +78 -0
- package/dist/checks/architecture/tsconfig-extends-validation.js.map +1 -0
- package/dist/checks/index.d.ts +6 -0
- package/dist/checks/index.d.ts.map +1 -0
- package/dist/checks/index.js +6 -0
- package/dist/checks/index.js.map +1 -0
- package/dist/checks/quality/api/api-contract-validation.d.ts +15 -0
- package/dist/checks/quality/api/api-contract-validation.d.ts.map +1 -0
- package/dist/checks/quality/api/api-contract-validation.js +316 -0
- package/dist/checks/quality/api/api-contract-validation.js.map +1 -0
- package/dist/checks/quality/api/api-response-validation.d.ts +14 -0
- package/dist/checks/quality/api/api-response-validation.d.ts.map +1 -0
- package/dist/checks/quality/api/api-response-validation.js +209 -0
- package/dist/checks/quality/api/api-response-validation.js.map +1 -0
- package/dist/checks/quality/api/fastify-route-validation.d.ts +14 -0
- package/dist/checks/quality/api/fastify-route-validation.d.ts.map +1 -0
- package/dist/checks/quality/api/fastify-route-validation.js +298 -0
- package/dist/checks/quality/api/fastify-route-validation.js.map +1 -0
- package/dist/checks/quality/api/fastify-schema-coverage.d.ts +11 -0
- package/dist/checks/quality/api/fastify-schema-coverage.d.ts.map +1 -0
- package/dist/checks/quality/api/fastify-schema-coverage.js +261 -0
- package/dist/checks/quality/api/fastify-schema-coverage.js.map +1 -0
- package/dist/checks/quality/api/index.d.ts +5 -0
- package/dist/checks/quality/api/index.d.ts.map +1 -0
- package/dist/checks/quality/api/index.js +5 -0
- package/dist/checks/quality/api/index.js.map +1 -0
- package/dist/checks/quality/code-structure/duplicate-utility-functions.d.ts +32 -0
- package/dist/checks/quality/code-structure/duplicate-utility-functions.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/duplicate-utility-functions.js +451 -0
- package/dist/checks/quality/code-structure/duplicate-utility-functions.js.map +1 -0
- package/dist/checks/quality/code-structure/index.d.ts +3 -0
- package/dist/checks/quality/code-structure/index.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/index.js +3 -0
- package/dist/checks/quality/code-structure/index.js.map +1 -0
- package/dist/checks/quality/code-structure/no-any-types.d.ts +13 -0
- package/dist/checks/quality/code-structure/no-any-types.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/no-any-types.js +116 -0
- package/dist/checks/quality/code-structure/no-any-types.js.map +1 -0
- package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.d.ts +15 -0
- package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.js +51 -0
- package/dist/checks/quality/data-integrity/__tests__/null-safety-fp.test.js.map +1 -0
- package/dist/checks/quality/data-integrity/array-validation.d.ts +16 -0
- package/dist/checks/quality/data-integrity/array-validation.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/array-validation.js +508 -0
- package/dist/checks/quality/data-integrity/array-validation.js.map +1 -0
- package/dist/checks/quality/data-integrity/database-index-coverage.d.ts +14 -0
- package/dist/checks/quality/data-integrity/database-index-coverage.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/database-index-coverage.js +235 -0
- package/dist/checks/quality/data-integrity/database-index-coverage.js.map +1 -0
- package/dist/checks/quality/data-integrity/database-schema-validation.d.ts +16 -0
- package/dist/checks/quality/data-integrity/database-schema-validation.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/database-schema-validation.js +328 -0
- package/dist/checks/quality/data-integrity/database-schema-validation.js.map +1 -0
- package/dist/checks/quality/data-integrity/in-memory-repository-detection.d.ts +14 -0
- package/dist/checks/quality/data-integrity/in-memory-repository-detection.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/in-memory-repository-detection.js +157 -0
- package/dist/checks/quality/data-integrity/in-memory-repository-detection.js.map +1 -0
- package/dist/checks/quality/data-integrity/index.d.ts +8 -0
- package/dist/checks/quality/data-integrity/index.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/index.js +8 -0
- package/dist/checks/quality/data-integrity/index.js.map +1 -0
- package/dist/checks/quality/data-integrity/missing-input-validation.d.ts +12 -0
- package/dist/checks/quality/data-integrity/missing-input-validation.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/missing-input-validation.js +180 -0
- package/dist/checks/quality/data-integrity/missing-input-validation.js.map +1 -0
- package/dist/checks/quality/data-integrity/null-safety.d.ts +33 -0
- package/dist/checks/quality/data-integrity/null-safety.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/null-safety.js +766 -0
- package/dist/checks/quality/data-integrity/null-safety.js.map +1 -0
- package/dist/checks/quality/data-integrity/numeric-validation.d.ts +12 -0
- package/dist/checks/quality/data-integrity/numeric-validation.d.ts.map +1 -0
- package/dist/checks/quality/data-integrity/numeric-validation.js +409 -0
- package/dist/checks/quality/data-integrity/numeric-validation.js.map +1 -0
- package/dist/checks/quality/frontend/a11y-form-labels.d.ts +14 -0
- package/dist/checks/quality/frontend/a11y-form-labels.d.ts.map +1 -0
- package/dist/checks/quality/frontend/a11y-form-labels.js +93 -0
- package/dist/checks/quality/frontend/a11y-form-labels.js.map +1 -0
- package/dist/checks/quality/frontend/a11y-semantic-html.d.ts +14 -0
- package/dist/checks/quality/frontend/a11y-semantic-html.d.ts.map +1 -0
- package/dist/checks/quality/frontend/a11y-semantic-html.js +88 -0
- package/dist/checks/quality/frontend/a11y-semantic-html.js.map +1 -0
- package/dist/checks/quality/frontend/index.d.ts +4 -0
- package/dist/checks/quality/frontend/index.d.ts.map +1 -0
- package/dist/checks/quality/frontend/index.js +4 -0
- package/dist/checks/quality/frontend/index.js.map +1 -0
- package/dist/checks/quality/frontend/test-only-frontend-modules.d.ts +13 -0
- package/dist/checks/quality/frontend/test-only-frontend-modules.d.ts.map +1 -0
- package/dist/checks/quality/frontend/test-only-frontend-modules.js +159 -0
- package/dist/checks/quality/frontend/test-only-frontend-modules.js.map +1 -0
- package/dist/checks/quality/incomplete-regex-escaping.d.ts +13 -0
- package/dist/checks/quality/incomplete-regex-escaping.d.ts.map +1 -0
- package/dist/checks/quality/incomplete-regex-escaping.js +207 -0
- package/dist/checks/quality/incomplete-regex-escaping.js.map +1 -0
- package/dist/checks/quality/index.d.ts +11 -0
- package/dist/checks/quality/index.d.ts.map +1 -0
- package/dist/checks/quality/index.js +11 -0
- package/dist/checks/quality/index.js.map +1 -0
- package/dist/checks/quality/linting/index.d.ts +2 -0
- package/dist/checks/quality/linting/index.d.ts.map +1 -0
- package/dist/checks/quality/linting/index.js +2 -0
- package/dist/checks/quality/linting/index.js.map +1 -0
- package/dist/checks/quality/linting/typescript-frontend.d.ts +25 -0
- package/dist/checks/quality/linting/typescript-frontend.d.ts.map +1 -0
- package/dist/checks/quality/linting/typescript-frontend.js +159 -0
- package/dist/checks/quality/linting/typescript-frontend.js.map +1 -0
- package/dist/checks/quality/observability/index.d.ts +5 -0
- package/dist/checks/quality/observability/index.d.ts.map +1 -0
- package/dist/checks/quality/observability/index.js +5 -0
- package/dist/checks/quality/observability/index.js.map +1 -0
- package/dist/checks/quality/observability/logger-event-name-format.d.ts +12 -0
- package/dist/checks/quality/observability/logger-event-name-format.d.ts.map +1 -0
- package/dist/checks/quality/observability/logger-event-name-format.js +124 -0
- package/dist/checks/quality/observability/logger-event-name-format.js.map +1 -0
- package/dist/checks/quality/observability/no-hardcoded-correlation-id.d.ts +5 -0
- package/dist/checks/quality/observability/no-hardcoded-correlation-id.d.ts.map +1 -0
- package/dist/checks/quality/observability/no-hardcoded-correlation-id.js +77 -0
- package/dist/checks/quality/observability/no-hardcoded-correlation-id.js.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.d.ts +11 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.d.ts.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.js +107 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/analyzer.test.js.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.d.ts +12 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.d.ts.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.js +94 -0
- package/dist/checks/quality/observability/observability-coverage/__tests__/logger-detector.test.js.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/analyzer.d.ts +13 -0
- package/dist/checks/quality/observability/observability-coverage/analyzer.d.ts.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/analyzer.js +117 -0
- package/dist/checks/quality/observability/observability-coverage/analyzer.js.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/index.d.ts +4 -0
- package/dist/checks/quality/observability/observability-coverage/index.d.ts.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/index.js +4 -0
- package/dist/checks/quality/observability/observability-coverage/index.js.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/logger-detector.d.ts +29 -0
- package/dist/checks/quality/observability/observability-coverage/logger-detector.d.ts.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/logger-detector.js +111 -0
- package/dist/checks/quality/observability/observability-coverage/logger-detector.js.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/types.d.ts +64 -0
- package/dist/checks/quality/observability/observability-coverage/types.d.ts.map +1 -0
- package/dist/checks/quality/observability/observability-coverage/types.js +6 -0
- package/dist/checks/quality/observability/observability-coverage/types.js.map +1 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.d.ts +22 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.d.ts.map +1 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.js +212 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.js.map +1 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.test.d.ts +11 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.test.d.ts.map +1 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.test.js +46 -0
- package/dist/checks/quality/observability/pii-exposure-in-logs.test.js.map +1 -0
- package/dist/checks/quality/patterns/__tests__/toctou-fp.test.d.ts +14 -0
- package/dist/checks/quality/patterns/__tests__/toctou-fp.test.d.ts.map +1 -0
- package/dist/checks/quality/patterns/__tests__/toctou-fp.test.js +61 -0
- package/dist/checks/quality/patterns/__tests__/toctou-fp.test.js.map +1 -0
- package/dist/checks/quality/patterns/async-waterfall-detection.d.ts +26 -0
- package/dist/checks/quality/patterns/async-waterfall-detection.d.ts.map +1 -0
- package/dist/checks/quality/patterns/async-waterfall-detection.js +410 -0
- package/dist/checks/quality/patterns/async-waterfall-detection.js.map +1 -0
- package/dist/checks/quality/patterns/dispose-pattern-completeness.d.ts +13 -0
- package/dist/checks/quality/patterns/dispose-pattern-completeness.d.ts.map +1 -0
- package/dist/checks/quality/patterns/dispose-pattern-completeness.js +220 -0
- package/dist/checks/quality/patterns/dispose-pattern-completeness.js.map +1 -0
- package/dist/checks/quality/patterns/error-handling-quality.d.ts +17 -0
- package/dist/checks/quality/patterns/error-handling-quality.d.ts.map +1 -0
- package/dist/checks/quality/patterns/error-handling-quality.js +335 -0
- package/dist/checks/quality/patterns/error-handling-quality.js.map +1 -0
- package/dist/checks/quality/patterns/index.d.ts +10 -0
- package/dist/checks/quality/patterns/index.d.ts.map +1 -0
- package/dist/checks/quality/patterns/index.js +10 -0
- package/dist/checks/quality/patterns/index.js.map +1 -0
- package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.d.ts +16 -0
- package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.d.ts.map +1 -0
- package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.js +205 -0
- package/dist/checks/quality/patterns/lifecycle-cleanup-enforcement.js.map +1 -0
- package/dist/checks/quality/patterns/result-pattern-consistency.d.ts +16 -0
- package/dist/checks/quality/patterns/result-pattern-consistency.d.ts.map +1 -0
- package/dist/checks/quality/patterns/result-pattern-consistency.js +328 -0
- package/dist/checks/quality/patterns/result-pattern-consistency.js.map +1 -0
- package/dist/checks/quality/patterns/silent-early-returns.d.ts +23 -0
- package/dist/checks/quality/patterns/silent-early-returns.d.ts.map +1 -0
- package/dist/checks/quality/patterns/silent-early-returns.js +266 -0
- package/dist/checks/quality/patterns/silent-early-returns.js.map +1 -0
- package/dist/checks/quality/patterns/stream-buffer-size-limits.d.ts +13 -0
- package/dist/checks/quality/patterns/stream-buffer-size-limits.d.ts.map +1 -0
- package/dist/checks/quality/patterns/stream-buffer-size-limits.js +163 -0
- package/dist/checks/quality/patterns/stream-buffer-size-limits.js.map +1 -0
- package/dist/checks/quality/patterns/throws-documentation.d.ts +23 -0
- package/dist/checks/quality/patterns/throws-documentation.d.ts.map +1 -0
- package/dist/checks/quality/patterns/throws-documentation.js +519 -0
- package/dist/checks/quality/patterns/throws-documentation.js.map +1 -0
- package/dist/checks/quality/patterns/toctou-race-condition.d.ts +48 -0
- package/dist/checks/quality/patterns/toctou-race-condition.d.ts.map +1 -0
- package/dist/checks/quality/patterns/toctou-race-condition.js +639 -0
- package/dist/checks/quality/patterns/toctou-race-condition.js.map +1 -0
- package/dist/checks/quality/stubbed-implementation-detection.d.ts +24 -0
- package/dist/checks/quality/stubbed-implementation-detection.d.ts.map +1 -0
- package/dist/checks/quality/stubbed-implementation-detection.js +355 -0
- package/dist/checks/quality/stubbed-implementation-detection.js.map +1 -0
- package/dist/checks/quality/unused-config-options.d.ts +12 -0
- package/dist/checks/quality/unused-config-options.d.ts.map +1 -0
- package/dist/checks/quality/unused-config-options.js +245 -0
- package/dist/checks/quality/unused-config-options.js.map +1 -0
- package/dist/checks/resilience/__tests__/callback-invocation-safe.test.d.ts +2 -0
- package/dist/checks/resilience/__tests__/callback-invocation-safe.test.d.ts.map +1 -0
- package/dist/checks/resilience/__tests__/callback-invocation-safe.test.js +79 -0
- package/dist/checks/resilience/__tests__/callback-invocation-safe.test.js.map +1 -0
- package/dist/checks/resilience/__tests__/context-leakage-fp.test.d.ts +12 -0
- package/dist/checks/resilience/__tests__/context-leakage-fp.test.d.ts.map +1 -0
- package/dist/checks/resilience/__tests__/context-leakage-fp.test.js +34 -0
- package/dist/checks/resilience/__tests__/context-leakage-fp.test.js.map +1 -0
- package/dist/checks/resilience/__tests__/context-mutation.test.d.ts +11 -0
- package/dist/checks/resilience/__tests__/context-mutation.test.d.ts.map +1 -0
- package/dist/checks/resilience/__tests__/context-mutation.test.js +54 -0
- package/dist/checks/resilience/__tests__/context-mutation.test.js.map +1 -0
- package/dist/checks/resilience/callback-invocation-safe.d.ts +34 -0
- package/dist/checks/resilience/callback-invocation-safe.d.ts.map +1 -0
- package/dist/checks/resilience/callback-invocation-safe.js +247 -0
- package/dist/checks/resilience/callback-invocation-safe.js.map +1 -0
- package/dist/checks/resilience/context-leakage.d.ts +25 -0
- package/dist/checks/resilience/context-leakage.d.ts.map +1 -0
- package/dist/checks/resilience/context-leakage.js +435 -0
- package/dist/checks/resilience/context-leakage.js.map +1 -0
- package/dist/checks/resilience/context-mutation.d.ts +21 -0
- package/dist/checks/resilience/context-mutation.d.ts.map +1 -0
- package/dist/checks/resilience/context-mutation.js +368 -0
- package/dist/checks/resilience/context-mutation.js.map +1 -0
- package/dist/checks/resilience/detached-promises.d.ts +40 -0
- package/dist/checks/resilience/detached-promises.d.ts.map +1 -0
- package/dist/checks/resilience/detached-promises.js +646 -0
- package/dist/checks/resilience/detached-promises.js.map +1 -0
- package/dist/checks/resilience/index.d.ts +7 -0
- package/dist/checks/resilience/index.d.ts.map +1 -0
- package/dist/checks/resilience/index.js +7 -0
- package/dist/checks/resilience/index.js.map +1 -0
- package/dist/checks/resilience/no-raw-fetch.d.ts +11 -0
- package/dist/checks/resilience/no-raw-fetch.d.ts.map +1 -0
- package/dist/checks/resilience/no-raw-fetch.js +110 -0
- package/dist/checks/resilience/no-raw-fetch.js.map +1 -0
- package/dist/checks/resilience/no-unbounded-concurrency.d.ts +11 -0
- package/dist/checks/resilience/no-unbounded-concurrency.d.ts.map +1 -0
- package/dist/checks/resilience/no-unbounded-concurrency.js +117 -0
- package/dist/checks/resilience/no-unbounded-concurrency.js.map +1 -0
- package/dist/checks/security/__tests__/sql-injection.test.d.ts +17 -0
- package/dist/checks/security/__tests__/sql-injection.test.d.ts.map +1 -0
- package/dist/checks/security/__tests__/sql-injection.test.js +97 -0
- package/dist/checks/security/__tests__/sql-injection.test.js.map +1 -0
- package/dist/checks/security/index.d.ts +4 -0
- package/dist/checks/security/index.d.ts.map +1 -0
- package/dist/checks/security/index.js +4 -0
- package/dist/checks/security/index.js.map +1 -0
- package/dist/checks/security/input-sanitization.d.ts +20 -0
- package/dist/checks/security/input-sanitization.d.ts.map +1 -0
- package/dist/checks/security/input-sanitization.js +255 -0
- package/dist/checks/security/input-sanitization.js.map +1 -0
- package/dist/checks/security/sql-injection.d.ts +24 -0
- package/dist/checks/security/sql-injection.d.ts.map +1 -0
- package/dist/checks/security/sql-injection.js +330 -0
- package/dist/checks/security/sql-injection.js.map +1 -0
- package/dist/checks/security/unsafe-secret-comparison.d.ts +17 -0
- package/dist/checks/security/unsafe-secret-comparison.d.ts.map +1 -0
- package/dist/checks/security/unsafe-secret-comparison.js +227 -0
- package/dist/checks/security/unsafe-secret-comparison.js.map +1 -0
- package/dist/checks/testing/index.d.ts +2 -0
- package/dist/checks/testing/index.d.ts.map +1 -0
- package/dist/checks/testing/index.js +2 -0
- package/dist/checks/testing/index.js.map +1 -0
- package/dist/checks/testing/mock-implementations-in-production.d.ts +12 -0
- package/dist/checks/testing/mock-implementations-in-production.d.ts.map +1 -0
- package/dist/checks/testing/mock-implementations-in-production.js +211 -0
- package/dist/checks/testing/mock-implementations-in-production.js.map +1 -0
- package/dist/display/architecture.d.ts +9 -0
- package/dist/display/architecture.d.ts.map +1 -0
- package/dist/display/architecture.js +18 -0
- package/dist/display/architecture.js.map +1 -0
- package/dist/display/index.d.ts +20 -0
- package/dist/display/index.d.ts.map +1 -0
- package/dist/display/index.js +30 -0
- package/dist/display/index.js.map +1 -0
- package/dist/display/quality.d.ts +7 -0
- package/dist/display/quality.d.ts.map +1 -0
- package/dist/display/quality.js +39 -0
- package/dist/display/quality.js.map +1 -0
- package/dist/display/resilience.d.ts +7 -0
- package/dist/display/resilience.d.ts.map +1 -0
- package/dist/display/resilience.js +13 -0
- package/dist/display/resilience.js.map +1 -0
- package/dist/display/security-testing.d.ts +9 -0
- package/dist/display/security-testing.d.ts.map +1 -0
- package/dist/display/security-testing.js +14 -0
- package/dist/display/security-testing.js.map +1 -0
- package/dist/display/types.d.ts +6 -0
- package/dist/display/types.d.ts.map +1 -0
- package/dist/display/types.js +6 -0
- package/dist/display/types.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Regression tests for two `null-safety` FP fixes.
|
|
3
|
+
*
|
|
4
|
+
* 1. Cross-line guard: a property access guarded by an enclosing `if` / `&&`
|
|
5
|
+
* on a PREVIOUS line (e.g. `if (candidates.length === 1 && candidates[0])
|
|
6
|
+
* { … candidates[0].bodyHash … }`) was flagged because the safety scan was
|
|
7
|
+
* line-local. The fix walks enclosing conditions.
|
|
8
|
+
* 2. Immutable combinators: `.merge(...)` chained on a factory result
|
|
9
|
+
* (e.g. OTel `detectResources(...).merge(...)`) returns a non-null value
|
|
10
|
+
* and is now a known-safe fluent method.
|
|
11
|
+
*
|
|
12
|
+
* Genuine unguarded access on a call/element result must still fire.
|
|
13
|
+
*/
|
|
14
|
+
import { describe, expect, it } from 'vitest';
|
|
15
|
+
import { analyzeNullSafety } from '../null-safety.js';
|
|
16
|
+
function analyze(src) {
|
|
17
|
+
return analyzeNullSafety(src, 'src/svc/sample.ts');
|
|
18
|
+
}
|
|
19
|
+
describe('null-safety — FP regression suite', () => {
|
|
20
|
+
it('does NOT flag element access guarded by an enclosing if on a previous line', () => {
|
|
21
|
+
const src = `
|
|
22
|
+
function pick(candidates: { bodyHash: string }[]) {
|
|
23
|
+
if (candidates.length === 1 && candidates[0]) {
|
|
24
|
+
return [candidates[0].bodyHash];
|
|
25
|
+
}
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
expect(analyze(src)).toHaveLength(0);
|
|
30
|
+
});
|
|
31
|
+
it('does NOT flag `.merge(...)` chained on a factory call result', () => {
|
|
32
|
+
const src = `
|
|
33
|
+
function build() {
|
|
34
|
+
const resource = detectResources({ detectors: [envDetector] }).merge(
|
|
35
|
+
resourceFromAttributes({ name: 'svc' }),
|
|
36
|
+
);
|
|
37
|
+
return resource;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
expect(analyze(src)).toHaveLength(0);
|
|
41
|
+
});
|
|
42
|
+
it('STILL flags an unguarded property access on an element-access result', () => {
|
|
43
|
+
const src = `
|
|
44
|
+
function firstHash(rows: { bodyHash: string }[]) {
|
|
45
|
+
return rows[0].bodyHash;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
expect(analyze(src).length).toBeGreaterThan(0);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=null-safety-fp.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"null-safety-fp.test.js","sourceRoot":"","sources":["../../../../../src/checks/quality/data-integrity/__tests__/null-safety-fp.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;AACrD,CAAC;AAED,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,EAAE,CAAC,4EAA4E,EAAE,GAAG,EAAE;QACpF,MAAM,GAAG,GAAG;;;;;;;KAOX,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,GAAG,GAAG;;;;;;;KAOX,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC9E,MAAM,GAAG,GAAG;;;;KAIX,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Array Parameter Validation Check
|
|
3
|
+
*
|
|
4
|
+
* Detects array parameters without proper validation.
|
|
5
|
+
* Ensures arrays are validated for length, type, and content before processing.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Check: quality/array-validation
|
|
10
|
+
*
|
|
11
|
+
* Detects array parameters without proper validation to prevent
|
|
12
|
+
* runtime errors from unvalidated array inputs.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export declare const arrayValidation: import("@opensip-cli/fitness").Check;
|
|
16
|
+
//# sourceMappingURL=array-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array-validation.d.ts","sourceRoot":"","sources":["../../../../src/checks/quality/data-integrity/array-validation.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAqgBH;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,sCA4B1B,CAAC"}
|
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- cohesive single-check module; splitting risks breaking the detector contract
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Array Parameter Validation Check
|
|
4
|
+
*
|
|
5
|
+
* Detects array parameters without proper validation.
|
|
6
|
+
* Ensures arrays are validated for length, type, and content before processing.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
import { defineCheck, isTestFile } from '@opensip-cli/fitness';
|
|
10
|
+
import { getSharedSourceFile } from '@opensip-cli/lang-typescript';
|
|
11
|
+
import * as ts from 'typescript';
|
|
12
|
+
/**
|
|
13
|
+
* Quick filter keywords for array validation patterns
|
|
14
|
+
*/
|
|
15
|
+
const QUICK_FILTER_KEYWORDS = [
|
|
16
|
+
'[]',
|
|
17
|
+
'Array',
|
|
18
|
+
'array',
|
|
19
|
+
'.length',
|
|
20
|
+
'.push',
|
|
21
|
+
'.pop',
|
|
22
|
+
'.map(',
|
|
23
|
+
'.filter(',
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* Paths where array validation requirements are relaxed
|
|
27
|
+
*/
|
|
28
|
+
const RELAXED_VALIDATION_PATHS = [
|
|
29
|
+
/\/internal\//,
|
|
30
|
+
/\/utils\//,
|
|
31
|
+
/\/helpers\//,
|
|
32
|
+
/\/cli\//,
|
|
33
|
+
/\/scripts\//,
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Type patterns that indicate complex/nested types where validation is harder to detect
|
|
37
|
+
*/
|
|
38
|
+
const COMPLEX_TYPE_PATTERNS = [
|
|
39
|
+
'Record<',
|
|
40
|
+
'Map<',
|
|
41
|
+
'=> ', // Function type
|
|
42
|
+
': (', // Function type with parens
|
|
43
|
+
'Promise<', // Async wrappers
|
|
44
|
+
'Observable<',
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* Check whether a parameter's type is a top-level array type (e.g. `string[]`, `Array<T>`)
|
|
48
|
+
* as opposed to an object/interface/intersection type that merely _contains_ array-typed
|
|
49
|
+
* properties (e.g. `{ items: string[] }`, `Foo & { tags: string[] }`).
|
|
50
|
+
*
|
|
51
|
+
* This uses the TypeScript AST node kind rather than text matching, eliminating false
|
|
52
|
+
* positives for object parameters whose nested properties happen to be arrays.
|
|
53
|
+
*/
|
|
54
|
+
function isTopLevelArrayType(typeNode) {
|
|
55
|
+
// Direct array type: `string[]`, `Foo[]`
|
|
56
|
+
if (ts.isArrayTypeNode(typeNode)) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
// Generic Array reference: `Array<string>`, `ReadonlyArray<Foo>`
|
|
60
|
+
if (ts.isTypeReferenceNode(typeNode)) {
|
|
61
|
+
const typeName = typeNode.typeName;
|
|
62
|
+
if (ts.isIdentifier(typeName)) {
|
|
63
|
+
const name = typeName.text;
|
|
64
|
+
if (name === 'Array' || name === 'ReadonlyArray') {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Union type: check if ALL branches are arrays (e.g. `string[] | number[]`)
|
|
70
|
+
if (ts.isUnionTypeNode(typeNode)) {
|
|
71
|
+
return typeNode.types.length > 0 && typeNode.types.every((t) => isTopLevelArrayType(t));
|
|
72
|
+
}
|
|
73
|
+
// Parenthesized type: unwrap `(string[])`
|
|
74
|
+
if (ts.isParenthesizedTypeNode(typeNode)) {
|
|
75
|
+
return isTopLevelArrayType(typeNode.type);
|
|
76
|
+
}
|
|
77
|
+
// Everything else (object literals, intersection types, type references to interfaces,
|
|
78
|
+
// mapped types, conditional types, etc.) is NOT a top-level array even if the type
|
|
79
|
+
// text contains `[]` in nested positions.
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if a file path is in a relaxed validation context
|
|
84
|
+
*/
|
|
85
|
+
function isRelaxedValidationPath(filePath) {
|
|
86
|
+
return RELAXED_VALIDATION_PATHS.some((pattern) => pattern.test(filePath));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Check if a type is a complex nested type where validation detection is unreliable
|
|
90
|
+
*/
|
|
91
|
+
function isComplexNestedType(typeText) {
|
|
92
|
+
return COMPLEX_TYPE_PATTERNS.some((pattern) => typeText.includes(pattern));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Check if node is a .length access on the parameter
|
|
96
|
+
* @param node - The TypeScript AST node to check
|
|
97
|
+
* @param paramName - The name of the parameter to check for
|
|
98
|
+
* @param sourceFile - The TypeScript source file for text extraction
|
|
99
|
+
* @returns True if the node is a .length access on the specified parameter
|
|
100
|
+
*/
|
|
101
|
+
function isLengthAccess(node, paramName, sourceFile) {
|
|
102
|
+
if (!ts.isPropertyAccessExpression(node))
|
|
103
|
+
return false;
|
|
104
|
+
const objName = node.expression.getText(sourceFile);
|
|
105
|
+
const propName = node.name.getText(sourceFile);
|
|
106
|
+
return objName === paramName && propName === 'length';
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check if node is an Array.isArray() call on the parameter
|
|
110
|
+
* @param node - The TypeScript AST node to check
|
|
111
|
+
* @param paramName - The name of the parameter to check for
|
|
112
|
+
* @param sourceFile - The TypeScript source file for text extraction
|
|
113
|
+
* @returns True if the node is an Array.isArray() call on the specified parameter
|
|
114
|
+
*/
|
|
115
|
+
function isArrayIsArrayCall(node, paramName, sourceFile) {
|
|
116
|
+
if (!ts.isCallExpression(node))
|
|
117
|
+
return false;
|
|
118
|
+
const callText = node.expression.getText(sourceFile);
|
|
119
|
+
if (callText !== 'Array.isArray')
|
|
120
|
+
return false;
|
|
121
|
+
const arg = node.arguments[0]?.getText(sourceFile);
|
|
122
|
+
return arg === paramName;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Check if node is a Zod schema validation call
|
|
126
|
+
* @param node - The TypeScript AST node to check
|
|
127
|
+
* @param sourceFile - The TypeScript source file for text extraction
|
|
128
|
+
* @returns True if the node is a Zod .parse() or .safeParse() call
|
|
129
|
+
*/
|
|
130
|
+
function isZodValidationCall(node, sourceFile) {
|
|
131
|
+
if (!ts.isCallExpression(node))
|
|
132
|
+
return false;
|
|
133
|
+
if (!ts.isPropertyAccessExpression(node.expression))
|
|
134
|
+
return false;
|
|
135
|
+
const methodName = node.expression.name.getText(sourceFile);
|
|
136
|
+
return methodName === 'parse' || methodName === 'safeParse';
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Check if node is a validation function call
|
|
140
|
+
* @param node - The TypeScript AST node to check
|
|
141
|
+
* @returns True if the node is a call to a function with 'validate' or 'check' in its name
|
|
142
|
+
*/
|
|
143
|
+
function isValidationFunctionCall(node) {
|
|
144
|
+
if (!ts.isCallExpression(node))
|
|
145
|
+
return false;
|
|
146
|
+
if (!ts.isIdentifier(node.expression))
|
|
147
|
+
return false;
|
|
148
|
+
const funcName = node.expression.text.toLowerCase();
|
|
149
|
+
return funcName.includes('validate') || funcName.includes('check');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Check if node is an iteration over the parameter (for...of, forEach, map, filter,
|
|
153
|
+
* slice, includes, join, indexOf, concat, flat, etc.)
|
|
154
|
+
*
|
|
155
|
+
* Iteration implies validation because it handles empty arrays gracefully and
|
|
156
|
+
* cannot blow up the runtime — the worst case is no work done.
|
|
157
|
+
*/
|
|
158
|
+
function isIterationOverParam(node, paramName, sourceFile) {
|
|
159
|
+
// for...of statement
|
|
160
|
+
if (ts.isForOfStatement(node)) {
|
|
161
|
+
const iterableText = node.expression.getText(sourceFile);
|
|
162
|
+
if (iterableText === paramName || iterableText.startsWith(`${paramName}.`)) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Array prototype methods that internally iterate (and therefore handle empty
|
|
167
|
+
// arrays gracefully) or otherwise produce a bounded view. These are
|
|
168
|
+
// validation-equivalent because they don't crash on empty/short input.
|
|
169
|
+
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
|
|
170
|
+
const objText = node.expression.expression.getText(sourceFile);
|
|
171
|
+
const methodName = node.expression.name.getText(sourceFile);
|
|
172
|
+
const iterationMethods = [
|
|
173
|
+
'forEach',
|
|
174
|
+
'map',
|
|
175
|
+
'filter',
|
|
176
|
+
'some',
|
|
177
|
+
'every',
|
|
178
|
+
'find',
|
|
179
|
+
'findIndex',
|
|
180
|
+
'findLast',
|
|
181
|
+
'findLastIndex',
|
|
182
|
+
'reduce',
|
|
183
|
+
'reduceRight',
|
|
184
|
+
'flatMap',
|
|
185
|
+
'flat',
|
|
186
|
+
'slice',
|
|
187
|
+
'includes',
|
|
188
|
+
'indexOf',
|
|
189
|
+
'lastIndexOf',
|
|
190
|
+
'join',
|
|
191
|
+
'concat',
|
|
192
|
+
'entries',
|
|
193
|
+
'values',
|
|
194
|
+
'keys',
|
|
195
|
+
'at',
|
|
196
|
+
'toSorted',
|
|
197
|
+
'toReversed',
|
|
198
|
+
'toSpliced',
|
|
199
|
+
'with',
|
|
200
|
+
];
|
|
201
|
+
if (objText === paramName && iterationMethods.includes(methodName)) {
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Check if node is a write-only sink usage of the parameter.
|
|
209
|
+
*
|
|
210
|
+
* Out-array sinks (`bucket.push(...)`, `bucket.unshift(...)`) flag the param
|
|
211
|
+
* as a producer target — the function isn't *consuming* the array, it's
|
|
212
|
+
* writing into it. Validation belongs at the consumer, not the producer.
|
|
213
|
+
*/
|
|
214
|
+
function isOutSinkUsage(node, paramName, sourceFile) {
|
|
215
|
+
if (!ts.isCallExpression(node))
|
|
216
|
+
return false;
|
|
217
|
+
if (!ts.isPropertyAccessExpression(node.expression))
|
|
218
|
+
return false;
|
|
219
|
+
const objText = node.expression.expression.getText(sourceFile);
|
|
220
|
+
if (objText !== paramName)
|
|
221
|
+
return false;
|
|
222
|
+
const methodName = node.expression.name.getText(sourceFile);
|
|
223
|
+
// Mutating sink methods — caller is producing into the array.
|
|
224
|
+
return methodName === 'push' || methodName === 'unshift' || methodName === 'splice';
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Check if node is indexed access on the parameter (`param[i]`).
|
|
228
|
+
*
|
|
229
|
+
* Indexed access on a typed array yields `T | undefined` under
|
|
230
|
+
* `noUncheckedIndexedAccess`; under any reasonable consumer it implies
|
|
231
|
+
* defensive use and cannot crash on empty/short input the way an
|
|
232
|
+
* unconditional `.length`-less iteration would. Practically: if the body
|
|
233
|
+
* does `param[i]`, the author has already structured the access around
|
|
234
|
+
* length (or expects undefined).
|
|
235
|
+
*/
|
|
236
|
+
function isIndexedAccess(node, paramName, sourceFile) {
|
|
237
|
+
if (!ts.isElementAccessExpression(node))
|
|
238
|
+
return false;
|
|
239
|
+
return node.expression.getText(sourceFile) === paramName;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Check if node is a spread of the parameter (`...param`) inside a call
|
|
243
|
+
* argument list, array literal, or object literal.
|
|
244
|
+
*
|
|
245
|
+
* Spread iterates the array — equivalent to `for...of`.
|
|
246
|
+
*/
|
|
247
|
+
function isSpreadOfParam(node, paramName, sourceFile) {
|
|
248
|
+
if (ts.isSpreadElement(node) || ts.isSpreadAssignment(node)) {
|
|
249
|
+
return node.expression.getText(sourceFile) === paramName;
|
|
250
|
+
}
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Check if node passes the parameter through to another function call.
|
|
255
|
+
*
|
|
256
|
+
* A pure pass-through forwarder (`return otherFn(..., param, ...)`) defers
|
|
257
|
+
* validation to the destination function — flagging the forwarder is a false
|
|
258
|
+
* positive, since the wrapper has nothing to validate against. The destination
|
|
259
|
+
* function (which actually consumes the array) is the meaningful validation
|
|
260
|
+
* site.
|
|
261
|
+
*
|
|
262
|
+
* Restricted to call-argument position (not the callee position) so we don't
|
|
263
|
+
* match the param being treated as a function.
|
|
264
|
+
*/
|
|
265
|
+
function isForwardedToCall(node, paramName, _sourceFile) {
|
|
266
|
+
if (!ts.isCallExpression(node) && !ts.isNewExpression(node))
|
|
267
|
+
return false;
|
|
268
|
+
const args = node.arguments;
|
|
269
|
+
/* v8 ignore next -- defensive AST/type guard */
|
|
270
|
+
if (!args)
|
|
271
|
+
return false;
|
|
272
|
+
for (const arg of args) {
|
|
273
|
+
if (ts.isIdentifier(arg) && arg.text === paramName) {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
// `Array.from(param)`, `[...param]`, etc. handled by isSpreadOfParam.
|
|
277
|
+
// Type-cast forwards: `someFn(param as Foo)` or `someFn(param satisfies Foo)`.
|
|
278
|
+
if (ts.isAsExpression(arg) || ts.isSatisfiesExpression(arg)) {
|
|
279
|
+
const inner = arg.expression;
|
|
280
|
+
if (ts.isIdentifier(inner) && inner.text === paramName) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Check if node is a property-shorthand reference to the parameter inside
|
|
289
|
+
* an object literal (`return { param }`).
|
|
290
|
+
*
|
|
291
|
+
* The param value is being copied by reference into a result object — no
|
|
292
|
+
* iteration, no boundary crossing, the consumer of the returned object is
|
|
293
|
+
* the meaningful validation site (same logic as `isForwardedToCall`).
|
|
294
|
+
*/
|
|
295
|
+
function isShorthandPropertyReference(node, paramName) {
|
|
296
|
+
if (!ts.isShorthandPropertyAssignment(node))
|
|
297
|
+
return false;
|
|
298
|
+
return node.name.text === paramName;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Check if node is an optional chaining or nullish coalescing on the parameter
|
|
302
|
+
*/
|
|
303
|
+
function isOptionalHandling(node, paramName, sourceFile) {
|
|
304
|
+
const nodeText = node.getText(sourceFile);
|
|
305
|
+
// Optional chaining: param?.length, param?.map
|
|
306
|
+
if (nodeText.includes(`${paramName}?.`)) {
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
/* v8 ignore next -- defensive nullish fallback */
|
|
310
|
+
// Nullish coalescing: param ?? []
|
|
311
|
+
if (ts.isBinaryExpression(node) &&
|
|
312
|
+
node.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken) {
|
|
313
|
+
const leftText = node.left.getText(sourceFile);
|
|
314
|
+
if (leftText === paramName) {
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Check if function body contains array validation for the parameter
|
|
322
|
+
* @param node - The function declaration, method, or arrow function node
|
|
323
|
+
* @param param - The parameter declaration to check for validation
|
|
324
|
+
* @param sourceFile - The TypeScript source file for text extraction
|
|
325
|
+
* @returns True if the function body contains validation for the array parameter
|
|
326
|
+
*/
|
|
327
|
+
function checkForArrayValidation(node, param, sourceFile) {
|
|
328
|
+
/* v8 ignore next -- defensive guard */
|
|
329
|
+
if (!node.body)
|
|
330
|
+
return false;
|
|
331
|
+
const paramName = ts.isIdentifier(param.name) ? param.name.text : null;
|
|
332
|
+
/* v8 ignore next -- defensive AST/type guard */
|
|
333
|
+
if (!paramName)
|
|
334
|
+
return true; // Destructured params are harder to track, assume validated
|
|
335
|
+
// Underscore-prefixed params are an established TS convention for
|
|
336
|
+
// "intentionally unused" — the body does not consume them, so demanding
|
|
337
|
+
// validation is meaningless.
|
|
338
|
+
if (paramName.startsWith('_'))
|
|
339
|
+
return true;
|
|
340
|
+
let hasValidation = false;
|
|
341
|
+
const visit = (n) => {
|
|
342
|
+
if (isLengthAccess(n, paramName, sourceFile)) {
|
|
343
|
+
hasValidation = true;
|
|
344
|
+
}
|
|
345
|
+
if (isArrayIsArrayCall(n, paramName, sourceFile)) {
|
|
346
|
+
hasValidation = true;
|
|
347
|
+
}
|
|
348
|
+
if (isZodValidationCall(n, sourceFile)) {
|
|
349
|
+
hasValidation = true;
|
|
350
|
+
}
|
|
351
|
+
if (isValidationFunctionCall(n)) {
|
|
352
|
+
hasValidation = true;
|
|
353
|
+
}
|
|
354
|
+
// Iteration patterns imply graceful handling of arrays
|
|
355
|
+
if (isIterationOverParam(n, paramName, sourceFile)) {
|
|
356
|
+
hasValidation = true;
|
|
357
|
+
}
|
|
358
|
+
// Optional chaining/nullish coalescing implies null safety
|
|
359
|
+
if (isOptionalHandling(n, paramName, sourceFile)) {
|
|
360
|
+
hasValidation = true;
|
|
361
|
+
}
|
|
362
|
+
// Out-array sinks (param.push(...)) — param is a producer target, not a
|
|
363
|
+
// consumer input. Validation belongs at the consumer.
|
|
364
|
+
if (isOutSinkUsage(n, paramName, sourceFile)) {
|
|
365
|
+
hasValidation = true;
|
|
366
|
+
}
|
|
367
|
+
// Indexed access (param[i]) — defensive, bounded by author intent.
|
|
368
|
+
if (isIndexedAccess(n, paramName, sourceFile)) {
|
|
369
|
+
hasValidation = true;
|
|
370
|
+
}
|
|
371
|
+
// Spread (...param) — iterates the array, equivalent to for...of.
|
|
372
|
+
if (isSpreadOfParam(n, paramName, sourceFile)) {
|
|
373
|
+
hasValidation = true;
|
|
374
|
+
}
|
|
375
|
+
// Forwarded to another call — destination owns validation.
|
|
376
|
+
if (isForwardedToCall(n, paramName, sourceFile)) {
|
|
377
|
+
hasValidation = true;
|
|
378
|
+
}
|
|
379
|
+
// Property-shorthand reference ({ param }) — pass-through into a result
|
|
380
|
+
// object; consumer of the result owns validation.
|
|
381
|
+
if (isShorthandPropertyReference(n, paramName)) {
|
|
382
|
+
hasValidation = true;
|
|
383
|
+
}
|
|
384
|
+
if (!hasValidation) {
|
|
385
|
+
ts.forEachChild(n, visit);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
visit(node.body);
|
|
389
|
+
return hasValidation;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Check function parameters for unvalidated arrays
|
|
393
|
+
* Note: Ignore directives are handled at the framework level in defineCheck()
|
|
394
|
+
* @param {CheckFunctionArrayParamsOptions} options - The check options
|
|
395
|
+
* @returns Array of violations
|
|
396
|
+
*/
|
|
397
|
+
function checkFunctionArrayParams(options) {
|
|
398
|
+
const { node, sourceFile, absolutePath } = options;
|
|
399
|
+
const violations = [];
|
|
400
|
+
// Skip files in relaxed validation paths
|
|
401
|
+
if (isRelaxedValidationPath(absolutePath)) {
|
|
402
|
+
return violations;
|
|
403
|
+
}
|
|
404
|
+
// Skip abstract methods (can't have validation in body)
|
|
405
|
+
if (ts.isMethodDeclaration(node) &&
|
|
406
|
+
node.modifiers?.some((m) => m.kind === ts.SyntaxKind.AbstractKeyword)) {
|
|
407
|
+
return violations;
|
|
408
|
+
}
|
|
409
|
+
// Filter to array parameters without validation
|
|
410
|
+
const unvalidatedArrayParams = node.parameters.filter((param) => {
|
|
411
|
+
if (!param.type)
|
|
412
|
+
return false;
|
|
413
|
+
// Primary gate: use AST to determine if the parameter's type is a top-level
|
|
414
|
+
// array type. Object/interface/intersection types whose *properties* are
|
|
415
|
+
// arrays will correctly return false here, eliminating the largest category
|
|
416
|
+
// of false positives.
|
|
417
|
+
if (!isTopLevelArrayType(param.type))
|
|
418
|
+
return false;
|
|
419
|
+
const typeText = param.type.getText(sourceFile);
|
|
420
|
+
// Secondary gate: skip complex/nested types where validation detection is
|
|
421
|
+
// unreliable (Map values, Record values, function types, Promises, etc.)
|
|
422
|
+
/* v8 ignore next -- defensive AST/type guard */
|
|
423
|
+
if (isComplexNestedType(typeText))
|
|
424
|
+
return false;
|
|
425
|
+
return !checkForArrayValidation(node, param, sourceFile);
|
|
426
|
+
});
|
|
427
|
+
for (const param of unvalidatedArrayParams) {
|
|
428
|
+
const paramName = ts.isIdentifier(param.name) ? param.name.text : '<destructured>';
|
|
429
|
+
const { line: lineIdx, character } = sourceFile.getLineAndCharacterOfPosition(param.getStart());
|
|
430
|
+
const line = lineIdx + 1;
|
|
431
|
+
const paramText = param.getText(sourceFile);
|
|
432
|
+
violations.push({
|
|
433
|
+
line,
|
|
434
|
+
column: character + 1,
|
|
435
|
+
message: `Array parameter '${paramName}' lacks validation`,
|
|
436
|
+
severity: 'warning',
|
|
437
|
+
suggestion: `Add validation for '${paramName}' array: check Array.isArray(), validate .length bounds, and/or use Zod schema for content validation`,
|
|
438
|
+
type: 'missing-array-validation',
|
|
439
|
+
match: paramText,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
return violations;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Analyze a file for array validation issues
|
|
446
|
+
* @param content - The file content as a string
|
|
447
|
+
* @param absolutePath - The absolute path to the file being analyzed
|
|
448
|
+
* @returns Array of violations found in the file
|
|
449
|
+
*/
|
|
450
|
+
function analyzeFile(content, absolutePath) {
|
|
451
|
+
const violations = [];
|
|
452
|
+
// Quick filter: skip files without array-related patterns
|
|
453
|
+
if (!QUICK_FILTER_KEYWORDS.some((kw) => content.includes(kw))) {
|
|
454
|
+
return violations;
|
|
455
|
+
}
|
|
456
|
+
// Note: Ignore directives are handled at the framework level in defineCheck()
|
|
457
|
+
const sourceFile = getSharedSourceFile(absolutePath, content);
|
|
458
|
+
/* v8 ignore next -- defensive guard */
|
|
459
|
+
if (!sourceFile)
|
|
460
|
+
return [];
|
|
461
|
+
const visit = (node) => {
|
|
462
|
+
// Check function parameters with array types
|
|
463
|
+
if (ts.isFunctionDeclaration(node) ||
|
|
464
|
+
ts.isMethodDeclaration(node) ||
|
|
465
|
+
ts.isArrowFunction(node)) {
|
|
466
|
+
violations.push(...checkFunctionArrayParams({ node, sourceFile, absolutePath }));
|
|
467
|
+
}
|
|
468
|
+
ts.forEachChild(node, visit);
|
|
469
|
+
};
|
|
470
|
+
visit(sourceFile);
|
|
471
|
+
return violations;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Check: quality/array-validation
|
|
475
|
+
*
|
|
476
|
+
* Detects array parameters without proper validation to prevent
|
|
477
|
+
* runtime errors from unvalidated array inputs.
|
|
478
|
+
*
|
|
479
|
+
*/
|
|
480
|
+
export const arrayValidation = defineCheck({
|
|
481
|
+
id: 'a9e0e70c-a4af-42e6-bbd7-4c87a72cb7d4',
|
|
482
|
+
slug: 'array-validation',
|
|
483
|
+
scope: { languages: ['typescript'], concerns: ['backend', 'server'] },
|
|
484
|
+
contentFilter: 'strip-strings',
|
|
485
|
+
confidence: 'high',
|
|
486
|
+
description: 'Detect array parameters without proper validation',
|
|
487
|
+
longDescription: `**Purpose:** Ensures function parameters with array types are validated before use, preventing runtime errors from malformed or unexpected array inputs.
|
|
488
|
+
|
|
489
|
+
**Detects:**
|
|
490
|
+
- Function/method/arrow-function parameters whose top-level type is an array (\`string[]\`, \`Array<T>\`) and whose body lacks validation
|
|
491
|
+
- Missing \`Array.isArray()\` checks, \`.length\` bounds checks, Zod \`.parse()\`/\`.safeParse()\` calls, or calls to functions named \`validate\`/\`check\`
|
|
492
|
+
- Uses TypeScript AST node kinds (not text matching) to distinguish true array parameters from object/interface/intersection types that merely contain array-typed properties
|
|
493
|
+
- Skips parameters with complex nested types (\`Record<\`, \`Map<\`, \`Promise<\`, function types)
|
|
494
|
+
- Excludes files under \`/internal/\`, \`/utils/\`, \`/helpers/\`, \`/cli/\`, \`/scripts/\`
|
|
495
|
+
|
|
496
|
+
**Why it matters:** Unvalidated arrays can cause silent data corruption, out-of-bounds errors, or type mismatches at runtime that TypeScript's type system alone cannot prevent.
|
|
497
|
+
|
|
498
|
+
**Scope:** General best practice. Analyzes each file individually.`,
|
|
499
|
+
tags: ['quality', 'validation', 'type-safety', 'arrays'],
|
|
500
|
+
fileTypes: ['ts'],
|
|
501
|
+
analyze(content, filePath) {
|
|
502
|
+
// Skip test files — array parameter validation in tests is low-risk due to controlled inputs
|
|
503
|
+
if (isTestFile(filePath))
|
|
504
|
+
return [];
|
|
505
|
+
return analyzeFile(content, filePath);
|
|
506
|
+
},
|
|
507
|
+
});
|
|
508
|
+
//# sourceMappingURL=array-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array-validation.js","sourceRoot":"","sources":["../../../../src/checks/quality/data-integrity/array-validation.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAuB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC5B,IAAI;IACJ,OAAO;IACP,OAAO;IACP,SAAS;IACT,OAAO;IACP,MAAM;IACN,OAAO;IACP,UAAU;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,wBAAwB,GAAG;IAC/B,cAAc;IACd,WAAW;IACX,aAAa;IACb,SAAS;IACT,aAAa;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC5B,SAAS;IACT,MAAM;IACN,KAAK,EAAE,gBAAgB;IACvB,KAAK,EAAE,4BAA4B;IACnC,UAAU,EAAE,iBAAiB;IAC7B,aAAa;CACd,CAAC;AAEF;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,QAAqB;IAChD,yCAAyC;IACzC,IAAI,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iEAAiE;IACjE,IAAI,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CA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QAAQ,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Database Index Coverage check
|
|
3
|
+
*
|
|
4
|
+
* Validates that database queries have appropriate indexes.
|
|
5
|
+
* Detects queries that may cause full table scans.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check: quality/database-index-coverage
|
|
9
|
+
*
|
|
10
|
+
* Validates that database queries reference indexed columns
|
|
11
|
+
* to prevent performance issues from full table scans.
|
|
12
|
+
*/
|
|
13
|
+
export declare const databaseIndexCoverage: import("@opensip-cli/fitness").Check;
|
|
14
|
+
//# sourceMappingURL=database-index-coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-index-coverage.d.ts","sourceRoot":"","sources":["../../../../src/checks/quality/data-integrity/database-index-coverage.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAiRH;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sCAsBhC,CAAC"}
|