@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,663 @@
|
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- behavior fixture suite; related scenarios stay together while checks are split into focused tests.
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Third batch of fixture-based tests targeting the
|
|
4
|
+
* remaining check analyzers.
|
|
5
|
+
*/
|
|
6
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { tmpdir } from 'node:os';
|
|
8
|
+
import { dirname, join } from 'node:path';
|
|
9
|
+
import { fileCache } from '@opensip-cli/fitness';
|
|
10
|
+
import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
11
|
+
import { checks } from '../index.js';
|
|
12
|
+
function findCheck(slug) {
|
|
13
|
+
const check = checks.find((c) => c.config.slug === slug);
|
|
14
|
+
if (!check)
|
|
15
|
+
throw new Error(`check not found: ${slug}`);
|
|
16
|
+
return check;
|
|
17
|
+
}
|
|
18
|
+
function makeFixtureDir(prefix) {
|
|
19
|
+
return mkdtempSync(join(tmpdir(), `cu-cov3-${prefix}-`));
|
|
20
|
+
}
|
|
21
|
+
function writeFixture(cwd, rel, content) {
|
|
22
|
+
const abs = join(cwd, rel);
|
|
23
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
24
|
+
writeFileSync(abs, content);
|
|
25
|
+
return abs;
|
|
26
|
+
}
|
|
27
|
+
afterEach(() => fileCache.clear());
|
|
28
|
+
// =============================================================================
|
|
29
|
+
// node-version-consistency
|
|
30
|
+
// =============================================================================
|
|
31
|
+
describe('node-version-consistency', () => {
|
|
32
|
+
let cwd;
|
|
33
|
+
beforeAll(() => {
|
|
34
|
+
cwd = makeFixtureDir('node-ver');
|
|
35
|
+
writeFixture(cwd, 'package.json', JSON.stringify({
|
|
36
|
+
name: 'root',
|
|
37
|
+
engines: { node: '>=24.0.0' },
|
|
38
|
+
devDependencies: { '@types/node': '^24.0.0' },
|
|
39
|
+
}, null, 2));
|
|
40
|
+
writeFixture(cwd, '.nvmrc', '20.11.1\n');
|
|
41
|
+
writeFixture(cwd, 'packages/a/package.json', JSON.stringify({
|
|
42
|
+
name: 'a',
|
|
43
|
+
engines: { node: '>=18.0.0' },
|
|
44
|
+
devDependencies: { '@types/node': '^18.0.0' },
|
|
45
|
+
}, null, 2));
|
|
46
|
+
writeFixture(cwd, '.github/workflows/ci.yml', [
|
|
47
|
+
'name: CI',
|
|
48
|
+
'jobs:',
|
|
49
|
+
' build:',
|
|
50
|
+
' runs-on: ubuntu-latest',
|
|
51
|
+
' steps:',
|
|
52
|
+
' - uses: actions/setup-node@v4',
|
|
53
|
+
' with:',
|
|
54
|
+
" node-version: '18'",
|
|
55
|
+
].join('\n'));
|
|
56
|
+
});
|
|
57
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
58
|
+
it('flags .nvmrc / workspace engines / @types/node / CI version mismatches', async () => {
|
|
59
|
+
const result = await findCheck('node-version-consistency').run(cwd, {
|
|
60
|
+
targetFiles: [
|
|
61
|
+
join(cwd, 'package.json'),
|
|
62
|
+
join(cwd, '.nvmrc'),
|
|
63
|
+
join(cwd, 'packages/a/package.json'),
|
|
64
|
+
join(cwd, '.github/workflows/ci.yml'),
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
68
|
+
expect(types).toContain('nvmrc-version-mismatch');
|
|
69
|
+
expect(types).toContain('workspace-engines-mismatch');
|
|
70
|
+
expect(types).toContain('types-node-mismatch');
|
|
71
|
+
expect(types).toContain('ci-node-version-mismatch');
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
// =============================================================================
|
|
75
|
+
// sentry-source-maps
|
|
76
|
+
// =============================================================================
|
|
77
|
+
describe('sentry-source-maps', () => {
|
|
78
|
+
let cwd;
|
|
79
|
+
beforeAll(() => {
|
|
80
|
+
cwd = makeFixtureDir('sentry-srcmaps');
|
|
81
|
+
writeFixture(cwd, 'webpack.config.ts', [
|
|
82
|
+
'import * as Sentry from "@sentry/node";',
|
|
83
|
+
'export default {',
|
|
84
|
+
' // No source map plugin configured',
|
|
85
|
+
' plugins: [],',
|
|
86
|
+
'};',
|
|
87
|
+
].join('\n'));
|
|
88
|
+
writeFixture(cwd, 'vite.config.ts', [
|
|
89
|
+
'import { sentryVitePlugin } from "@sentry/vite-plugin";',
|
|
90
|
+
'export default {',
|
|
91
|
+
' plugins: [sentryVitePlugin({})],',
|
|
92
|
+
'};',
|
|
93
|
+
].join('\n'));
|
|
94
|
+
writeFixture(cwd, 'rollup.config.ts', ['export default { plugins: [] };'].join('\n'));
|
|
95
|
+
});
|
|
96
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
97
|
+
it('flags bundler config that references Sentry without a source map plugin', async () => {
|
|
98
|
+
const result = await findCheck('sentry-source-maps').run(cwd, {
|
|
99
|
+
targetFiles: [join(cwd, 'webpack.config.ts')],
|
|
100
|
+
});
|
|
101
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
102
|
+
expect(types).toContain('sentry-missing-source-maps');
|
|
103
|
+
});
|
|
104
|
+
it('does not fire when a Sentry source map plugin is configured', async () => {
|
|
105
|
+
const result = await findCheck('sentry-source-maps').run(cwd, {
|
|
106
|
+
targetFiles: [join(cwd, 'vite.config.ts')],
|
|
107
|
+
});
|
|
108
|
+
expect(result.signals.length).toBe(0);
|
|
109
|
+
});
|
|
110
|
+
it('skips non-Sentry bundler configs', async () => {
|
|
111
|
+
const result = await findCheck('sentry-source-maps').run(cwd, {
|
|
112
|
+
targetFiles: [join(cwd, 'rollup.config.ts')],
|
|
113
|
+
});
|
|
114
|
+
expect(result.signals.length).toBe(0);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
// =============================================================================
|
|
118
|
+
// sentry-pii-scrubbing
|
|
119
|
+
// =============================================================================
|
|
120
|
+
describe('sentry-pii-scrubbing', () => {
|
|
121
|
+
let cwd;
|
|
122
|
+
beforeAll(() => {
|
|
123
|
+
cwd = makeFixtureDir('sentry-pii');
|
|
124
|
+
writeFixture(cwd, 'src/init-no-callbacks.ts', [
|
|
125
|
+
'import * as Sentry from "@sentry/node";',
|
|
126
|
+
'Sentry.init({',
|
|
127
|
+
' dsn: "https://example",',
|
|
128
|
+
'});',
|
|
129
|
+
].join('\n'));
|
|
130
|
+
writeFixture(cwd, 'src/init-with-callback.ts', [
|
|
131
|
+
'import * as Sentry from "@sentry/node";',
|
|
132
|
+
'Sentry.init({',
|
|
133
|
+
' dsn: "https://example",',
|
|
134
|
+
' beforeSend(event) { return event; },',
|
|
135
|
+
'});',
|
|
136
|
+
].join('\n'));
|
|
137
|
+
writeFixture(cwd, 'src/pii-context.ts', [
|
|
138
|
+
'import * as Sentry from "@sentry/node";',
|
|
139
|
+
'export function tag(user: { email: string }) {',
|
|
140
|
+
' Sentry.setUser({ email: user.email, id: "u1" });',
|
|
141
|
+
'}',
|
|
142
|
+
].join('\n'));
|
|
143
|
+
});
|
|
144
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
145
|
+
it('flags Sentry.init() without beforeSend / beforeBreadcrumb', async () => {
|
|
146
|
+
const result = await findCheck('sentry-pii-scrubbing').run(cwd, {
|
|
147
|
+
targetFiles: [join(cwd, 'src/init-no-callbacks.ts')],
|
|
148
|
+
});
|
|
149
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
150
|
+
expect(types).toContain('sentry-no-pii-filter');
|
|
151
|
+
});
|
|
152
|
+
it('does not fire when beforeSend is wired up', async () => {
|
|
153
|
+
const result = await findCheck('sentry-pii-scrubbing').run(cwd, {
|
|
154
|
+
targetFiles: [join(cwd, 'src/init-with-callback.ts')],
|
|
155
|
+
});
|
|
156
|
+
expect(result.signals.length).toBe(0);
|
|
157
|
+
});
|
|
158
|
+
it('flags PII field names in setUser/setExtra/setContext calls', async () => {
|
|
159
|
+
const result = await findCheck('sentry-pii-scrubbing').run(cwd, {
|
|
160
|
+
targetFiles: [join(cwd, 'src/pii-context.ts')],
|
|
161
|
+
});
|
|
162
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
163
|
+
expect(types).toContain('sentry-pii-in-context');
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
// =============================================================================
|
|
167
|
+
// env-secret-exposure
|
|
168
|
+
// =============================================================================
|
|
169
|
+
describe('env-secret-exposure', () => {
|
|
170
|
+
let cwd;
|
|
171
|
+
beforeAll(() => {
|
|
172
|
+
cwd = makeFixtureDir('env-secret');
|
|
173
|
+
writeFixture(cwd, 'src/log-env.ts', ['export function diag() {', ' console.log(process.env);', '}'].join('\n'));
|
|
174
|
+
writeFixture(cwd, 'src/throw-secret.ts', [
|
|
175
|
+
'export function check() {',
|
|
176
|
+
' throw new Error("invalid secret " + process.env.API_SECRET);',
|
|
177
|
+
'}',
|
|
178
|
+
].join('\n'));
|
|
179
|
+
writeFixture(cwd, 'src/json-env.ts', ['export function dump() {', ' return JSON.stringify(process.env);', '}'].join('\n'));
|
|
180
|
+
writeFixture(cwd, 'src/spread-env.ts', ['export const settings = { ...process.env, custom: 1 };'].join('\n'));
|
|
181
|
+
writeFixture(cwd, 'src/clean.ts', ['export const port = process.env.PORT ?? "3000";'].join('\n'));
|
|
182
|
+
});
|
|
183
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
184
|
+
it('flags logging the entire process.env object', async () => {
|
|
185
|
+
const result = await findCheck('env-secret-exposure').run(cwd, {
|
|
186
|
+
targetFiles: [join(cwd, 'src/log-env.ts')],
|
|
187
|
+
});
|
|
188
|
+
const messages = result.signals.map((s) => s.message);
|
|
189
|
+
expect(messages.some((m) => m.includes('Logging entire process.env'))).toBe(true);
|
|
190
|
+
});
|
|
191
|
+
it('flags JSON.stringify(process.env)', async () => {
|
|
192
|
+
const result = await findCheck('env-secret-exposure').run(cwd, {
|
|
193
|
+
targetFiles: [join(cwd, 'src/json-env.ts')],
|
|
194
|
+
});
|
|
195
|
+
const messages = result.signals.map((s) => s.message);
|
|
196
|
+
expect(messages.some((m) => m.includes('JSON.stringify'))).toBe(true);
|
|
197
|
+
});
|
|
198
|
+
it('flags spread of process.env', async () => {
|
|
199
|
+
const result = await findCheck('env-secret-exposure').run(cwd, {
|
|
200
|
+
targetFiles: [join(cwd, 'src/spread-env.ts')],
|
|
201
|
+
});
|
|
202
|
+
const messages = result.signals.map((s) => s.message);
|
|
203
|
+
expect(messages.some((m) => m.includes('Spreading process.env'))).toBe(true);
|
|
204
|
+
});
|
|
205
|
+
it('does not fire on safe scoped access', async () => {
|
|
206
|
+
const result = await findCheck('env-secret-exposure').run(cwd, {
|
|
207
|
+
targetFiles: [join(cwd, 'src/clean.ts')],
|
|
208
|
+
});
|
|
209
|
+
expect(result.signals.length).toBe(0);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
// =============================================================================
|
|
213
|
+
// catch-clause-safety (drive more branches)
|
|
214
|
+
// =============================================================================
|
|
215
|
+
describe('catch-clause-safety branches', () => {
|
|
216
|
+
let cwd;
|
|
217
|
+
beforeAll(() => {
|
|
218
|
+
cwd = makeFixtureDir('catch-branches');
|
|
219
|
+
writeFixture(cwd, 'src/explicit-any.ts', [
|
|
220
|
+
'export async function run() {',
|
|
221
|
+
' try { await op(); }',
|
|
222
|
+
' catch (err: any) {',
|
|
223
|
+
' err.printStackTrace?.();',
|
|
224
|
+
' }',
|
|
225
|
+
'}',
|
|
226
|
+
'function op() {}',
|
|
227
|
+
].join('\n'));
|
|
228
|
+
writeFixture(cwd, 'src/unsafe-cast.ts', [
|
|
229
|
+
'export async function run() {',
|
|
230
|
+
' try { await op(); }',
|
|
231
|
+
' catch (err) {',
|
|
232
|
+
' const e = err as Error;',
|
|
233
|
+
' console.error(e.message);',
|
|
234
|
+
' }',
|
|
235
|
+
'}',
|
|
236
|
+
'function op() {}',
|
|
237
|
+
].join('\n'));
|
|
238
|
+
writeFixture(cwd, 'src/safe-cast.ts', [
|
|
239
|
+
'export async function run() {',
|
|
240
|
+
' try { await op(); }',
|
|
241
|
+
' catch (err) {',
|
|
242
|
+
' if (err instanceof Error) {',
|
|
243
|
+
' const e = err as Error;',
|
|
244
|
+
' console.error(e.message);',
|
|
245
|
+
' }',
|
|
246
|
+
' }',
|
|
247
|
+
'}',
|
|
248
|
+
'function op() {}',
|
|
249
|
+
].join('\n'));
|
|
250
|
+
writeFixture(cwd, 'src/empty-catch.ts', [
|
|
251
|
+
'export async function run() {',
|
|
252
|
+
' try { await op(); }',
|
|
253
|
+
' catch {}',
|
|
254
|
+
'}',
|
|
255
|
+
'function op() {}',
|
|
256
|
+
].join('\n'));
|
|
257
|
+
});
|
|
258
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
259
|
+
it('flags catch (e: any) explicit annotation', async () => {
|
|
260
|
+
const result = await findCheck('catch-clause-safety').run(cwd, {
|
|
261
|
+
targetFiles: [join(cwd, 'src/explicit-any.ts')],
|
|
262
|
+
});
|
|
263
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
264
|
+
expect(types).toContain('catch-any-annotation');
|
|
265
|
+
});
|
|
266
|
+
it('flags `as Error` cast without instanceof guard', async () => {
|
|
267
|
+
const result = await findCheck('catch-clause-safety').run(cwd, {
|
|
268
|
+
targetFiles: [join(cwd, 'src/unsafe-cast.ts')],
|
|
269
|
+
});
|
|
270
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
271
|
+
expect(types).toContain('unsafe-error-cast');
|
|
272
|
+
});
|
|
273
|
+
it('does not fire when instanceof Error guard is present', async () => {
|
|
274
|
+
const result = await findCheck('catch-clause-safety').run(cwd, {
|
|
275
|
+
targetFiles: [join(cwd, 'src/safe-cast.ts')],
|
|
276
|
+
});
|
|
277
|
+
expect(result.signals.length).toBe(0);
|
|
278
|
+
});
|
|
279
|
+
it('does not fire on empty catch blocks', async () => {
|
|
280
|
+
const result = await findCheck('catch-clause-safety').run(cwd, {
|
|
281
|
+
targetFiles: [join(cwd, 'src/empty-catch.ts')],
|
|
282
|
+
});
|
|
283
|
+
expect(result.signals.length).toBe(0);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
// =============================================================================
|
|
287
|
+
// dangerous-config-defaults — coverage of TLS variant
|
|
288
|
+
// =============================================================================
|
|
289
|
+
describe('dangerous-config-defaults TLS variant', () => {
|
|
290
|
+
let cwd;
|
|
291
|
+
beforeAll(() => {
|
|
292
|
+
cwd = makeFixtureDir('dcd-tls');
|
|
293
|
+
writeFixture(cwd, 'src/tls.ts', ['process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";'].join('\n'));
|
|
294
|
+
writeFixture(cwd, 'src/quoted.ts', ['export const env = {', ' "NODE_TLS_REJECT_UNAUTHORIZED": "0",', '};'].join('\n'));
|
|
295
|
+
});
|
|
296
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
297
|
+
it('runs without throwing on TLS_REJECT_UNAUTHORIZED variants', async () => {
|
|
298
|
+
const result = await findCheck('dangerous-config-defaults').run(cwd, {
|
|
299
|
+
targetFiles: [join(cwd, 'src/tls.ts'), join(cwd, 'src/quoted.ts')],
|
|
300
|
+
});
|
|
301
|
+
expect(result).toBeDefined();
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
// =============================================================================
|
|
305
|
+
// no-duplicate-packages: keyword-based matching
|
|
306
|
+
// =============================================================================
|
|
307
|
+
describe('no-duplicate-packages keyword matches', () => {
|
|
308
|
+
let cwd;
|
|
309
|
+
beforeAll(() => {
|
|
310
|
+
cwd = makeFixtureDir('no-dup-kw');
|
|
311
|
+
// Two packages flagged as "contracts" by keyword
|
|
312
|
+
writeFixture(cwd, 'packages/a/package.json', JSON.stringify({
|
|
313
|
+
name: '@org/a',
|
|
314
|
+
keywords: ['types', 'shared'],
|
|
315
|
+
}, null, 2));
|
|
316
|
+
writeFixture(cwd, 'packages/b/package.json', JSON.stringify({
|
|
317
|
+
name: '@org/b',
|
|
318
|
+
keywords: ['types', 'public'],
|
|
319
|
+
}, null, 2));
|
|
320
|
+
});
|
|
321
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
322
|
+
it('detects duplicates via keywords field', async () => {
|
|
323
|
+
const result = await findCheck('no-duplicate-packages').run(cwd, {
|
|
324
|
+
targetFiles: [join(cwd, 'packages/a/package.json'), join(cwd, 'packages/b/package.json')],
|
|
325
|
+
});
|
|
326
|
+
// Both packages have `types` keyword → contracts/types category
|
|
327
|
+
const matches = result.signals.map((s) => s.metadata.match);
|
|
328
|
+
expect(matches).toContain('contracts/types');
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
// =============================================================================
|
|
332
|
+
// fitness-ignore-hygiene — exercise excessive directive accumulation
|
|
333
|
+
// =============================================================================
|
|
334
|
+
describe('fitness-ignore-hygiene cumulative count', () => {
|
|
335
|
+
let cwd;
|
|
336
|
+
beforeAll(() => {
|
|
337
|
+
cwd = makeFixtureDir('fih');
|
|
338
|
+
// 8+ directives with reasons → triggers excessive-ignores threshold
|
|
339
|
+
writeFixture(cwd, 'src/many.ts', [
|
|
340
|
+
...Array.from({ length: 9 }, (_, i) => `// @fitness-ignore-file slug-${i} -- justified reason`),
|
|
341
|
+
'export const x = 1;',
|
|
342
|
+
].join('\n'));
|
|
343
|
+
});
|
|
344
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
345
|
+
it('flags files with excessive ignore directives', async () => {
|
|
346
|
+
const result = await findCheck('fitness-ignore-hygiene').run(cwd, {
|
|
347
|
+
targetFiles: [join(cwd, 'src/many.ts')],
|
|
348
|
+
});
|
|
349
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
350
|
+
expect(types).toContain('excessive-ignores');
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
// =============================================================================
|
|
354
|
+
// no-stub-tests — cover function() {} and trivial assertions
|
|
355
|
+
// =============================================================================
|
|
356
|
+
describe('no-stub-tests function form', () => {
|
|
357
|
+
let cwd;
|
|
358
|
+
beforeAll(() => {
|
|
359
|
+
cwd = makeFixtureDir('stub-fn');
|
|
360
|
+
writeFixture(cwd, 'src/__tests__/fn.test.ts', ['import { it } from "vitest";', 'it("plain function form", function() {});'].join('\n'));
|
|
361
|
+
});
|
|
362
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
363
|
+
it('flags function() {} empty bodies', async () => {
|
|
364
|
+
const result = await findCheck('no-stub-tests').run(cwd, {
|
|
365
|
+
targetFiles: [join(cwd, 'src/__tests__/fn.test.ts')],
|
|
366
|
+
});
|
|
367
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
368
|
+
expect(types).toContain('empty-test-body');
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
// =============================================================================
|
|
372
|
+
// timer-lifecycle — cover setInterval/setTimeout in tests
|
|
373
|
+
// =============================================================================
|
|
374
|
+
describe('timer-lifecycle additional', () => {
|
|
375
|
+
let cwd;
|
|
376
|
+
beforeAll(() => {
|
|
377
|
+
cwd = makeFixtureDir('timer-additional');
|
|
378
|
+
writeFixture(cwd, 'src/long-running.ts', [
|
|
379
|
+
'export class Worker {',
|
|
380
|
+
' start() {',
|
|
381
|
+
' setInterval(() => this.tick(), 60000);',
|
|
382
|
+
' setTimeout(() => this.boot(), 5000);',
|
|
383
|
+
' }',
|
|
384
|
+
' tick() {}',
|
|
385
|
+
' boot() {}',
|
|
386
|
+
'}',
|
|
387
|
+
].join('\n'));
|
|
388
|
+
});
|
|
389
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
390
|
+
it('runs without throwing on long-running timer fixture', async () => {
|
|
391
|
+
const result = await findCheck('timer-lifecycle').run(cwd, {
|
|
392
|
+
targetFiles: [join(cwd, 'src/long-running.ts')],
|
|
393
|
+
});
|
|
394
|
+
expect(result).toBeDefined();
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
// =============================================================================
|
|
398
|
+
// rate-limit-coverage edge: file that contains framework but no actual routes
|
|
399
|
+
// =============================================================================
|
|
400
|
+
describe('rate-limit-coverage skip paths', () => {
|
|
401
|
+
let cwd;
|
|
402
|
+
beforeAll(() => {
|
|
403
|
+
cwd = makeFixtureDir('rl-skip');
|
|
404
|
+
writeFixture(cwd, 'src/no-routes.ts', [
|
|
405
|
+
'export function build(fastify: any) {',
|
|
406
|
+
' // no routes here',
|
|
407
|
+
' return fastify;',
|
|
408
|
+
'}',
|
|
409
|
+
].join('\n'));
|
|
410
|
+
});
|
|
411
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
412
|
+
it('skips files that do not call route framework methods', async () => {
|
|
413
|
+
const result = await findCheck('rate-limit-coverage').run(cwd, {
|
|
414
|
+
targetFiles: [join(cwd, 'src/no-routes.ts')],
|
|
415
|
+
});
|
|
416
|
+
expect(result.signals.length).toBe(0);
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
// =============================================================================
|
|
420
|
+
// public-api-jsdoc
|
|
421
|
+
// =============================================================================
|
|
422
|
+
describe('public-api-jsdoc', () => {
|
|
423
|
+
let cwd;
|
|
424
|
+
beforeAll(() => {
|
|
425
|
+
cwd = makeFixtureDir('pubapi-jsdoc');
|
|
426
|
+
writeFixture(cwd, 'src/no-doc.ts', ['export function thing() { return 1; }', 'export class Box { open() {} }'].join('\n'));
|
|
427
|
+
writeFixture(cwd, 'src/with-doc.ts', ['/**', ' * Returns one.', ' */', 'export function thing() { return 1; }'].join('\n'));
|
|
428
|
+
});
|
|
429
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
430
|
+
it('runs without throwing on public-api fixtures', async () => {
|
|
431
|
+
const result = await findCheck('public-api-jsdoc').run(cwd, {
|
|
432
|
+
targetFiles: [join(cwd, 'src/no-doc.ts'), join(cwd, 'src/with-doc.ts')],
|
|
433
|
+
});
|
|
434
|
+
expect(result).toBeDefined();
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
// =============================================================================
|
|
438
|
+
// dockerfile checks — additional fixtures
|
|
439
|
+
// =============================================================================
|
|
440
|
+
describe('docker-best-practices additional', () => {
|
|
441
|
+
let cwd;
|
|
442
|
+
beforeAll(() => {
|
|
443
|
+
cwd = makeFixtureDir('docker-bp-additional');
|
|
444
|
+
writeFixture(cwd, 'Dockerfile.latest', [
|
|
445
|
+
'FROM node:latest', // floating tag
|
|
446
|
+
'COPY . .',
|
|
447
|
+
'CMD ["node", "src/app.js"]',
|
|
448
|
+
].join('\n'));
|
|
449
|
+
writeFixture(cwd, 'Dockerfile.no-healthcheck', ['FROM node:20', 'COPY . .', 'CMD ["node", "src/app.js"]'].join('\n'));
|
|
450
|
+
});
|
|
451
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
452
|
+
it('runs without throwing on docker fixtures', async () => {
|
|
453
|
+
const result = await findCheck('docker-best-practices').run(cwd, {
|
|
454
|
+
targetFiles: [join(cwd, 'Dockerfile.latest'), join(cwd, 'Dockerfile.no-healthcheck')],
|
|
455
|
+
});
|
|
456
|
+
expect(result).toBeDefined();
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
// =============================================================================
|
|
460
|
+
// docker-ignore-validation
|
|
461
|
+
// =============================================================================
|
|
462
|
+
describe('docker-ignore-validation', () => {
|
|
463
|
+
let cwd;
|
|
464
|
+
beforeAll(() => {
|
|
465
|
+
cwd = makeFixtureDir('docker-ignore');
|
|
466
|
+
writeFixture(cwd, 'Dockerfile', ['FROM node:20', 'COPY . .', 'CMD ["node", "src/app.js"]'].join('\n'));
|
|
467
|
+
writeFixture(cwd, '.dockerignore', ['node_modules', '.git'].join('\n'));
|
|
468
|
+
});
|
|
469
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
470
|
+
it('runs without throwing', async () => {
|
|
471
|
+
const result = await findCheck('docker-ignore-validation').run(cwd, {
|
|
472
|
+
targetFiles: [join(cwd, 'Dockerfile'), join(cwd, '.dockerignore')],
|
|
473
|
+
});
|
|
474
|
+
expect(result).toBeDefined();
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
// =============================================================================
|
|
478
|
+
// heavy-import-detection
|
|
479
|
+
// =============================================================================
|
|
480
|
+
describe('heavy-import-detection', () => {
|
|
481
|
+
let cwd;
|
|
482
|
+
beforeAll(() => {
|
|
483
|
+
cwd = makeFixtureDir('heavy-imp');
|
|
484
|
+
writeFixture(cwd, 'src/lodash-namespace.ts', ['import * as _ from "lodash";', 'export const x = _.pick({ a: 1 }, ["a"]);'].join('\n'));
|
|
485
|
+
writeFixture(cwd, 'src/moment.ts', ['import moment from "moment";', 'export const x = moment(new Date()).format();'].join('\n'));
|
|
486
|
+
writeFixture(cwd, 'src/aws-sdk.ts', ['import AWS from "aws-sdk";', 'export const s3 = new AWS.S3();'].join('\n'));
|
|
487
|
+
writeFixture(cwd, 'src/excessive-named.ts', [
|
|
488
|
+
'import { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q } from "huge-lib";',
|
|
489
|
+
'export const x = { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q };',
|
|
490
|
+
].join('\n'));
|
|
491
|
+
writeFixture(cwd, 'src/scoped.ts', [
|
|
492
|
+
'import { format } from "date-fns";',
|
|
493
|
+
'export const x = format(new Date(), "yyyy-MM-dd");',
|
|
494
|
+
].join('\n'));
|
|
495
|
+
});
|
|
496
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
497
|
+
it('flags namespace import of lodash', async () => {
|
|
498
|
+
const result = await findCheck('heavy-import-detection').run(cwd, {
|
|
499
|
+
targetFiles: [join(cwd, 'src/lodash-namespace.ts')],
|
|
500
|
+
});
|
|
501
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
502
|
+
expect(types).toContain('HEAVY_IMPORT');
|
|
503
|
+
});
|
|
504
|
+
it('flags moment as deprecated', async () => {
|
|
505
|
+
const result = await findCheck('heavy-import-detection').run(cwd, {
|
|
506
|
+
targetFiles: [join(cwd, 'src/moment.ts')],
|
|
507
|
+
});
|
|
508
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
509
|
+
expect(types).toContain('DEPRECATED_LIBRARY');
|
|
510
|
+
});
|
|
511
|
+
it('flags aws-sdk v2 as deprecated', async () => {
|
|
512
|
+
const result = await findCheck('heavy-import-detection').run(cwd, {
|
|
513
|
+
targetFiles: [join(cwd, 'src/aws-sdk.ts')],
|
|
514
|
+
});
|
|
515
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
516
|
+
expect(types).toContain('DEPRECATED_LIBRARY');
|
|
517
|
+
});
|
|
518
|
+
it('flags excessive named imports', async () => {
|
|
519
|
+
const result = await findCheck('heavy-import-detection').run(cwd, {
|
|
520
|
+
targetFiles: [join(cwd, 'src/excessive-named.ts')],
|
|
521
|
+
});
|
|
522
|
+
const types = result.signals.map((s) => s.metadata.type);
|
|
523
|
+
expect(types).toContain('EXCESSIVE_NAMED_IMPORTS');
|
|
524
|
+
});
|
|
525
|
+
it('does not fire on lightweight scoped imports', async () => {
|
|
526
|
+
const result = await findCheck('heavy-import-detection').run(cwd, {
|
|
527
|
+
targetFiles: [join(cwd, 'src/scoped.ts')],
|
|
528
|
+
});
|
|
529
|
+
expect(result.signals.length).toBe(0);
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
// =============================================================================
|
|
533
|
+
// project-readme-existence
|
|
534
|
+
// =============================================================================
|
|
535
|
+
describe('project-readme-existence', () => {
|
|
536
|
+
let cwd;
|
|
537
|
+
beforeAll(() => {
|
|
538
|
+
cwd = makeFixtureDir('readme');
|
|
539
|
+
writeFixture(cwd, 'package.json', JSON.stringify({ name: 'no-readme' }, null, 2));
|
|
540
|
+
});
|
|
541
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
542
|
+
it('runs without throwing on a fixture with no README', async () => {
|
|
543
|
+
const result = await findCheck('project-readme-existence').run(cwd, {
|
|
544
|
+
targetFiles: [join(cwd, 'package.json')],
|
|
545
|
+
});
|
|
546
|
+
expect(result).toBeDefined();
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
// =============================================================================
|
|
550
|
+
// stale-build-artifacts variants
|
|
551
|
+
// =============================================================================
|
|
552
|
+
describe('stale-build-artifacts variants', () => {
|
|
553
|
+
let cwd;
|
|
554
|
+
beforeAll(() => {
|
|
555
|
+
cwd = makeFixtureDir('stale-variants');
|
|
556
|
+
writeFixture(cwd, 'packages/a/dist/index.js', '// stale');
|
|
557
|
+
writeFixture(cwd, 'packages/a/package.json', JSON.stringify({
|
|
558
|
+
name: 'a',
|
|
559
|
+
main: 'dist/index.js',
|
|
560
|
+
}, null, 2));
|
|
561
|
+
});
|
|
562
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
563
|
+
it('runs without throwing', async () => {
|
|
564
|
+
const result = await findCheck('stale-build-artifacts').run(cwd, {
|
|
565
|
+
targetFiles: [join(cwd, 'packages/a/dist/index.js'), join(cwd, 'packages/a/package.json')],
|
|
566
|
+
});
|
|
567
|
+
expect(result).toBeDefined();
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
// =============================================================================
|
|
571
|
+
// eslint-justifications
|
|
572
|
+
// =============================================================================
|
|
573
|
+
describe('eslint-justifications', () => {
|
|
574
|
+
let cwd;
|
|
575
|
+
beforeAll(() => {
|
|
576
|
+
cwd = makeFixtureDir('eslint-just');
|
|
577
|
+
writeFixture(cwd, 'src/no-reason.ts', ['// eslint-disable-next-line no-console', 'console.log("hi");'].join('\n'));
|
|
578
|
+
writeFixture(cwd, 'src/generic-reason.ts', ['// eslint-disable-next-line no-console -- todo', 'console.log("hi");'].join('\n'));
|
|
579
|
+
writeFixture(cwd, 'src/proper.ts', [
|
|
580
|
+
'// eslint-disable-next-line no-console -- intentional CLI logger output',
|
|
581
|
+
'console.log("hi");',
|
|
582
|
+
].join('\n'));
|
|
583
|
+
});
|
|
584
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
585
|
+
it('runs without throwing on disable-without-reason fixtures', async () => {
|
|
586
|
+
const result = await findCheck('eslint-justifications').run(cwd, {
|
|
587
|
+
targetFiles: [
|
|
588
|
+
join(cwd, 'src/no-reason.ts'),
|
|
589
|
+
join(cwd, 'src/generic-reason.ts'),
|
|
590
|
+
join(cwd, 'src/proper.ts'),
|
|
591
|
+
],
|
|
592
|
+
});
|
|
593
|
+
expect(result).toBeDefined();
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
// =============================================================================
|
|
597
|
+
// semgrep-justifications
|
|
598
|
+
// =============================================================================
|
|
599
|
+
describe('semgrep-justifications', () => {
|
|
600
|
+
let cwd;
|
|
601
|
+
beforeAll(() => {
|
|
602
|
+
cwd = makeFixtureDir('semgrep-just');
|
|
603
|
+
writeFixture(cwd, 'src/no-reason.ts', ['// nosemgrep: javascript.lang.security', 'eval("1 + 1");'].join('\n'));
|
|
604
|
+
writeFixture(cwd, 'src/proper.ts', [
|
|
605
|
+
'// nosemgrep: javascript.lang.security -- expression evaluation in trusted plugin sandbox',
|
|
606
|
+
'eval("1 + 1");',
|
|
607
|
+
].join('\n'));
|
|
608
|
+
});
|
|
609
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
610
|
+
it('runs without throwing on nosemgrep fixtures', async () => {
|
|
611
|
+
const result = await findCheck('semgrep-justifications').run(cwd, {
|
|
612
|
+
targetFiles: [join(cwd, 'src/no-reason.ts'), join(cwd, 'src/proper.ts')],
|
|
613
|
+
});
|
|
614
|
+
expect(result).toBeDefined();
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
// =============================================================================
|
|
618
|
+
// directive-audit additional fixtures (drive more counters)
|
|
619
|
+
// =============================================================================
|
|
620
|
+
describe('directive-audit additional', () => {
|
|
621
|
+
let cwd;
|
|
622
|
+
beforeAll(() => {
|
|
623
|
+
cwd = makeFixtureDir('directive-add');
|
|
624
|
+
writeFixture(cwd, 'src/each-kind.ts', [
|
|
625
|
+
'/* eslint-disable no-console */',
|
|
626
|
+
'console.log("disabled");',
|
|
627
|
+
'/* eslint-enable */',
|
|
628
|
+
'// @ts-expect-error reason — third-party type incorrect',
|
|
629
|
+
'const x: number = "no" as any;',
|
|
630
|
+
'// @ts-ignore — old shim',
|
|
631
|
+
'const y: string = 1 as any;',
|
|
632
|
+
'// @fitness-ignore-file no-todo-comments -- intentional',
|
|
633
|
+
'// @fitness-ignore-next-line no-console-log -- intentional',
|
|
634
|
+
'// nosemgrep: jsx.security.tag',
|
|
635
|
+
].join('\n'));
|
|
636
|
+
});
|
|
637
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
638
|
+
it('runs all directive parsers without throwing', async () => {
|
|
639
|
+
const result = await findCheck('directive-audit').run(cwd, {
|
|
640
|
+
targetFiles: [join(cwd, 'src/each-kind.ts')],
|
|
641
|
+
});
|
|
642
|
+
expect(result).toBeDefined();
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
// =============================================================================
|
|
646
|
+
// test-convention-consistency: mixed naming forms
|
|
647
|
+
// =============================================================================
|
|
648
|
+
describe('test-convention-consistency', () => {
|
|
649
|
+
let cwd;
|
|
650
|
+
beforeAll(() => {
|
|
651
|
+
cwd = makeFixtureDir('tcc');
|
|
652
|
+
writeFixture(cwd, 'src/__tests__/foo-spec.ts', ['import { it } from "vitest";', 'it("works", () => undefined);'].join('\n'));
|
|
653
|
+
writeFixture(cwd, 'src/__tests__/bar.test.ts', ['import { it } from "vitest";', 'it("works", () => undefined);'].join('\n'));
|
|
654
|
+
});
|
|
655
|
+
afterAll(() => rmSync(cwd, { recursive: true, force: true }));
|
|
656
|
+
it('runs without throwing on mixed naming forms', async () => {
|
|
657
|
+
const result = await findCheck('test-convention-consistency').run(cwd, {
|
|
658
|
+
targetFiles: [join(cwd, 'src/__tests__/foo-spec.ts'), join(cwd, 'src/__tests__/bar.test.ts')],
|
|
659
|
+
});
|
|
660
|
+
expect(result).toBeDefined();
|
|
661
|
+
});
|
|
662
|
+
});
|
|
663
|
+
//# sourceMappingURL=behavior-fixtures-3.test.js.map
|