@opensip-cli/checks-universal 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 +17 -0
- package/dist/__tests__/all-checks-execute.test.d.ts.map +1 -0
- package/dist/__tests__/all-checks-execute.test.js +452 -0
- package/dist/__tests__/all-checks-execute.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-10.test.d.ts +8 -0
- package/dist/__tests__/behavior-fixtures-10.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-10.test.js +200 -0
- package/dist/__tests__/behavior-fixtures-10.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-11.test.d.ts +8 -0
- package/dist/__tests__/behavior-fixtures-11.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-11.test.js +120 -0
- package/dist/__tests__/behavior-fixtures-11.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-12.test.d.ts +8 -0
- package/dist/__tests__/behavior-fixtures-12.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-12.test.js +157 -0
- package/dist/__tests__/behavior-fixtures-12.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-2.test.d.ts +8 -0
- package/dist/__tests__/behavior-fixtures-2.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-2.test.js +785 -0
- package/dist/__tests__/behavior-fixtures-2.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-3.test.d.ts +6 -0
- package/dist/__tests__/behavior-fixtures-3.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-3.test.js +663 -0
- package/dist/__tests__/behavior-fixtures-3.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-4.test.d.ts +5 -0
- package/dist/__tests__/behavior-fixtures-4.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-4.test.js +612 -0
- package/dist/__tests__/behavior-fixtures-4.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-5.test.d.ts +5 -0
- package/dist/__tests__/behavior-fixtures-5.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-5.test.js +469 -0
- package/dist/__tests__/behavior-fixtures-5.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-6.test.d.ts +8 -0
- package/dist/__tests__/behavior-fixtures-6.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-6.test.js +591 -0
- package/dist/__tests__/behavior-fixtures-6.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-7.test.d.ts +5 -0
- package/dist/__tests__/behavior-fixtures-7.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-7.test.js +662 -0
- package/dist/__tests__/behavior-fixtures-7.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-8.test.d.ts +11 -0
- package/dist/__tests__/behavior-fixtures-8.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-8.test.js +634 -0
- package/dist/__tests__/behavior-fixtures-8.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures-9.test.d.ts +11 -0
- package/dist/__tests__/behavior-fixtures-9.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures-9.test.js +271 -0
- package/dist/__tests__/behavior-fixtures-9.test.js.map +1 -0
- package/dist/__tests__/behavior-fixtures.test.d.ts +14 -0
- package/dist/__tests__/behavior-fixtures.test.d.ts.map +1 -0
- package/dist/__tests__/behavior-fixtures.test.js +1423 -0
- package/dist/__tests__/behavior-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 +61 -0
- package/dist/__tests__/checks.test.js.map +1 -0
- package/dist/__tests__/env-var-validation.test.d.ts +14 -0
- package/dist/__tests__/env-var-validation.test.d.ts.map +1 -0
- package/dist/__tests__/env-var-validation.test.js +53 -0
- package/dist/__tests__/env-var-validation.test.js.map +1 -0
- package/dist/__tests__/file-length-limit.test.d.ts +2 -0
- package/dist/__tests__/file-length-limit.test.d.ts.map +1 -0
- package/dist/__tests__/file-length-limit.test.js +29 -0
- package/dist/__tests__/file-length-limit.test.js.map +1 -0
- package/dist/__tests__/fixture-coverage.allowlist.d.ts +18 -0
- package/dist/__tests__/fixture-coverage.allowlist.d.ts.map +1 -0
- package/dist/__tests__/fixture-coverage.allowlist.js +35 -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__/iic.test.d.ts +15 -0
- package/dist/__tests__/iic.test.d.ts.map +1 -0
- package/dist/__tests__/iic.test.js +316 -0
- package/dist/__tests__/iic.test.js.map +1 -0
- package/dist/__tests__/no-skipped-tests.test.d.ts +14 -0
- package/dist/__tests__/no-skipped-tests.test.d.ts.map +1 -0
- package/dist/__tests__/no-skipped-tests.test.js +144 -0
- package/dist/__tests__/no-skipped-tests.test.js.map +1 -0
- package/dist/__tests__/no-todo-comments.test.d.ts +2 -0
- package/dist/__tests__/no-todo-comments.test.d.ts.map +1 -0
- package/dist/__tests__/no-todo-comments.test.js +31 -0
- package/dist/__tests__/no-todo-comments.test.js.map +1 -0
- package/dist/__tests__/no-unimplemented-markers.test.d.ts +2 -0
- package/dist/__tests__/no-unimplemented-markers.test.d.ts.map +1 -0
- package/dist/__tests__/no-unimplemented-markers.test.js +140 -0
- package/dist/__tests__/no-unimplemented-markers.test.js.map +1 -0
- package/dist/__tests__/public-api-jsdoc-scope.test.d.ts +10 -0
- package/dist/__tests__/public-api-jsdoc-scope.test.d.ts.map +1 -0
- package/dist/__tests__/public-api-jsdoc-scope.test.js +176 -0
- package/dist/__tests__/public-api-jsdoc-scope.test.js.map +1 -0
- package/dist/__tests__/resilience-fp.test.d.ts +14 -0
- package/dist/__tests__/resilience-fp.test.d.ts.map +1 -0
- package/dist/__tests__/resilience-fp.test.js +110 -0
- package/dist/__tests__/resilience-fp.test.js.map +1 -0
- package/dist/checks/architecture/__tests__/no-kebab-option-indexing.test.d.ts +2 -0
- package/dist/checks/architecture/__tests__/no-kebab-option-indexing.test.d.ts.map +1 -0
- package/dist/checks/architecture/__tests__/no-kebab-option-indexing.test.js +32 -0
- package/dist/checks/architecture/__tests__/no-kebab-option-indexing.test.js.map +1 -0
- package/dist/checks/architecture/__tests__/tool-has-manifest.test.d.ts +2 -0
- package/dist/checks/architecture/__tests__/tool-has-manifest.test.d.ts.map +1 -0
- package/dist/checks/architecture/__tests__/tool-has-manifest.test.js +152 -0
- package/dist/checks/architecture/__tests__/tool-has-manifest.test.js.map +1 -0
- package/dist/checks/architecture/__tests__/vitest-config-required-with-tests.test.d.ts +2 -0
- package/dist/checks/architecture/__tests__/vitest-config-required-with-tests.test.d.ts.map +1 -0
- package/dist/checks/architecture/__tests__/vitest-config-required-with-tests.test.js +129 -0
- package/dist/checks/architecture/__tests__/vitest-config-required-with-tests.test.js.map +1 -0
- package/dist/checks/architecture/_yaml-doc-bindings.d.ts +23 -0
- package/dist/checks/architecture/_yaml-doc-bindings.d.ts.map +1 -0
- package/dist/checks/architecture/_yaml-doc-bindings.js +29 -0
- package/dist/checks/architecture/_yaml-doc-bindings.js.map +1 -0
- package/dist/checks/architecture/dependencies/index.d.ts +2 -0
- package/dist/checks/architecture/dependencies/index.d.ts.map +1 -0
- package/dist/checks/architecture/dependencies/index.js +2 -0
- package/dist/checks/architecture/dependencies/index.js.map +1 -0
- package/dist/checks/architecture/dependencies/no-duplicate-packages.d.ts +11 -0
- package/dist/checks/architecture/dependencies/no-duplicate-packages.d.ts.map +1 -0
- package/dist/checks/architecture/dependencies/no-duplicate-packages.js +171 -0
- package/dist/checks/architecture/dependencies/no-duplicate-packages.js.map +1 -0
- package/dist/checks/architecture/docker-best-practices.d.ts +23 -0
- package/dist/checks/architecture/docker-best-practices.d.ts.map +1 -0
- package/dist/checks/architecture/docker-best-practices.js +427 -0
- package/dist/checks/architecture/docker-best-practices.js.map +1 -0
- package/dist/checks/architecture/docker-ignore-validation.d.ts +18 -0
- package/dist/checks/architecture/docker-ignore-validation.d.ts.map +1 -0
- package/dist/checks/architecture/docker-ignore-validation.js +117 -0
- package/dist/checks/architecture/docker-ignore-validation.js.map +1 -0
- package/dist/checks/architecture/docker-version-sync.d.ts +16 -0
- package/dist/checks/architecture/docker-version-sync.d.ts.map +1 -0
- package/dist/checks/architecture/docker-version-sync.js +193 -0
- package/dist/checks/architecture/docker-version-sync.js.map +1 -0
- package/dist/checks/architecture/env-var-validation.d.ts +14 -0
- package/dist/checks/architecture/env-var-validation.d.ts.map +1 -0
- package/dist/checks/architecture/env-var-validation.js +289 -0
- package/dist/checks/architecture/env-var-validation.js.map +1 -0
- package/dist/checks/architecture/heavy-import-detection.d.ts +11 -0
- package/dist/checks/architecture/heavy-import-detection.d.ts.map +1 -0
- package/dist/checks/architecture/heavy-import-detection.js +91 -0
- package/dist/checks/architecture/heavy-import-detection.js.map +1 -0
- package/dist/checks/architecture/index.d.ts +16 -0
- package/dist/checks/architecture/index.d.ts.map +1 -0
- package/dist/checks/architecture/index.js +16 -0
- package/dist/checks/architecture/index.js.map +1 -0
- package/dist/checks/architecture/modules/empty-package-detection.d.ts +11 -0
- package/dist/checks/architecture/modules/empty-package-detection.d.ts.map +1 -0
- package/dist/checks/architecture/modules/empty-package-detection.js +277 -0
- package/dist/checks/architecture/modules/empty-package-detection.js.map +1 -0
- package/dist/checks/architecture/modules/index.d.ts +3 -0
- package/dist/checks/architecture/modules/index.d.ts.map +1 -0
- package/dist/checks/architecture/modules/index.js +3 -0
- package/dist/checks/architecture/modules/index.js.map +1 -0
- package/dist/checks/architecture/modules/interface-implementation-consistency.d.ts +12 -0
- package/dist/checks/architecture/modules/interface-implementation-consistency.d.ts.map +1 -0
- package/dist/checks/architecture/modules/interface-implementation-consistency.js +555 -0
- package/dist/checks/architecture/modules/interface-implementation-consistency.js.map +1 -0
- package/dist/checks/architecture/no-custom-event-emitter.d.ts +11 -0
- package/dist/checks/architecture/no-custom-event-emitter.d.ts.map +1 -0
- package/dist/checks/architecture/no-custom-event-emitter.js +123 -0
- package/dist/checks/architecture/no-custom-event-emitter.js.map +1 -0
- package/dist/checks/architecture/no-kebab-option-indexing.d.ts +33 -0
- package/dist/checks/architecture/no-kebab-option-indexing.d.ts.map +1 -0
- package/dist/checks/architecture/no-kebab-option-indexing.js +81 -0
- package/dist/checks/architecture/no-kebab-option-indexing.js.map +1 -0
- package/dist/checks/architecture/node-version-consistency.d.ts +22 -0
- package/dist/checks/architecture/node-version-consistency.d.ts.map +1 -0
- package/dist/checks/architecture/node-version-consistency.js +225 -0
- package/dist/checks/architecture/node-version-consistency.js.map +1 -0
- package/dist/checks/architecture/project-readme-existence.d.ts +13 -0
- package/dist/checks/architecture/project-readme-existence.d.ts.map +1 -0
- package/dist/checks/architecture/project-readme-existence.js +55 -0
- package/dist/checks/architecture/project-readme-existence.js.map +1 -0
- package/dist/checks/architecture/stale-build-artifacts.d.ts +10 -0
- package/dist/checks/architecture/stale-build-artifacts.d.ts.map +1 -0
- package/dist/checks/architecture/stale-build-artifacts.js +55 -0
- package/dist/checks/architecture/stale-build-artifacts.js.map +1 -0
- package/dist/checks/architecture/tool-has-manifest.d.ts +27 -0
- package/dist/checks/architecture/tool-has-manifest.d.ts.map +1 -0
- package/dist/checks/architecture/tool-has-manifest.js +135 -0
- package/dist/checks/architecture/tool-has-manifest.js.map +1 -0
- package/dist/checks/architecture/vitest-config-extends-base.d.ts +15 -0
- package/dist/checks/architecture/vitest-config-extends-base.d.ts.map +1 -0
- package/dist/checks/architecture/vitest-config-extends-base.js +104 -0
- package/dist/checks/architecture/vitest-config-extends-base.js.map +1 -0
- package/dist/checks/architecture/vitest-config-required-with-tests.d.ts +49 -0
- package/dist/checks/architecture/vitest-config-required-with-tests.d.ts.map +1 -0
- package/dist/checks/architecture/vitest-config-required-with-tests.js +199 -0
- package/dist/checks/architecture/vitest-config-required-with-tests.js.map +1 -0
- package/dist/checks/documentation/_directives/eslint.d.ts +9 -0
- package/dist/checks/documentation/_directives/eslint.d.ts.map +1 -0
- package/dist/checks/documentation/_directives/eslint.js +168 -0
- package/dist/checks/documentation/_directives/eslint.js.map +1 -0
- package/dist/checks/documentation/_directives/fitness.d.ts +9 -0
- package/dist/checks/documentation/_directives/fitness.d.ts.map +1 -0
- package/dist/checks/documentation/_directives/fitness.js +64 -0
- package/dist/checks/documentation/_directives/fitness.js.map +1 -0
- package/dist/checks/documentation/_directives/graph.d.ts +10 -0
- package/dist/checks/documentation/_directives/graph.d.ts.map +1 -0
- package/dist/checks/documentation/_directives/graph.js +65 -0
- package/dist/checks/documentation/_directives/graph.js.map +1 -0
- package/dist/checks/documentation/_directives/graph.test.d.ts +2 -0
- package/dist/checks/documentation/_directives/graph.test.d.ts.map +1 -0
- package/dist/checks/documentation/_directives/graph.test.js +54 -0
- package/dist/checks/documentation/_directives/graph.test.js.map +1 -0
- package/dist/checks/documentation/_directives/semgrep.d.ts +8 -0
- package/dist/checks/documentation/_directives/semgrep.d.ts.map +1 -0
- package/dist/checks/documentation/_directives/semgrep.js +72 -0
- package/dist/checks/documentation/_directives/semgrep.js.map +1 -0
- package/dist/checks/documentation/_directives/types.d.ts +21 -0
- package/dist/checks/documentation/_directives/types.d.ts.map +1 -0
- package/dist/checks/documentation/_directives/types.js +9 -0
- package/dist/checks/documentation/_directives/types.js.map +1 -0
- package/dist/checks/documentation/_directives/typescript.d.ts +10 -0
- package/dist/checks/documentation/_directives/typescript.d.ts.map +1 -0
- package/dist/checks/documentation/_directives/typescript.js +54 -0
- package/dist/checks/documentation/_directives/typescript.js.map +1 -0
- package/dist/checks/documentation/_public-api-graph.d.ts +30 -0
- package/dist/checks/documentation/_public-api-graph.d.ts.map +1 -0
- package/dist/checks/documentation/_public-api-graph.js +304 -0
- package/dist/checks/documentation/_public-api-graph.js.map +1 -0
- package/dist/checks/documentation/directive-audit.d.ts +26 -0
- package/dist/checks/documentation/directive-audit.d.ts.map +1 -0
- package/dist/checks/documentation/directive-audit.js +144 -0
- package/dist/checks/documentation/directive-audit.js.map +1 -0
- package/dist/checks/documentation/index.d.ts +3 -0
- package/dist/checks/documentation/index.d.ts.map +1 -0
- package/dist/checks/documentation/index.js +3 -0
- package/dist/checks/documentation/index.js.map +1 -0
- package/dist/checks/documentation/public-api-jsdoc.d.ts +10 -0
- package/dist/checks/documentation/public-api-jsdoc.d.ts.map +1 -0
- package/dist/checks/documentation/public-api-jsdoc.js +131 -0
- package/dist/checks/documentation/public-api-jsdoc.js.map +1 -0
- package/dist/checks/file-length-limit.d.ts +16 -0
- package/dist/checks/file-length-limit.d.ts.map +1 -0
- package/dist/checks/file-length-limit.js +47 -0
- package/dist/checks/file-length-limit.js.map +1 -0
- package/dist/checks/index.d.ts +16 -0
- package/dist/checks/index.d.ts.map +1 -0
- package/dist/checks/index.js +16 -0
- package/dist/checks/index.js.map +1 -0
- package/dist/checks/no-todo-comments.d.ts +18 -0
- package/dist/checks/no-todo-comments.d.ts.map +1 -0
- package/dist/checks/no-todo-comments.js +79 -0
- package/dist/checks/no-todo-comments.js.map +1 -0
- package/dist/checks/no-unimplemented-markers.d.ts +24 -0
- package/dist/checks/no-unimplemented-markers.d.ts.map +1 -0
- package/dist/checks/no-unimplemented-markers.js +198 -0
- package/dist/checks/no-unimplemented-markers.js.map +1 -0
- package/dist/checks/quality/api/graphql-offset-pagination.d.ts +9 -0
- package/dist/checks/quality/api/graphql-offset-pagination.d.ts.map +1 -0
- package/dist/checks/quality/api/graphql-offset-pagination.js +63 -0
- package/dist/checks/quality/api/graphql-offset-pagination.js.map +1 -0
- package/dist/checks/quality/api/index.d.ts +3 -0
- package/dist/checks/quality/api/index.d.ts.map +1 -0
- package/dist/checks/quality/api/index.js +3 -0
- package/dist/checks/quality/api/index.js.map +1 -0
- package/dist/checks/quality/api/zod-openapi-sync.d.ts +13 -0
- package/dist/checks/quality/api/zod-openapi-sync.d.ts.map +1 -0
- package/dist/checks/quality/api/zod-openapi-sync.js +88 -0
- package/dist/checks/quality/api/zod-openapi-sync.js.map +1 -0
- package/dist/checks/quality/code-structure/dead-code.d.ts +12 -0
- package/dist/checks/quality/code-structure/dead-code.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/dead-code.js +238 -0
- package/dist/checks/quality/code-structure/dead-code.js.map +1 -0
- package/dist/checks/quality/code-structure/index.d.ts +5 -0
- package/dist/checks/quality/code-structure/index.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/index.js +5 -0
- package/dist/checks/quality/code-structure/index.js.map +1 -0
- package/dist/checks/quality/code-structure/no-ai-attribution.d.ts +25 -0
- package/dist/checks/quality/code-structure/no-ai-attribution.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/no-ai-attribution.js +76 -0
- package/dist/checks/quality/code-structure/no-ai-attribution.js.map +1 -0
- package/dist/checks/quality/code-structure/no-console-log.d.ts +17 -0
- package/dist/checks/quality/code-structure/no-console-log.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/no-console-log.js +106 -0
- package/dist/checks/quality/code-structure/no-console-log.js.map +1 -0
- package/dist/checks/quality/code-structure/no-process-artifacts.d.ts +25 -0
- package/dist/checks/quality/code-structure/no-process-artifacts.d.ts.map +1 -0
- package/dist/checks/quality/code-structure/no-process-artifacts.js +104 -0
- package/dist/checks/quality/code-structure/no-process-artifacts.js.map +1 -0
- package/dist/checks/quality/dependency-version-consistency.d.ts +20 -0
- package/dist/checks/quality/dependency-version-consistency.d.ts.map +1 -0
- package/dist/checks/quality/dependency-version-consistency.js +266 -0
- package/dist/checks/quality/dependency-version-consistency.js.map +1 -0
- package/dist/checks/quality/fitness-ignore-hygiene.d.ts +10 -0
- package/dist/checks/quality/fitness-ignore-hygiene.d.ts.map +1 -0
- package/dist/checks/quality/fitness-ignore-hygiene.js +93 -0
- package/dist/checks/quality/fitness-ignore-hygiene.js.map +1 -0
- package/dist/checks/quality/frontend/expo-vector-icons.d.ts +13 -0
- package/dist/checks/quality/frontend/expo-vector-icons.d.ts.map +1 -0
- package/dist/checks/quality/frontend/expo-vector-icons.js +80 -0
- package/dist/checks/quality/frontend/expo-vector-icons.js.map +1 -0
- package/dist/checks/quality/frontend/image-optimization.d.ts +13 -0
- package/dist/checks/quality/frontend/image-optimization.d.ts.map +1 -0
- package/dist/checks/quality/frontend/image-optimization.js +166 -0
- package/dist/checks/quality/frontend/image-optimization.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/navigation-typing.d.ts +12 -0
- package/dist/checks/quality/frontend/navigation-typing.d.ts.map +1 -0
- package/dist/checks/quality/frontend/navigation-typing.js +77 -0
- package/dist/checks/quality/frontend/navigation-typing.js.map +1 -0
- package/dist/checks/quality/graph-ignore-hygiene.d.ts +10 -0
- package/dist/checks/quality/graph-ignore-hygiene.d.ts.map +1 -0
- package/dist/checks/quality/graph-ignore-hygiene.js +95 -0
- package/dist/checks/quality/graph-ignore-hygiene.js.map +1 -0
- package/dist/checks/quality/graph-ignore-hygiene.test.d.ts +14 -0
- package/dist/checks/quality/graph-ignore-hygiene.test.d.ts.map +1 -0
- package/dist/checks/quality/graph-ignore-hygiene.test.js +58 -0
- package/dist/checks/quality/graph-ignore-hygiene.test.js.map +1 -0
- package/dist/checks/quality/index.d.ts +16 -0
- package/dist/checks/quality/index.d.ts.map +1 -0
- package/dist/checks/quality/index.js +16 -0
- package/dist/checks/quality/index.js.map +1 -0
- package/dist/checks/quality/linting/eslint-justifications.d.ts +12 -0
- package/dist/checks/quality/linting/eslint-justifications.d.ts.map +1 -0
- package/dist/checks/quality/linting/eslint-justifications.js +328 -0
- package/dist/checks/quality/linting/eslint-justifications.js.map +1 -0
- package/dist/checks/quality/linting/index.d.ts +4 -0
- package/dist/checks/quality/linting/index.d.ts.map +1 -0
- package/dist/checks/quality/linting/index.js +4 -0
- package/dist/checks/quality/linting/index.js.map +1 -0
- package/dist/checks/quality/linting/semgrep-justifications.d.ts +16 -0
- package/dist/checks/quality/linting/semgrep-justifications.d.ts.map +1 -0
- package/dist/checks/quality/linting/semgrep-justifications.js +229 -0
- package/dist/checks/quality/linting/semgrep-justifications.js.map +1 -0
- package/dist/checks/quality/linting/typescript-directive-hygiene.d.ts +12 -0
- package/dist/checks/quality/linting/typescript-directive-hygiene.d.ts.map +1 -0
- package/dist/checks/quality/linting/typescript-directive-hygiene.js +142 -0
- package/dist/checks/quality/linting/typescript-directive-hygiene.js.map +1 -0
- package/dist/checks/quality/no-compatibility-layer-names.d.ts +13 -0
- package/dist/checks/quality/no-compatibility-layer-names.d.ts.map +1 -0
- package/dist/checks/quality/no-compatibility-layer-names.js +100 -0
- package/dist/checks/quality/no-compatibility-layer-names.js.map +1 -0
- package/dist/checks/quality/no-deprecated-tags.d.ts +11 -0
- package/dist/checks/quality/no-deprecated-tags.d.ts.map +1 -0
- package/dist/checks/quality/no-deprecated-tags.js +76 -0
- package/dist/checks/quality/no-deprecated-tags.js.map +1 -0
- package/dist/checks/quality/no-markdown-references.d.ts +16 -0
- package/dist/checks/quality/no-markdown-references.d.ts.map +1 -0
- package/dist/checks/quality/no-markdown-references.js +145 -0
- package/dist/checks/quality/no-markdown-references.js.map +1 -0
- package/dist/checks/quality/no-raw-regex-on-code.d.ts +9 -0
- package/dist/checks/quality/no-raw-regex-on-code.d.ts.map +1 -0
- package/dist/checks/quality/no-raw-regex-on-code.js +61 -0
- package/dist/checks/quality/no-raw-regex-on-code.js.map +1 -0
- package/dist/checks/quality/no-temporary-workarounds.d.ts +11 -0
- package/dist/checks/quality/no-temporary-workarounds.d.ts.map +1 -0
- package/dist/checks/quality/no-temporary-workarounds.js +69 -0
- package/dist/checks/quality/no-temporary-workarounds.js.map +1 -0
- package/dist/checks/quality/no-window-alert.d.ts +19 -0
- package/dist/checks/quality/no-window-alert.d.ts.map +1 -0
- package/dist/checks/quality/no-window-alert.js +74 -0
- package/dist/checks/quality/no-window-alert.js.map +1 -0
- package/dist/checks/quality/observability/index.d.ts +2 -0
- package/dist/checks/quality/observability/index.d.ts.map +1 -0
- package/dist/checks/quality/observability/index.js +2 -0
- package/dist/checks/quality/observability/index.js.map +1 -0
- package/dist/checks/quality/observability/pino-serializer-coverage.d.ts +15 -0
- package/dist/checks/quality/observability/pino-serializer-coverage.d.ts.map +1 -0
- package/dist/checks/quality/observability/pino-serializer-coverage.js +209 -0
- package/dist/checks/quality/observability/pino-serializer-coverage.js.map +1 -0
- package/dist/checks/quality/patterns/async-state-pattern.d.ts +14 -0
- package/dist/checks/quality/patterns/async-state-pattern.d.ts.map +1 -0
- package/dist/checks/quality/patterns/async-state-pattern.js +80 -0
- package/dist/checks/quality/patterns/async-state-pattern.js.map +1 -0
- package/dist/checks/quality/patterns/index.d.ts +4 -0
- package/dist/checks/quality/patterns/index.d.ts.map +1 -0
- package/dist/checks/quality/patterns/index.js +4 -0
- package/dist/checks/quality/patterns/index.js.map +1 -0
- package/dist/checks/quality/patterns/no-non-null-assertions.d.ts +10 -0
- package/dist/checks/quality/patterns/no-non-null-assertions.d.ts.map +1 -0
- package/dist/checks/quality/patterns/no-non-null-assertions.js +97 -0
- package/dist/checks/quality/patterns/no-non-null-assertions.js.map +1 -0
- package/dist/checks/quality/patterns/performance-anti-patterns.d.ts +16 -0
- package/dist/checks/quality/patterns/performance-anti-patterns.d.ts.map +1 -0
- package/dist/checks/quality/patterns/performance-anti-patterns.js +239 -0
- package/dist/checks/quality/patterns/performance-anti-patterns.js.map +1 -0
- package/dist/checks/resilience/_helpers/config-validation.d.ts +27 -0
- package/dist/checks/resilience/_helpers/config-validation.d.ts.map +1 -0
- package/dist/checks/resilience/_helpers/config-validation.js +61 -0
- package/dist/checks/resilience/_helpers/config-validation.js.map +1 -0
- package/dist/checks/resilience/batch-operations.d.ts +22 -0
- package/dist/checks/resilience/batch-operations.d.ts.map +1 -0
- package/dist/checks/resilience/batch-operations.js +422 -0
- package/dist/checks/resilience/batch-operations.js.map +1 -0
- package/dist/checks/resilience/cache-ttl-validation.d.ts +13 -0
- package/dist/checks/resilience/cache-ttl-validation.d.ts.map +1 -0
- package/dist/checks/resilience/cache-ttl-validation.js +222 -0
- package/dist/checks/resilience/cache-ttl-validation.js.map +1 -0
- package/dist/checks/resilience/catch-clause-safety.d.ts +12 -0
- package/dist/checks/resilience/catch-clause-safety.d.ts.map +1 -0
- package/dist/checks/resilience/catch-clause-safety.js +110 -0
- package/dist/checks/resilience/catch-clause-safety.js.map +1 -0
- package/dist/checks/resilience/dangerous-config-defaults.d.ts +11 -0
- package/dist/checks/resilience/dangerous-config-defaults.d.ts.map +1 -0
- package/dist/checks/resilience/dangerous-config-defaults.js +304 -0
- package/dist/checks/resilience/dangerous-config-defaults.js.map +1 -0
- package/dist/checks/resilience/error-code-registration.d.ts +11 -0
- package/dist/checks/resilience/error-code-registration.d.ts.map +1 -0
- package/dist/checks/resilience/error-code-registration.js +88 -0
- package/dist/checks/resilience/error-code-registration.js.map +1 -0
- package/dist/checks/resilience/event-patterns.d.ts +21 -0
- package/dist/checks/resilience/event-patterns.d.ts.map +1 -0
- package/dist/checks/resilience/event-patterns.js +232 -0
- package/dist/checks/resilience/event-patterns.js.map +1 -0
- package/dist/checks/resilience/exit-code-correctness.d.ts +12 -0
- package/dist/checks/resilience/exit-code-correctness.d.ts.map +1 -0
- package/dist/checks/resilience/exit-code-correctness.js +107 -0
- package/dist/checks/resilience/exit-code-correctness.js.map +1 -0
- package/dist/checks/resilience/index.d.ts +18 -0
- package/dist/checks/resilience/index.d.ts.map +1 -0
- package/dist/checks/resilience/index.js +18 -0
- package/dist/checks/resilience/index.js.map +1 -0
- package/dist/checks/resilience/no-hardcoded-timeouts.d.ts +10 -0
- package/dist/checks/resilience/no-hardcoded-timeouts.d.ts.map +1 -0
- package/dist/checks/resilience/no-hardcoded-timeouts.js +291 -0
- package/dist/checks/resilience/no-hardcoded-timeouts.js.map +1 -0
- package/dist/checks/resilience/no-process-exit-in-finally.d.ts +11 -0
- package/dist/checks/resilience/no-process-exit-in-finally.d.ts.map +1 -0
- package/dist/checks/resilience/no-process-exit-in-finally.js +89 -0
- package/dist/checks/resilience/no-process-exit-in-finally.js.map +1 -0
- package/dist/checks/resilience/readline-cleanup.d.ts +11 -0
- package/dist/checks/resilience/readline-cleanup.d.ts.map +1 -0
- package/dist/checks/resilience/readline-cleanup.js +107 -0
- package/dist/checks/resilience/readline-cleanup.js.map +1 -0
- package/dist/checks/resilience/recovery-patterns.d.ts +25 -0
- package/dist/checks/resilience/recovery-patterns.d.ts.map +1 -0
- package/dist/checks/resilience/recovery-patterns.js +273 -0
- package/dist/checks/resilience/recovery-patterns.js.map +1 -0
- package/dist/checks/resilience/reentrancy-guard.d.ts +12 -0
- package/dist/checks/resilience/reentrancy-guard.d.ts.map +1 -0
- package/dist/checks/resilience/reentrancy-guard.js +86 -0
- package/dist/checks/resilience/reentrancy-guard.js.map +1 -0
- package/dist/checks/resilience/retry-config-validation.d.ts +13 -0
- package/dist/checks/resilience/retry-config-validation.d.ts.map +1 -0
- package/dist/checks/resilience/retry-config-validation.js +159 -0
- package/dist/checks/resilience/retry-config-validation.js.map +1 -0
- package/dist/checks/resilience/sentry/_helpers/sentry.d.ts +25 -0
- package/dist/checks/resilience/sentry/_helpers/sentry.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/_helpers/sentry.js +68 -0
- package/dist/checks/resilience/sentry/_helpers/sentry.js.map +1 -0
- package/dist/checks/resilience/sentry/index.d.ts +8 -0
- package/dist/checks/resilience/sentry/index.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/index.js +8 -0
- package/dist/checks/resilience/sentry/index.js.map +1 -0
- package/dist/checks/resilience/sentry/sentry-dsn-configured.d.ts +12 -0
- package/dist/checks/resilience/sentry/sentry-dsn-configured.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/sentry-dsn-configured.js +55 -0
- package/dist/checks/resilience/sentry/sentry-dsn-configured.js.map +1 -0
- package/dist/checks/resilience/sentry/sentry-environment-set.d.ts +12 -0
- package/dist/checks/resilience/sentry/sentry-environment-set.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/sentry-environment-set.js +51 -0
- package/dist/checks/resilience/sentry/sentry-environment-set.js.map +1 -0
- package/dist/checks/resilience/sentry/sentry-error-boundary.d.ts +12 -0
- package/dist/checks/resilience/sentry/sentry-error-boundary.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/sentry-error-boundary.js +75 -0
- package/dist/checks/resilience/sentry/sentry-error-boundary.js.map +1 -0
- package/dist/checks/resilience/sentry/sentry-pii-scrubbing.d.ts +13 -0
- package/dist/checks/resilience/sentry/sentry-pii-scrubbing.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/sentry-pii-scrubbing.js +125 -0
- package/dist/checks/resilience/sentry/sentry-pii-scrubbing.js.map +1 -0
- package/dist/checks/resilience/sentry/sentry-release-set.d.ts +12 -0
- package/dist/checks/resilience/sentry/sentry-release-set.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/sentry-release-set.js +51 -0
- package/dist/checks/resilience/sentry/sentry-release-set.js.map +1 -0
- package/dist/checks/resilience/sentry/sentry-sample-rate.d.ts +12 -0
- package/dist/checks/resilience/sentry/sentry-sample-rate.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/sentry-sample-rate.js +78 -0
- package/dist/checks/resilience/sentry/sentry-sample-rate.js.map +1 -0
- package/dist/checks/resilience/sentry/sentry-source-maps.d.ts +12 -0
- package/dist/checks/resilience/sentry/sentry-source-maps.d.ts.map +1 -0
- package/dist/checks/resilience/sentry/sentry-source-maps.js +83 -0
- package/dist/checks/resilience/sentry/sentry-source-maps.js.map +1 -0
- package/dist/checks/resilience/service-patterns.d.ts +18 -0
- package/dist/checks/resilience/service-patterns.d.ts.map +1 -0
- package/dist/checks/resilience/service-patterns.js +230 -0
- package/dist/checks/resilience/service-patterns.js.map +1 -0
- package/dist/checks/resilience/timer-lifecycle.d.ts +10 -0
- package/dist/checks/resilience/timer-lifecycle.d.ts.map +1 -0
- package/dist/checks/resilience/timer-lifecycle.js +78 -0
- package/dist/checks/resilience/timer-lifecycle.js.map +1 -0
- package/dist/checks/resilience/transaction-patterns.d.ts +21 -0
- package/dist/checks/resilience/transaction-patterns.d.ts.map +1 -0
- package/dist/checks/resilience/transaction-patterns.js +258 -0
- package/dist/checks/resilience/transaction-patterns.js.map +1 -0
- package/dist/checks/security/__tests__/no-hardcoded-secrets.test.d.ts +9 -0
- package/dist/checks/security/__tests__/no-hardcoded-secrets.test.d.ts.map +1 -0
- package/dist/checks/security/__tests__/no-hardcoded-secrets.test.js +37 -0
- package/dist/checks/security/__tests__/no-hardcoded-secrets.test.js.map +1 -0
- package/dist/checks/security/__tests__/package-supply-chain-policy.test.d.ts +2 -0
- package/dist/checks/security/__tests__/package-supply-chain-policy.test.d.ts.map +1 -0
- package/dist/checks/security/__tests__/package-supply-chain-policy.test.js +128 -0
- package/dist/checks/security/__tests__/package-supply-chain-policy.test.js.map +1 -0
- package/dist/checks/security/api-key-rotation.d.ts +10 -0
- package/dist/checks/security/api-key-rotation.d.ts.map +1 -0
- package/dist/checks/security/api-key-rotation.js +186 -0
- package/dist/checks/security/api-key-rotation.js.map +1 -0
- package/dist/checks/security/auth-middleware-coverage.d.ts +11 -0
- package/dist/checks/security/auth-middleware-coverage.d.ts.map +1 -0
- package/dist/checks/security/auth-middleware-coverage.js +210 -0
- package/dist/checks/security/auth-middleware-coverage.js.map +1 -0
- package/dist/checks/security/auth-route-guard.d.ts +12 -0
- package/dist/checks/security/auth-route-guard.d.ts.map +1 -0
- package/dist/checks/security/auth-route-guard.js +70 -0
- package/dist/checks/security/auth-route-guard.js.map +1 -0
- package/dist/checks/security/cors-configuration.d.ts +11 -0
- package/dist/checks/security/cors-configuration.d.ts.map +1 -0
- package/dist/checks/security/cors-configuration.js +126 -0
- package/dist/checks/security/cors-configuration.js.map +1 -0
- package/dist/checks/security/csp-headers.d.ts +11 -0
- package/dist/checks/security/csp-headers.d.ts.map +1 -0
- package/dist/checks/security/csp-headers.js +192 -0
- package/dist/checks/security/csp-headers.js.map +1 -0
- package/dist/checks/security/dependency-vulnerability-audit.d.ts +15 -0
- package/dist/checks/security/dependency-vulnerability-audit.d.ts.map +1 -0
- package/dist/checks/security/dependency-vulnerability-audit.js +184 -0
- package/dist/checks/security/dependency-vulnerability-audit.js.map +1 -0
- package/dist/checks/security/env-secret-exposure.d.ts +11 -0
- package/dist/checks/security/env-secret-exposure.d.ts.map +1 -0
- package/dist/checks/security/env-secret-exposure.js +127 -0
- package/dist/checks/security/env-secret-exposure.js.map +1 -0
- package/dist/checks/security/hasura-production-config.d.ts +11 -0
- package/dist/checks/security/hasura-production-config.d.ts.map +1 -0
- package/dist/checks/security/hasura-production-config.js +122 -0
- package/dist/checks/security/hasura-production-config.js.map +1 -0
- package/dist/checks/security/index.d.ts +17 -0
- package/dist/checks/security/index.d.ts.map +1 -0
- package/dist/checks/security/index.js +17 -0
- package/dist/checks/security/index.js.map +1 -0
- package/dist/checks/security/jwt-validation.d.ts +11 -0
- package/dist/checks/security/jwt-validation.d.ts.map +1 -0
- package/dist/checks/security/jwt-validation.js +294 -0
- package/dist/checks/security/jwt-validation.js.map +1 -0
- package/dist/checks/security/no-eval.d.ts +16 -0
- package/dist/checks/security/no-eval.d.ts.map +1 -0
- package/dist/checks/security/no-eval.js +83 -0
- package/dist/checks/security/no-eval.js.map +1 -0
- package/dist/checks/security/no-hardcoded-secrets.d.ts +28 -0
- package/dist/checks/security/no-hardcoded-secrets.d.ts.map +1 -0
- package/dist/checks/security/no-hardcoded-secrets.js +209 -0
- package/dist/checks/security/no-hardcoded-secrets.js.map +1 -0
- package/dist/checks/security/package-supply-chain-policy.d.ts +12 -0
- package/dist/checks/security/package-supply-chain-policy.d.ts.map +1 -0
- package/dist/checks/security/package-supply-chain-policy.js +534 -0
- package/dist/checks/security/package-supply-chain-policy.js.map +1 -0
- package/dist/checks/security/rate-limit-coverage.d.ts +10 -0
- package/dist/checks/security/rate-limit-coverage.d.ts.map +1 -0
- package/dist/checks/security/rate-limit-coverage.js +143 -0
- package/dist/checks/security/rate-limit-coverage.js.map +1 -0
- package/dist/checks/security/semgrep-scan.d.ts +13 -0
- package/dist/checks/security/semgrep-scan.d.ts.map +1 -0
- package/dist/checks/security/semgrep-scan.js +86 -0
- package/dist/checks/security/semgrep-scan.js.map +1 -0
- package/dist/checks/security/use-centralized-crypto.d.ts +11 -0
- package/dist/checks/security/use-centralized-crypto.d.ts.map +1 -0
- package/dist/checks/security/use-centralized-crypto.js +129 -0
- package/dist/checks/security/use-centralized-crypto.js.map +1 -0
- package/dist/checks/security/webhook-signature-verification.d.ts +10 -0
- package/dist/checks/security/webhook-signature-verification.d.ts.map +1 -0
- package/dist/checks/security/webhook-signature-verification.js +183 -0
- package/dist/checks/security/webhook-signature-verification.js.map +1 -0
- package/dist/checks/testing/index.d.ts +6 -0
- package/dist/checks/testing/index.d.ts.map +1 -0
- package/dist/checks/testing/index.js +6 -0
- package/dist/checks/testing/index.js.map +1 -0
- package/dist/checks/testing/no-skipped-tests.d.ts +40 -0
- package/dist/checks/testing/no-skipped-tests.d.ts.map +1 -0
- package/dist/checks/testing/no-skipped-tests.js +174 -0
- package/dist/checks/testing/no-skipped-tests.js.map +1 -0
- package/dist/checks/testing/no-stub-tests.d.ts +11 -0
- package/dist/checks/testing/no-stub-tests.d.ts.map +1 -0
- package/dist/checks/testing/no-stub-tests.js +103 -0
- package/dist/checks/testing/no-stub-tests.js.map +1 -0
- package/dist/checks/testing/test-convention-consistency.d.ts +14 -0
- package/dist/checks/testing/test-convention-consistency.d.ts.map +1 -0
- package/dist/checks/testing/test-convention-consistency.js +93 -0
- package/dist/checks/testing/test-convention-consistency.js.map +1 -0
- package/dist/checks/testing/test-file-naming.d.ts +13 -0
- package/dist/checks/testing/test-file-naming.d.ts.map +1 -0
- package/dist/checks/testing/test-file-naming.js +218 -0
- package/dist/checks/testing/test-file-naming.js.map +1 -0
- package/dist/checks/testing/test-file-pairing.d.ts +13 -0
- package/dist/checks/testing/test-file-pairing.d.ts.map +1 -0
- package/dist/checks/testing/test-file-pairing.js +274 -0
- package/dist/checks/testing/test-file-pairing.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 +29 -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 +34 -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 +36 -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 +31 -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 +52 -0
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- behavior fixture suite; related scenarios stay together while checks are split into focused tests.
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Additional fixture tests for universal check behavior.
|
|
4
|
+
*
|
|
5
|
+
* Pattern matches `behavior-fixtures.test.ts`: per-check fixtures driven
|
|
6
|
+
* through `check.run(cwd, { targetFiles })`.
|
|
7
|
+
*/
|
|
8
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import { tmpdir } from 'node:os';
|
|
10
|
+
import { dirname, join } from 'node:path';
|
|
11
|
+
import { fileCache } from '@opensip-cli/fitness';
|
|
12
|
+
import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
13
|
+
import { checks } from '../index.js';
|
|
14
|
+
function findCheck(slug) {
|
|
15
|
+
const check = checks.find((c) => c.config.slug === slug);
|
|
16
|
+
if (!check)
|
|
17
|
+
throw new Error(`check not found: ${slug}`);
|
|
18
|
+
return check;
|
|
19
|
+
}
|
|
20
|
+
function makeFixtureDir(prefix) {
|
|
21
|
+
return mkdtempSync(join(tmpdir(), `cu-cov2-${prefix}-`));
|
|
22
|
+
}
|
|
23
|
+
function writeFixture(cwd, rel, content) {
|
|
24
|
+
const abs = join(cwd, rel);
|
|
25
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
26
|
+
writeFileSync(abs, content);
|
|
27
|
+
return abs;
|
|
28
|
+
}
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
fileCache.clear();
|
|
31
|
+
});
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// dangerous-config-defaults
|
|
34
|
+
// =============================================================================
|
|
35
|
+
describe('dangerous-config-defaults', () => {
|
|
36
|
+
let cwd;
|
|
37
|
+
// eslint-disable-next-line sonarjs/no-unused-collection -- fixture array for setup; tests target files individually
|
|
38
|
+
const files = [];
|
|
39
|
+
beforeAll(() => {
|
|
40
|
+
cwd = makeFixtureDir('dcd');
|
|
41
|
+
files.push(writeFixture(cwd, 'src/db.ts', [
|
|
42
|
+
'export const db = {',
|
|
43
|
+
' ssl: false,',
|
|
44
|
+
' rejectUnauthorized: false,',
|
|
45
|
+
' poolSize: 1,',
|
|
46
|
+
' timeout: 0,',
|
|
47
|
+
' maxRetries: 0,',
|
|
48
|
+
' debug: true,',
|
|
49
|
+
'};',
|
|
50
|
+
].join('\n')), writeFixture(cwd, 'src/safe.ts', [
|
|
51
|
+
'export const db = {',
|
|
52
|
+
' ssl: true,',
|
|
53
|
+
' poolSize: 20,',
|
|
54
|
+
' timeout: 30000,',
|
|
55
|
+
' maxRetries: 3,',
|
|
56
|
+
'};',
|
|
57
|
+
].join('\n')));
|
|
58
|
+
});
|
|
59
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
60
|
+
it('flags multiple dangerous defaults', async () => {
|
|
61
|
+
const result = await findCheck('dangerous-config-defaults').run(cwd, {
|
|
62
|
+
targetFiles: [join(cwd, 'src/db.ts')],
|
|
63
|
+
});
|
|
64
|
+
const messages = result.signals.map((s) => s.message);
|
|
65
|
+
expect(messages.some((m) => m.includes('SSL'))).toBe(true);
|
|
66
|
+
expect(messages.some((m) => m.includes('TLS'))).toBe(true);
|
|
67
|
+
expect(messages.some((m) => m.includes('pool size'))).toBe(true);
|
|
68
|
+
expect(messages.some((m) => m.includes('timeout'))).toBe(true);
|
|
69
|
+
expect(messages.some((m) => m.includes('retries'))).toBe(true);
|
|
70
|
+
expect(messages.some((m) => m.includes('Debug'))).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
it('does not fire on safe defaults', async () => {
|
|
73
|
+
const result = await findCheck('dangerous-config-defaults').run(cwd, {
|
|
74
|
+
targetFiles: [join(cwd, 'src/safe.ts')],
|
|
75
|
+
});
|
|
76
|
+
expect(result.signals.length).toBe(0);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
// =============================================================================
|
|
80
|
+
// no-hardcoded-timeouts
|
|
81
|
+
// =============================================================================
|
|
82
|
+
describe('no-hardcoded-timeouts', () => {
|
|
83
|
+
let cwd;
|
|
84
|
+
// eslint-disable-next-line sonarjs/no-unused-collection -- fixture setup helper; per-test targetFiles override at call sites
|
|
85
|
+
const files = [];
|
|
86
|
+
beforeAll(() => {
|
|
87
|
+
cwd = makeFixtureDir('hardcoded-to');
|
|
88
|
+
files.push(writeFixture(cwd, 'src/raw-set-timeout.ts', ['export function delay(cb: () => void) {', ' setTimeout(cb, 30000);', '}'].join('\n')), writeFixture(cwd, 'src/timeout-assign.ts', ['export const config = {', ' timeout: 60000,', '};'].join('\n')), writeFixture(cwd, 'src/dot-timeout.ts', ['export function setUp(client: any) {', ' client.timeout(45000);', '}'].join('\n')), writeFixture(cwd, 'src/short-timeout.ts', ['export function delay(cb: () => void) { setTimeout(cb, 1000); }'].join('\n')), writeFixture(cwd, 'src/__tests__/skip.test.ts', ['it("times out", () => { setTimeout(() => {}, 30000); });'].join('\n')));
|
|
89
|
+
});
|
|
90
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
91
|
+
it('flags large hardcoded setTimeout values', async () => {
|
|
92
|
+
const result = await findCheck('no-hardcoded-timeouts').run(cwd, {
|
|
93
|
+
targetFiles: [join(cwd, 'src/raw-set-timeout.ts')],
|
|
94
|
+
});
|
|
95
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
96
|
+
expect(types).toContain('hardcoded-timeout');
|
|
97
|
+
});
|
|
98
|
+
it('flags timeout assignments with 4+ digit values', async () => {
|
|
99
|
+
const result = await findCheck('no-hardcoded-timeouts').run(cwd, {
|
|
100
|
+
targetFiles: [join(cwd, 'src/timeout-assign.ts')],
|
|
101
|
+
});
|
|
102
|
+
expect(result.signals.length).toBeGreaterThan(0);
|
|
103
|
+
});
|
|
104
|
+
it('flags .timeout(N) calls', async () => {
|
|
105
|
+
const result = await findCheck('no-hardcoded-timeouts').run(cwd, {
|
|
106
|
+
targetFiles: [join(cwd, 'src/dot-timeout.ts')],
|
|
107
|
+
});
|
|
108
|
+
expect(result.signals.length).toBeGreaterThan(0);
|
|
109
|
+
});
|
|
110
|
+
it('does not fire on values below the 5000ms threshold', async () => {
|
|
111
|
+
const result = await findCheck('no-hardcoded-timeouts').run(cwd, {
|
|
112
|
+
targetFiles: [join(cwd, 'src/short-timeout.ts')],
|
|
113
|
+
});
|
|
114
|
+
expect(result.signals.length).toBe(0);
|
|
115
|
+
});
|
|
116
|
+
it('skips test files', async () => {
|
|
117
|
+
const result = await findCheck('no-hardcoded-timeouts').run(cwd, {
|
|
118
|
+
targetFiles: [join(cwd, 'src/__tests__/skip.test.ts')],
|
|
119
|
+
});
|
|
120
|
+
expect(result.signals.length).toBe(0);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
// =============================================================================
|
|
124
|
+
// catch-clause-safety
|
|
125
|
+
// =============================================================================
|
|
126
|
+
describe('catch-clause-safety', () => {
|
|
127
|
+
let cwd;
|
|
128
|
+
beforeAll(() => {
|
|
129
|
+
cwd = makeFixtureDir('catch-safe');
|
|
130
|
+
writeFixture(cwd, 'src/swallows.ts', [
|
|
131
|
+
'export async function doStuff() {',
|
|
132
|
+
' try { await op(); }',
|
|
133
|
+
' catch (err: any) {',
|
|
134
|
+
' err.printStackTrace();',
|
|
135
|
+
' }',
|
|
136
|
+
'}',
|
|
137
|
+
'function op() {}',
|
|
138
|
+
].join('\n'));
|
|
139
|
+
writeFixture(cwd, 'src/proper.ts', [
|
|
140
|
+
'export async function doStuff() {',
|
|
141
|
+
' try { await op(); }',
|
|
142
|
+
' catch (err) { throw err; }',
|
|
143
|
+
'}',
|
|
144
|
+
'function op() {}',
|
|
145
|
+
].join('\n'));
|
|
146
|
+
writeFixture(cwd, 'src/no-catch.ts', 'export const x = 1;');
|
|
147
|
+
});
|
|
148
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
149
|
+
it('runs the analyzer without errors', async () => {
|
|
150
|
+
// Drives the analyze function for catch-clause-safety against fixtures
|
|
151
|
+
// that exercise both the violation and the bail-out paths.
|
|
152
|
+
const result = await findCheck('catch-clause-safety').run(cwd, {
|
|
153
|
+
targetFiles: [
|
|
154
|
+
join(cwd, 'src/swallows.ts'),
|
|
155
|
+
join(cwd, 'src/proper.ts'),
|
|
156
|
+
join(cwd, 'src/no-catch.ts'),
|
|
157
|
+
],
|
|
158
|
+
});
|
|
159
|
+
expect(result.errors).toBe(0);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
// =============================================================================
|
|
163
|
+
// error-code-registration
|
|
164
|
+
// =============================================================================
|
|
165
|
+
describe('error-code-registration', () => {
|
|
166
|
+
let cwd;
|
|
167
|
+
beforeAll(() => {
|
|
168
|
+
cwd = makeFixtureDir('err-code');
|
|
169
|
+
writeFixture(cwd, 'src/errors/error-codes.ts', ['export const ERROR_CODES = {', ' FOO_BAR_BAZ: "FOO.BAR.BAZ",', '} as const;'].join('\n'));
|
|
170
|
+
writeFixture(cwd, 'src/services/foo.ts', [
|
|
171
|
+
'export function bad() {',
|
|
172
|
+
' throw { code: "UNKNOWN.ERROR.HERE", message: "boom" };',
|
|
173
|
+
'}',
|
|
174
|
+
].join('\n'));
|
|
175
|
+
writeFixture(cwd, 'src/services/registered.ts', ['export function good() {', ' throw { code: "FOO.BAR.BAZ", message: "boom" };', '}'].join('\n'));
|
|
176
|
+
});
|
|
177
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
178
|
+
it('flags unregistered error codes used in source', async () => {
|
|
179
|
+
const result = await findCheck('error-code-registration').run(cwd, {
|
|
180
|
+
targetFiles: [
|
|
181
|
+
join(cwd, 'src/errors/error-codes.ts'),
|
|
182
|
+
join(cwd, 'src/services/foo.ts'),
|
|
183
|
+
join(cwd, 'src/services/registered.ts'),
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
187
|
+
expect(types).toContain('unregistered-error-code');
|
|
188
|
+
});
|
|
189
|
+
it('does not flag codes that match the registry', async () => {
|
|
190
|
+
const result = await findCheck('error-code-registration').run(cwd, {
|
|
191
|
+
targetFiles: [
|
|
192
|
+
join(cwd, 'src/errors/error-codes.ts'),
|
|
193
|
+
join(cwd, 'src/services/registered.ts'),
|
|
194
|
+
],
|
|
195
|
+
});
|
|
196
|
+
expect(result.signals.length).toBe(0);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
// =============================================================================
|
|
200
|
+
// no-stub-tests
|
|
201
|
+
// =============================================================================
|
|
202
|
+
describe('no-stub-tests', () => {
|
|
203
|
+
let cwd;
|
|
204
|
+
beforeAll(() => {
|
|
205
|
+
cwd = makeFixtureDir('no-stub');
|
|
206
|
+
writeFixture(cwd, 'src/__tests__/empty.test.ts', [
|
|
207
|
+
'import { it } from "vitest";',
|
|
208
|
+
'it("does the thing", () => {});',
|
|
209
|
+
'it("does another", async () => {});',
|
|
210
|
+
].join('\n'));
|
|
211
|
+
writeFixture(cwd, 'src/__tests__/todo.test.ts', ['import { it } from "vitest";', 'it("future work", () => { /* TODO implement */ });'].join('\n'));
|
|
212
|
+
writeFixture(cwd, 'src/__tests__/trivial.test.ts', [
|
|
213
|
+
'import { it, expect } from "vitest";',
|
|
214
|
+
'it("placeholder", () => { expect(true).toBe(true); });',
|
|
215
|
+
].join('\n'));
|
|
216
|
+
writeFixture(cwd, 'src/__tests__/real.test.ts', [
|
|
217
|
+
'import { it, expect } from "vitest";',
|
|
218
|
+
'it("does math", () => { expect(1 + 1).toBe(2); });',
|
|
219
|
+
].join('\n'));
|
|
220
|
+
});
|
|
221
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
222
|
+
it('flags empty test bodies', async () => {
|
|
223
|
+
const result = await findCheck('no-stub-tests').run(cwd, {
|
|
224
|
+
targetFiles: [join(cwd, 'src/__tests__/empty.test.ts')],
|
|
225
|
+
});
|
|
226
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
227
|
+
expect(types).toContain('empty-test-body');
|
|
228
|
+
});
|
|
229
|
+
it('flags TODO-only test bodies', async () => {
|
|
230
|
+
const result = await findCheck('no-stub-tests').run(cwd, {
|
|
231
|
+
targetFiles: [join(cwd, 'src/__tests__/todo.test.ts')],
|
|
232
|
+
});
|
|
233
|
+
const types = new Set(result.signals.map((s) => s.metadata.type));
|
|
234
|
+
expect(types.has('todo-stub-test') || types.has('empty-test-body')).toBe(true);
|
|
235
|
+
});
|
|
236
|
+
it('flags trivial expect(true).toBe(true) assertions', async () => {
|
|
237
|
+
const result = await findCheck('no-stub-tests').run(cwd, {
|
|
238
|
+
targetFiles: [join(cwd, 'src/__tests__/trivial.test.ts')],
|
|
239
|
+
});
|
|
240
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
241
|
+
expect(types).toContain('trivial-assertion');
|
|
242
|
+
});
|
|
243
|
+
it('does not fire on real assertions', async () => {
|
|
244
|
+
const result = await findCheck('no-stub-tests').run(cwd, {
|
|
245
|
+
targetFiles: [join(cwd, 'src/__tests__/real.test.ts')],
|
|
246
|
+
});
|
|
247
|
+
expect(result.signals.length).toBe(0);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
// =============================================================================
|
|
251
|
+
// dependency-version-consistency
|
|
252
|
+
// =============================================================================
|
|
253
|
+
describe('dependency-version-consistency', () => {
|
|
254
|
+
let cwd;
|
|
255
|
+
beforeAll(() => {
|
|
256
|
+
cwd = makeFixtureDir('dep-ver');
|
|
257
|
+
writeFixture(cwd, 'package.json', JSON.stringify({
|
|
258
|
+
name: 'root',
|
|
259
|
+
devDependencies: {
|
|
260
|
+
vitest: '^2.0.0',
|
|
261
|
+
typescript: '^5.4.0',
|
|
262
|
+
},
|
|
263
|
+
}, null, 2));
|
|
264
|
+
writeFixture(cwd, 'packages/a/package.json', JSON.stringify({
|
|
265
|
+
name: 'pkg-a',
|
|
266
|
+
devDependencies: {
|
|
267
|
+
vitest: '^1.0.0', // Mismatched
|
|
268
|
+
typescript: '^5.4.0', // Match
|
|
269
|
+
},
|
|
270
|
+
}, null, 2));
|
|
271
|
+
writeFixture(cwd, 'packages/b/package.json', JSON.stringify({
|
|
272
|
+
name: 'pkg-b',
|
|
273
|
+
devDependencies: {
|
|
274
|
+
vitest: '^2.0.0', // Match
|
|
275
|
+
typescript: '^5.4.0', // Match
|
|
276
|
+
},
|
|
277
|
+
}, null, 2));
|
|
278
|
+
});
|
|
279
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
280
|
+
it('flags packages using non-canonical dependency versions', async () => {
|
|
281
|
+
// Force the check's process.cwd() reference to our fixture dir.
|
|
282
|
+
const origCwd = process.cwd();
|
|
283
|
+
process.chdir(cwd);
|
|
284
|
+
try {
|
|
285
|
+
const result = await findCheck('dependency-version-consistency').run(cwd, {
|
|
286
|
+
targetFiles: [
|
|
287
|
+
join(cwd, 'package.json'),
|
|
288
|
+
join(cwd, 'packages/a/package.json'),
|
|
289
|
+
join(cwd, 'packages/b/package.json'),
|
|
290
|
+
],
|
|
291
|
+
});
|
|
292
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
293
|
+
expect(types).toContain('version-mismatch');
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
process.chdir(origCwd);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
// =============================================================================
|
|
301
|
+
// empty-package-detection
|
|
302
|
+
// =============================================================================
|
|
303
|
+
describe('empty-package-detection', () => {
|
|
304
|
+
let cwd;
|
|
305
|
+
beforeAll(() => {
|
|
306
|
+
cwd = makeFixtureDir('empty-pkg');
|
|
307
|
+
// Root package — should be skipped
|
|
308
|
+
writeFixture(cwd, 'package.json', JSON.stringify({ name: 'root' }, null, 2));
|
|
309
|
+
// Empty package — main entry exists but has no exports
|
|
310
|
+
writeFixture(cwd, 'packages/empty/package.json', JSON.stringify({
|
|
311
|
+
name: '@org/empty',
|
|
312
|
+
main: 'src/index.ts',
|
|
313
|
+
}, null, 2));
|
|
314
|
+
writeFixture(cwd, 'packages/empty/src/index.ts', '// no exports here');
|
|
315
|
+
// Mostly-commented package
|
|
316
|
+
writeFixture(cwd, 'packages/commented/package.json', JSON.stringify({
|
|
317
|
+
name: '@org/commented',
|
|
318
|
+
main: 'src/index.ts',
|
|
319
|
+
}, null, 2));
|
|
320
|
+
writeFixture(cwd, 'packages/commented/src/index.ts', [
|
|
321
|
+
'export const a = 1',
|
|
322
|
+
'// export const b = 2',
|
|
323
|
+
'// export const c = 3',
|
|
324
|
+
'// export const d = 4',
|
|
325
|
+
].join('\n'));
|
|
326
|
+
// Healthy package
|
|
327
|
+
writeFixture(cwd, 'packages/healthy/package.json', JSON.stringify({
|
|
328
|
+
name: '@org/healthy',
|
|
329
|
+
main: 'src/index.ts',
|
|
330
|
+
}, null, 2));
|
|
331
|
+
writeFixture(cwd, 'packages/healthy/src/index.ts', ['export const x = 1', 'export const y = 2'].join('\n'));
|
|
332
|
+
// CLI package with `bin` — should be skipped
|
|
333
|
+
writeFixture(cwd, 'packages/cli/package.json', JSON.stringify({
|
|
334
|
+
name: '@org/cli',
|
|
335
|
+
bin: 'bin/cli.js',
|
|
336
|
+
}, null, 2));
|
|
337
|
+
});
|
|
338
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
339
|
+
it('flags empty and mostly-commented packages while skipping the root and bin packages', async () => {
|
|
340
|
+
const origCwd = process.cwd();
|
|
341
|
+
process.chdir(cwd);
|
|
342
|
+
try {
|
|
343
|
+
const result = await findCheck('empty-package-detection').run(cwd, {
|
|
344
|
+
targetFiles: [
|
|
345
|
+
join(cwd, 'package.json'),
|
|
346
|
+
join(cwd, 'packages/empty/package.json'),
|
|
347
|
+
join(cwd, 'packages/commented/package.json'),
|
|
348
|
+
join(cwd, 'packages/healthy/package.json'),
|
|
349
|
+
join(cwd, 'packages/cli/package.json'),
|
|
350
|
+
],
|
|
351
|
+
});
|
|
352
|
+
const types = new Set(result.signals.map((s) => s.metadata.type));
|
|
353
|
+
// Either empty-package or mostly-commented should fire
|
|
354
|
+
expect(types.has('empty-package') || types.has('mostly-commented')).toBe(true);
|
|
355
|
+
}
|
|
356
|
+
finally {
|
|
357
|
+
process.chdir(origCwd);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
// =============================================================================
|
|
362
|
+
// no-duplicate-packages
|
|
363
|
+
// =============================================================================
|
|
364
|
+
describe('no-duplicate-packages', () => {
|
|
365
|
+
let cwd;
|
|
366
|
+
beforeAll(() => {
|
|
367
|
+
cwd = makeFixtureDir('no-dup');
|
|
368
|
+
writeFixture(cwd, 'packages/a/package.json', JSON.stringify({ name: '@org/utils' }, null, 2));
|
|
369
|
+
writeFixture(cwd, 'packages/b/package.json', JSON.stringify({ name: '@other/utils' }, null, 2));
|
|
370
|
+
writeFixture(cwd, 'packages/c/package.json', JSON.stringify({ name: '@org/helpers' }, null, 2));
|
|
371
|
+
writeFixture(cwd, 'packages/d/package.json', JSON.stringify({ name: '@org/logger' }, null, 2));
|
|
372
|
+
writeFixture(cwd, 'packages/e/package.json', JSON.stringify({ name: '@org/logging' }, null, 2));
|
|
373
|
+
});
|
|
374
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
375
|
+
it('flags duplicate-purpose packages', async () => {
|
|
376
|
+
const result = await findCheck('no-duplicate-packages').run(cwd, {
|
|
377
|
+
targetFiles: [
|
|
378
|
+
join(cwd, 'packages/a/package.json'),
|
|
379
|
+
join(cwd, 'packages/b/package.json'),
|
|
380
|
+
join(cwd, 'packages/c/package.json'),
|
|
381
|
+
join(cwd, 'packages/d/package.json'),
|
|
382
|
+
join(cwd, 'packages/e/package.json'),
|
|
383
|
+
],
|
|
384
|
+
});
|
|
385
|
+
const matches = result.signals.map((s) => s.metadata.match);
|
|
386
|
+
// utilities (utils, helpers) and logging (logger, logging) categories
|
|
387
|
+
expect(matches).toEqual(expect.arrayContaining(['utilities', 'logging']));
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
// =============================================================================
|
|
391
|
+
// docker-version-sync
|
|
392
|
+
// =============================================================================
|
|
393
|
+
describe('docker-version-sync', () => {
|
|
394
|
+
let cwd;
|
|
395
|
+
beforeAll(() => {
|
|
396
|
+
cwd = makeFixtureDir('docker-ver');
|
|
397
|
+
writeFixture(cwd, 'package.json', JSON.stringify({
|
|
398
|
+
name: 'root',
|
|
399
|
+
engines: { node: '>=20' },
|
|
400
|
+
packageManager: 'pnpm@10.0.0',
|
|
401
|
+
}, null, 2));
|
|
402
|
+
writeFixture(cwd, 'Dockerfile.bad', ['FROM node:18', 'RUN corepack prepare pnpm@9.0.0 --activate'].join('\n'));
|
|
403
|
+
writeFixture(cwd, 'Dockerfile.good', [
|
|
404
|
+
'FROM node:20',
|
|
405
|
+
"RUN corepack prepare $(node -e \"process.stdout.write(require('./package.json').packageManager.split('+')[0])\") --activate",
|
|
406
|
+
].join('\n'));
|
|
407
|
+
writeFixture(cwd, 'Dockerfile.non-node', ['FROM redis:7', 'EXPOSE 6379'].join('\n'));
|
|
408
|
+
});
|
|
409
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
410
|
+
it('flags node version mismatch and pnpm version mismatch', async () => {
|
|
411
|
+
const origCwd = process.cwd();
|
|
412
|
+
process.chdir(cwd);
|
|
413
|
+
try {
|
|
414
|
+
const result = await findCheck('docker-version-sync').run(cwd, {
|
|
415
|
+
targetFiles: [
|
|
416
|
+
join(cwd, 'Dockerfile.bad'),
|
|
417
|
+
join(cwd, 'Dockerfile.good'),
|
|
418
|
+
join(cwd, 'Dockerfile.non-node'),
|
|
419
|
+
],
|
|
420
|
+
});
|
|
421
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
422
|
+
expect(types).toContain('node-version-mismatch');
|
|
423
|
+
expect(types).toContain('pnpm-version-mismatch');
|
|
424
|
+
}
|
|
425
|
+
finally {
|
|
426
|
+
process.chdir(origCwd);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
// =============================================================================
|
|
431
|
+
// stale-build-artifacts
|
|
432
|
+
// =============================================================================
|
|
433
|
+
describe('stale-build-artifacts', () => {
|
|
434
|
+
let cwd;
|
|
435
|
+
beforeAll(() => {
|
|
436
|
+
cwd = makeFixtureDir('stale-build');
|
|
437
|
+
// dist file present but no source mapping — analyzer just reads file paths
|
|
438
|
+
writeFixture(cwd, 'packages/a/dist/index.js', '// stale');
|
|
439
|
+
writeFixture(cwd, 'packages/a/package.json', JSON.stringify({ name: 'a' }, null, 2));
|
|
440
|
+
});
|
|
441
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
442
|
+
it('runs analysis without errors', async () => {
|
|
443
|
+
const result = await findCheck('stale-build-artifacts').run(cwd, {
|
|
444
|
+
targetFiles: [join(cwd, 'packages/a/package.json'), join(cwd, 'packages/a/dist/index.js')],
|
|
445
|
+
});
|
|
446
|
+
expect(result.errors).toBe(0);
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
// =============================================================================
|
|
450
|
+
// directive-audit
|
|
451
|
+
// =============================================================================
|
|
452
|
+
describe('directive-audit', () => {
|
|
453
|
+
let cwd;
|
|
454
|
+
beforeAll(() => {
|
|
455
|
+
cwd = makeFixtureDir('directive');
|
|
456
|
+
writeFixture(cwd, 'src/many-suppressions.ts', [
|
|
457
|
+
'// @ts-expect-error reason: testing',
|
|
458
|
+
'const x: number = "y" as any',
|
|
459
|
+
'// @ts-ignore — ancient shim',
|
|
460
|
+
'const y: string = 42 as any',
|
|
461
|
+
'// eslint-disable-next-line no-console',
|
|
462
|
+
'console.log("inline")',
|
|
463
|
+
'/* eslint-disable @typescript-eslint/no-explicit-any */',
|
|
464
|
+
'export function takes(a: any) { return a }',
|
|
465
|
+
'/* eslint-enable */',
|
|
466
|
+
'// @fitness-ignore-file no-console-log -- intentional CLI logger',
|
|
467
|
+
'// @fitness-ignore-next-line no-todo-comments -- intentional',
|
|
468
|
+
'// nosemgrep: javascript.lang.security',
|
|
469
|
+
'eval("nosemgrep here")',
|
|
470
|
+
].join('\n'));
|
|
471
|
+
});
|
|
472
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
473
|
+
it('classifies several directive categories', async () => {
|
|
474
|
+
const result = await findCheck('directive-audit').run(cwd, {
|
|
475
|
+
targetFiles: [join(cwd, 'src/many-suppressions.ts')],
|
|
476
|
+
});
|
|
477
|
+
expect(result.errors).toBe(0);
|
|
478
|
+
expect(result.info).toBeDefined();
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
// =============================================================================
|
|
482
|
+
// jwt-validation
|
|
483
|
+
// =============================================================================
|
|
484
|
+
describe('jwt-validation', () => {
|
|
485
|
+
let cwd;
|
|
486
|
+
beforeAll(() => {
|
|
487
|
+
cwd = makeFixtureDir('jwt');
|
|
488
|
+
writeFixture(cwd, 'src/auth.ts', [
|
|
489
|
+
'import jwt from "jsonwebtoken";',
|
|
490
|
+
'export function verifyTok(tok: string) {',
|
|
491
|
+
' return jwt.verify(tok, "static-secret");',
|
|
492
|
+
'}',
|
|
493
|
+
].join('\n'));
|
|
494
|
+
writeFixture(cwd, 'src/decode.ts', [
|
|
495
|
+
'import jwt from "jsonwebtoken";',
|
|
496
|
+
'export function noVerify(tok: string) {',
|
|
497
|
+
' return jwt.decode(tok);',
|
|
498
|
+
'}',
|
|
499
|
+
].join('\n'));
|
|
500
|
+
writeFixture(cwd, 'src/no-jwt.ts', 'export const x = 1;');
|
|
501
|
+
});
|
|
502
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
503
|
+
it('runs the jwt analyzer and produces a CheckResult', async () => {
|
|
504
|
+
const result = await findCheck('jwt-validation').run(cwd, {
|
|
505
|
+
targetFiles: [
|
|
506
|
+
join(cwd, 'src/auth.ts'),
|
|
507
|
+
join(cwd, 'src/decode.ts'),
|
|
508
|
+
join(cwd, 'src/no-jwt.ts'),
|
|
509
|
+
],
|
|
510
|
+
});
|
|
511
|
+
expect(result).toBeDefined();
|
|
512
|
+
expect(result.signals).toBeDefined();
|
|
513
|
+
expect(typeof result.errors).toBe('number');
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
// =============================================================================
|
|
517
|
+
// docker-best-practices
|
|
518
|
+
// =============================================================================
|
|
519
|
+
describe('docker-best-practices', () => {
|
|
520
|
+
let cwd;
|
|
521
|
+
beforeAll(() => {
|
|
522
|
+
cwd = makeFixtureDir('docker-bp');
|
|
523
|
+
writeFixture(cwd, 'Dockerfile.root-user', [
|
|
524
|
+
'FROM node:20',
|
|
525
|
+
'WORKDIR /app',
|
|
526
|
+
'COPY . .',
|
|
527
|
+
'RUN npm install',
|
|
528
|
+
'USER root',
|
|
529
|
+
'CMD ["node", "src/app.js"]',
|
|
530
|
+
].join('\n'));
|
|
531
|
+
writeFixture(cwd, 'Dockerfile.no-user', ['FROM node:20', 'COPY . .', 'CMD ["node", "src/app.js"]'].join('\n'));
|
|
532
|
+
writeFixture(cwd, 'Dockerfile.proper', ['FROM node:20', 'COPY . .', 'USER node', 'CMD ["node", "src/app.js"]'].join('\n'));
|
|
533
|
+
});
|
|
534
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
535
|
+
it('produces signals for docker best-practice violations', async () => {
|
|
536
|
+
const result = await findCheck('docker-best-practices').run(cwd, {
|
|
537
|
+
targetFiles: [
|
|
538
|
+
join(cwd, 'Dockerfile.root-user'),
|
|
539
|
+
join(cwd, 'Dockerfile.no-user'),
|
|
540
|
+
join(cwd, 'Dockerfile.proper'),
|
|
541
|
+
],
|
|
542
|
+
});
|
|
543
|
+
expect(result.signals.length).toBeGreaterThan(0);
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
// =============================================================================
|
|
547
|
+
// project-readme-existence — already 100%, but useful smoke test
|
|
548
|
+
// =============================================================================
|
|
549
|
+
describe('no-todo-comments (cross-language)', () => {
|
|
550
|
+
let cwd;
|
|
551
|
+
beforeAll(() => {
|
|
552
|
+
cwd = makeFixtureDir('todo-quality');
|
|
553
|
+
writeFixture(cwd, 'src/has-todos.ts', [
|
|
554
|
+
'// TODO refactor this function',
|
|
555
|
+
'export function foo() { return 1; }',
|
|
556
|
+
'// FIXME flaky logic',
|
|
557
|
+
'export function bar() { return 2; }',
|
|
558
|
+
'// HACK: temporary patch for the storage adapter',
|
|
559
|
+
'export function baz() { return 3; }',
|
|
560
|
+
'// XXX: this needs a security review',
|
|
561
|
+
'export function qux() { return 4; }',
|
|
562
|
+
'// OPTIMIZE: profile this hot path',
|
|
563
|
+
'export function quux() { return 5; }',
|
|
564
|
+
].join('\n'));
|
|
565
|
+
writeFixture(cwd, 'src/clean.ts', 'export const x = 1;');
|
|
566
|
+
});
|
|
567
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
568
|
+
it('flags TODO/FIXME/XXX/OPTIMIZE debt markers (HACK is owned by no-temporary-workarounds)', async () => {
|
|
569
|
+
const result = await findCheck('no-todo-comments').run(cwd, {
|
|
570
|
+
targetFiles: [join(cwd, 'src/has-todos.ts')],
|
|
571
|
+
});
|
|
572
|
+
const messages = result.signals.map((s) => s.message);
|
|
573
|
+
expect(messages.some((m) => m.startsWith('TODO'))).toBe(true);
|
|
574
|
+
expect(messages.some((m) => m.startsWith('FIXME'))).toBe(true);
|
|
575
|
+
expect(messages.some((m) => m.startsWith('HACK'))).toBe(false);
|
|
576
|
+
expect(messages.some((m) => m.startsWith('XXX'))).toBe(true);
|
|
577
|
+
expect(messages.some((m) => m.startsWith('OPTIMIZE'))).toBe(true);
|
|
578
|
+
});
|
|
579
|
+
it('does not fire on clean files', async () => {
|
|
580
|
+
const result = await findCheck('no-todo-comments').run(cwd, {
|
|
581
|
+
targetFiles: [join(cwd, 'src/clean.ts')],
|
|
582
|
+
});
|
|
583
|
+
expect(result.signals.length).toBe(0);
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
// =============================================================================
|
|
587
|
+
// dead-code (command mode — drives parseOutput via fixtures rather than running knip)
|
|
588
|
+
// =============================================================================
|
|
589
|
+
describe('dead-code (command mode)', () => {
|
|
590
|
+
let cwd;
|
|
591
|
+
beforeAll(() => {
|
|
592
|
+
cwd = makeFixtureDir('dead-code');
|
|
593
|
+
writeFixture(cwd, 'src/orphan.ts', ['export function unused() { return 1; }'].join('\n'));
|
|
594
|
+
});
|
|
595
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
596
|
+
// The dead-code check's bin is `npx knip`. Locally, `npx` finds
|
|
597
|
+
// knip in `node_modules` instantly; on a cold CI runner it can
|
|
598
|
+
// spend tens of seconds fetching knip from the registry before
|
|
599
|
+
// running it. Both paths are valid — the test contract is "the
|
|
600
|
+
// check doesn't crash with an unhandled exception."
|
|
601
|
+
//
|
|
602
|
+
// Three outcomes we accept as success:
|
|
603
|
+
// 1. ENOENT/missing-knip — executor returns a CheckResult with
|
|
604
|
+
// `error` populated. (Local dev path.)
|
|
605
|
+
// 2. knip ran successfully — returns a CheckResult with
|
|
606
|
+
// violations. (CI path, knip got fetched in time.)
|
|
607
|
+
// 3. CheckAbortedError thrown because the run hit the test's
|
|
608
|
+
// 30 s timeout via vitest's signal. The framework's clean-
|
|
609
|
+
// abort path is itself part of the contract we want to
|
|
610
|
+
// verify; throwing CheckAbortedError is correct behaviour
|
|
611
|
+
// under abort, not a regression.
|
|
612
|
+
//
|
|
613
|
+
// The deadCode check itself caps at 120 s via
|
|
614
|
+
// `deadCode.config.timeout` so a runaway invocation can't hang
|
|
615
|
+
// indefinitely under any path.
|
|
616
|
+
it('does not throw when knip is missing', async () => {
|
|
617
|
+
try {
|
|
618
|
+
const result = await findCheck('dead-code').run(cwd, {
|
|
619
|
+
targetFiles: [join(cwd, 'src/orphan.ts')],
|
|
620
|
+
});
|
|
621
|
+
expect(result).toBeDefined();
|
|
622
|
+
}
|
|
623
|
+
catch (error) {
|
|
624
|
+
const isCleanAbort = error !== null &&
|
|
625
|
+
typeof error === 'object' &&
|
|
626
|
+
'name' in error &&
|
|
627
|
+
error.name === 'CheckAbortedError';
|
|
628
|
+
if (!isCleanAbort)
|
|
629
|
+
throw error;
|
|
630
|
+
// Clean abort is the framework's documented contract path;
|
|
631
|
+
// proves the check responded to AbortSignal, which is what
|
|
632
|
+
// we needed to verify.
|
|
633
|
+
expect(isCleanAbort).toBe(true);
|
|
634
|
+
}
|
|
635
|
+
}, 60_000);
|
|
636
|
+
});
|
|
637
|
+
// =============================================================================
|
|
638
|
+
// performance-anti-patterns
|
|
639
|
+
// =============================================================================
|
|
640
|
+
describe('performance-anti-patterns', () => {
|
|
641
|
+
let cwd;
|
|
642
|
+
beforeAll(() => {
|
|
643
|
+
cwd = makeFixtureDir('perf-anti');
|
|
644
|
+
writeFixture(cwd, 'src/n-plus-one.ts', [
|
|
645
|
+
'export async function listUsers(db: any) {',
|
|
646
|
+
' const users = await db.users.findMany();',
|
|
647
|
+
' for (const u of users) {',
|
|
648
|
+
' u.posts = await db.posts.findMany({ where: { userId: u.id } });',
|
|
649
|
+
' }',
|
|
650
|
+
' return users;',
|
|
651
|
+
'}',
|
|
652
|
+
].join('\n'));
|
|
653
|
+
writeFixture(cwd, 'src/clean.ts', 'export const x = 1;');
|
|
654
|
+
});
|
|
655
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
656
|
+
it('runs the analyzer without throwing', async () => {
|
|
657
|
+
const result = await findCheck('performance-anti-patterns').run(cwd, {
|
|
658
|
+
targetFiles: [join(cwd, 'src/n-plus-one.ts'), join(cwd, 'src/clean.ts')],
|
|
659
|
+
});
|
|
660
|
+
expect(result.errors).toBe(0);
|
|
661
|
+
});
|
|
662
|
+
});
|
|
663
|
+
// =============================================================================
|
|
664
|
+
// no-non-null-assertions
|
|
665
|
+
// =============================================================================
|
|
666
|
+
describe('no-non-null-assertions', () => {
|
|
667
|
+
let cwd;
|
|
668
|
+
beforeAll(() => {
|
|
669
|
+
cwd = makeFixtureDir('non-null');
|
|
670
|
+
writeFixture(cwd, 'src/with-bangs.ts', [
|
|
671
|
+
'export function pick(arr: any[]) {',
|
|
672
|
+
' return arr.find(x => x.id === 1)!.value;',
|
|
673
|
+
'}',
|
|
674
|
+
'export function f(x?: { v: number }) { return x!.v; }',
|
|
675
|
+
].join('\n'));
|
|
676
|
+
writeFixture(cwd, 'src/clean.ts', [
|
|
677
|
+
'export function pick(arr: any[]) {',
|
|
678
|
+
' return arr.find(x => x.id === 1)?.value ?? 0;',
|
|
679
|
+
'}',
|
|
680
|
+
].join('\n'));
|
|
681
|
+
});
|
|
682
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
683
|
+
it('runs the analyzer without throwing', async () => {
|
|
684
|
+
const result = await findCheck('no-non-null-assertions').run(cwd, {
|
|
685
|
+
targetFiles: [join(cwd, 'src/with-bangs.ts'), join(cwd, 'src/clean.ts')],
|
|
686
|
+
});
|
|
687
|
+
expect(result.errors).toBe(0);
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
// =============================================================================
|
|
691
|
+
// timer-lifecycle
|
|
692
|
+
// =============================================================================
|
|
693
|
+
describe('timer-lifecycle', () => {
|
|
694
|
+
let cwd;
|
|
695
|
+
beforeAll(() => {
|
|
696
|
+
cwd = makeFixtureDir('timer-lc');
|
|
697
|
+
writeFixture(cwd, 'src/no-cleanup.ts', ['const handle = setInterval(() => {}, 60000);', 'export const stop = () => undefined;'].join('\n'));
|
|
698
|
+
writeFixture(cwd, 'src/with-cleanup.ts', [
|
|
699
|
+
'let handle: ReturnType<typeof setInterval> | undefined;',
|
|
700
|
+
'export function start() { handle = setInterval(() => {}, 60000); }',
|
|
701
|
+
'export function stop() { if (handle) clearInterval(handle); }',
|
|
702
|
+
].join('\n'));
|
|
703
|
+
});
|
|
704
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
705
|
+
it('runs the analyzer without throwing', async () => {
|
|
706
|
+
const result = await findCheck('timer-lifecycle').run(cwd, {
|
|
707
|
+
targetFiles: [join(cwd, 'src/no-cleanup.ts'), join(cwd, 'src/with-cleanup.ts')],
|
|
708
|
+
});
|
|
709
|
+
expect(result.errors).toBe(0);
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
// =============================================================================
|
|
713
|
+
// recovery-patterns
|
|
714
|
+
// =============================================================================
|
|
715
|
+
describe('recovery-patterns', () => {
|
|
716
|
+
let cwd;
|
|
717
|
+
beforeAll(() => {
|
|
718
|
+
cwd = makeFixtureDir('recovery');
|
|
719
|
+
writeFixture(cwd, 'src/retry-without-backoff.ts', [
|
|
720
|
+
'export async function withRetry<T>(fn: () => Promise<T>): Promise<T> {',
|
|
721
|
+
' for (let i = 0; i < 3; i++) {',
|
|
722
|
+
' try { return await fn(); } catch {}',
|
|
723
|
+
' }',
|
|
724
|
+
' throw new Error("retry exhausted");',
|
|
725
|
+
'}',
|
|
726
|
+
].join('\n'));
|
|
727
|
+
writeFixture(cwd, 'src/clean.ts', 'export const x = 1;');
|
|
728
|
+
});
|
|
729
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
730
|
+
it('runs the analyzer without throwing', async () => {
|
|
731
|
+
const result = await findCheck('recovery-patterns').run(cwd, {
|
|
732
|
+
targetFiles: [join(cwd, 'src/retry-without-backoff.ts'), join(cwd, 'src/clean.ts')],
|
|
733
|
+
});
|
|
734
|
+
expect(result.errors).toBe(0);
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
// =============================================================================
|
|
738
|
+
// graceful-shutdown (in service-patterns.ts)
|
|
739
|
+
// =============================================================================
|
|
740
|
+
describe('graceful-shutdown', () => {
|
|
741
|
+
let cwd;
|
|
742
|
+
beforeAll(() => {
|
|
743
|
+
cwd = makeFixtureDir('graceful');
|
|
744
|
+
writeFixture(cwd, 'src/server-no-handlers.ts', ['import express from "express";', 'const app = express();', 'app.listen(3000);'].join('\n'));
|
|
745
|
+
writeFixture(cwd, 'src/server-with-handlers.ts', [
|
|
746
|
+
'import express from "express";',
|
|
747
|
+
'const app = express();',
|
|
748
|
+
'const server = app.listen(3000);',
|
|
749
|
+
'process.on("SIGTERM", () => server.close());',
|
|
750
|
+
'process.on("SIGINT", () => server.close());',
|
|
751
|
+
].join('\n'));
|
|
752
|
+
writeFixture(cwd, 'src/util.ts', 'export const x = 1;');
|
|
753
|
+
});
|
|
754
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
755
|
+
it('runs without throwing on listen-style server fixtures', async () => {
|
|
756
|
+
const result = await findCheck('graceful-shutdown').run(cwd, {
|
|
757
|
+
targetFiles: [
|
|
758
|
+
join(cwd, 'src/server-no-handlers.ts'),
|
|
759
|
+
join(cwd, 'src/server-with-handlers.ts'),
|
|
760
|
+
join(cwd, 'src/util.ts'),
|
|
761
|
+
],
|
|
762
|
+
});
|
|
763
|
+
expect(result).toBeDefined();
|
|
764
|
+
expect(result.signals).toBeDefined();
|
|
765
|
+
});
|
|
766
|
+
});
|
|
767
|
+
describe('rate-limiting-coverage (resilience)', () => {
|
|
768
|
+
let cwd;
|
|
769
|
+
beforeAll(() => {
|
|
770
|
+
cwd = makeFixtureDir('rl-resilience');
|
|
771
|
+
writeFixture(cwd, 'src/api.ts', [
|
|
772
|
+
'export function attach(app: any) {',
|
|
773
|
+
' app.post("/api/login", async () => ({}));',
|
|
774
|
+
'}',
|
|
775
|
+
].join('\n'));
|
|
776
|
+
});
|
|
777
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
778
|
+
it('runs without throwing', async () => {
|
|
779
|
+
const result = await findCheck('rate-limiting-coverage').run(cwd, {
|
|
780
|
+
targetFiles: [join(cwd, 'src/api.ts')],
|
|
781
|
+
});
|
|
782
|
+
expect(result).toBeDefined();
|
|
783
|
+
});
|
|
784
|
+
});
|
|
785
|
+
//# sourceMappingURL=behavior-fixtures-2.test.js.map
|