pr-checkmate 3.0.4 → 3.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/dist/{cli.js → cjs/cli.js} +30 -30
- package/dist/{config → cjs/config}/index.d.ts +2 -2
- package/dist/{config → cjs/config}/index.js +8 -7
- package/dist/{config → cjs/config}/loader.d.ts +1 -1
- package/dist/{config → cjs/config}/loader.js +8 -8
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.js +10 -10
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.js +27 -27
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.js +17 -17
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.js +18 -18
- package/dist/{core → cjs/core}/checks/dependencies/license-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/license-check.js +12 -12
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.js +14 -14
- package/dist/{core → cjs/core}/checks/findings.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/findings.js +16 -16
- package/dist/{core → cjs/core}/checks/git/custom-rules.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/custom-rules.js +19 -19
- package/dist/{core → cjs/core}/checks/git/diff-smell.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/git/diff-smell.js +13 -13
- package/dist/{core → cjs/core}/checks/git/large-files.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/large-files.js +15 -15
- package/dist/{core → cjs/core}/checks/git/leftover-debug.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/leftover-debug.js +13 -13
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.js +12 -12
- package/dist/{core → cjs/core}/checks/git/merge-conflict.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/merge-conflict.js +15 -15
- package/dist/{core → cjs/core}/checks/git/missing-tests.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/missing-tests.js +15 -15
- package/dist/{core → cjs/core}/checks/git/todo-fixme.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/todo-fixme.js +11 -11
- package/dist/{core → cjs/core}/checks/languages/cpp-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/cpp-format.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/external-checks.d.ts +9 -9
- package/dist/{core → cjs/core}/checks/languages/external-checks.js +10 -10
- package/dist/{core → cjs/core}/checks/languages/external-runner.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/languages/external-runner.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/go-format.d.ts +1 -1
- package/dist/cjs/core/checks/languages/go-format.js +202 -0
- package/dist/cjs/core/checks/languages/lint.d.ts +2 -0
- package/dist/{core → cjs/core}/checks/languages/lint.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/prettier.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/prettier.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/python-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-format.js +14 -14
- package/dist/{core → cjs/core}/checks/languages/python-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-lint.js +13 -13
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.js +29 -29
- package/dist/{core → cjs/core}/checks/languages/typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/typecheck.js +13 -13
- package/dist/{core → cjs/core}/checks/pr/commitlint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/commitlint.js +12 -12
- package/dist/{core → cjs/core}/checks/pr/pr-body.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-body.js +8 -8
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.js +10 -10
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/case-collision.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/case-collision.js +7 -7
- package/dist/{core → cjs/core}/checks/quality/config-validation.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/config-validation.js +9 -9
- package/dist/{core → cjs/core}/checks/quality/coverage.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/coverage.js +4 -4
- package/dist/{core → cjs/core}/checks/quality/dead-code.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/dead-code.js +23 -23
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.js +22 -22
- package/dist/{core → cjs/core}/checks/quality/license-header.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/license-header.js +16 -16
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.js +17 -17
- package/dist/{core → cjs/core}/checks/quality/package-size.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/package-size.js +12 -12
- package/dist/{core → cjs/core}/checks/quality/spellcheck.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/quality/spellcheck.js +18 -18
- package/dist/{core → cjs/core}/checks/quality/symlinks.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/symlinks.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.js +12 -12
- package/dist/{core → cjs/core}/checks/security/diff-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/diff-security.js +15 -15
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.js +16 -16
- package/dist/{core → cjs/core}/checks/security/migration-safety.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/migration-safety.js +17 -17
- package/dist/{core → cjs/core}/checks/security/security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/security.js +21 -21
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.js +14 -14
- package/dist/{core → cjs/core}/checks/security/workflow-security.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/security/workflow-security.js +14 -14
- package/dist/{core → cjs/core}/checks/tool-install.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/tool-install.js +2 -2
- package/dist/{core → cjs/core}/context.d.ts +1 -1
- package/dist/{core → cjs/core}/context.js +16 -16
- package/dist/cjs/core/index.d.ts +4 -0
- package/dist/{core → cjs/core}/index.js +7 -7
- package/dist/{core → cjs/core}/install/cache.js +2 -2
- package/dist/{core → cjs/core}/install/doctor.d.ts +4 -4
- package/dist/{core → cjs/core}/install/doctor.js +34 -34
- package/dist/{core → cjs/core}/install/ensure.d.ts +2 -2
- package/dist/{core → cjs/core}/install/ensure.js +15 -14
- package/dist/{core → cjs/core}/install/lock.js +4 -4
- package/dist/{core → cjs/core}/install/prepare.d.ts +4 -4
- package/dist/{core → cjs/core}/install/prepare.js +13 -13
- package/dist/{core → cjs/core}/install/profiles.d.ts +2 -2
- package/dist/{core → cjs/core}/install/reuse.d.ts +1 -1
- package/dist/{core → cjs/core}/install/reuse.js +4 -4
- package/dist/{core → cjs/core}/registry.d.ts +1 -1
- package/dist/cjs/core/registry.js +112 -0
- package/dist/{core → cjs/core}/reporters.d.ts +1 -1
- package/dist/{core → cjs/core}/reporters.js +28 -28
- package/dist/{core → cjs/core}/run-checks.d.ts +2 -2
- package/dist/{core → cjs/core}/run-checks.js +31 -31
- package/dist/{core → cjs/core}/targets.d.ts +1 -1
- package/dist/{core → cjs/core}/targets.js +20 -20
- package/dist/{core → cjs/core}/types.d.ts +3 -3
- package/dist/cjs/index.d.ts +12 -0
- package/dist/{index.js → cjs/index.js} +18 -18
- package/dist/{init.js → cjs/init.js} +68 -56
- package/dist/{interfaces → cjs/interfaces}/index.d.ts +3 -3
- package/dist/cjs/package.json +1 -0
- package/dist/{scripts → cjs/scripts}/copy-configs.js +22 -7
- package/dist/{scripts → cjs/scripts}/generate-install-manifests.js +2 -2
- package/dist/{scripts → cjs/scripts}/publish-github.js +4 -4
- package/dist/{utils → cjs/utils}/detect-language.js +12 -12
- package/dist/cjs/utils/execa.js +46 -0
- package/dist/{utils → cjs/utils}/git.js +2 -2
- package/dist/{utils → cjs/utils}/http.js +2 -2
- package/dist/cjs/utils/index.d.ts +15 -0
- package/dist/{utils → cjs/utils}/index.js +13 -13
- package/dist/{utils → cjs/utils}/own-deps.d.ts +2 -0
- package/dist/{utils → cjs/utils}/own-deps.js +1 -0
- package/dist/{utils → cjs/utils}/package-version.js +2 -1
- package/dist/{utils → cjs/utils}/resolve-bin.js +2 -1
- package/dist/{utils → cjs/utils}/update-notifier.js +4 -4
- package/dist/esm/cli.d.ts +2 -0
- package/dist/esm/cli.js +137 -0
- package/dist/esm/config/constants.d.ts +153 -0
- package/dist/esm/config/constants.js +360 -0
- package/dist/esm/config/index.d.ts +40 -0
- package/dist/esm/config/index.js +60 -0
- package/dist/esm/config/loader.d.ts +6 -0
- package/dist/esm/config/loader.js +191 -0
- package/dist/esm/config/pr-checkmate-workflow-docker.yml +79 -0
- package/dist/esm/config/pr-checkmate-workflow.yml +92 -0
- package/dist/esm/core/checks/dependencies/banned-imports.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/banned-imports.js +70 -0
- package/dist/esm/core/checks/dependencies/circular-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/circular-deps.js +155 -0
- package/dist/esm/core/checks/dependencies/dependency-check.d.ts +43 -0
- package/dist/esm/core/checks/dependencies/dependency-check.js +174 -0
- package/dist/esm/core/checks/dependencies/grype-scan.d.ts +22 -0
- package/dist/esm/core/checks/dependencies/grype-scan.js +112 -0
- package/dist/esm/core/checks/dependencies/license-check.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/license-check.js +61 -0
- package/dist/esm/core/checks/dependencies/npm-audit.d.ts +6 -0
- package/dist/esm/core/checks/dependencies/npm-audit.js +80 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.js +66 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.js +54 -0
- package/dist/esm/core/checks/findings.d.ts +299 -0
- package/dist/esm/core/checks/findings.js +701 -0
- package/dist/esm/core/checks/git/custom-rules.d.ts +2 -0
- package/dist/esm/core/checks/git/custom-rules.js +106 -0
- package/dist/esm/core/checks/git/diff-smell.d.ts +19 -0
- package/dist/esm/core/checks/git/diff-smell.js +69 -0
- package/dist/esm/core/checks/git/large-files.d.ts +2 -0
- package/dist/esm/core/checks/git/large-files.js +112 -0
- package/dist/esm/core/checks/git/leftover-debug.d.ts +2 -0
- package/dist/esm/core/checks/git/leftover-debug.js +89 -0
- package/dist/esm/core/checks/git/lockfile-drift.d.ts +2 -0
- package/dist/esm/core/checks/git/lockfile-drift.js +114 -0
- package/dist/esm/core/checks/git/merge-conflict.d.ts +2 -0
- package/dist/esm/core/checks/git/merge-conflict.js +117 -0
- package/dist/esm/core/checks/git/missing-tests.d.ts +2 -0
- package/dist/esm/core/checks/git/missing-tests.js +105 -0
- package/dist/esm/core/checks/git/todo-fixme.d.ts +7 -0
- package/dist/esm/core/checks/git/todo-fixme.js +80 -0
- package/dist/esm/core/checks/languages/cpp-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/cpp-format.js +91 -0
- package/dist/esm/core/checks/languages/external-checks.d.ts +77 -0
- package/dist/esm/core/checks/languages/external-checks.js +197 -0
- package/dist/esm/core/checks/languages/external-runner.d.ts +119 -0
- package/dist/esm/core/checks/languages/external-runner.js +138 -0
- package/dist/esm/core/checks/languages/go-format.d.ts +8 -0
- package/dist/{core → esm/core}/checks/languages/go-format.js +29 -35
- package/dist/esm/core/checks/languages/lint.d.ts +2 -0
- package/dist/esm/core/checks/languages/lint.js +92 -0
- package/dist/esm/core/checks/languages/prettier.d.ts +2 -0
- package/dist/esm/core/checks/languages/prettier.js +85 -0
- package/dist/esm/core/checks/languages/python-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/python-format.js +61 -0
- package/dist/esm/core/checks/languages/python-lint.d.ts +9 -0
- package/dist/esm/core/checks/languages/python-lint.js +55 -0
- package/dist/esm/core/checks/languages/python-typecheck.d.ts +14 -0
- package/dist/esm/core/checks/languages/python-typecheck.js +184 -0
- package/dist/esm/core/checks/languages/ruff-shared.d.ts +10 -0
- package/dist/esm/core/checks/languages/ruff-shared.js +35 -0
- package/dist/esm/core/checks/languages/typecheck.d.ts +2 -0
- package/dist/esm/core/checks/languages/typecheck.js +61 -0
- package/dist/esm/core/checks/pr/commitlint.d.ts +2 -0
- package/dist/esm/core/checks/pr/commitlint.js +102 -0
- package/dist/esm/core/checks/pr/pr-body.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-body.js +43 -0
- package/dist/esm/core/checks/pr/pr-size-check.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-size-check.js +42 -0
- package/dist/esm/core/checks/pr/pr-title-lint.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-title-lint.js +31 -0
- package/dist/esm/core/checks/quality/case-collision.d.ts +8 -0
- package/dist/esm/core/checks/quality/case-collision.js +39 -0
- package/dist/esm/core/checks/quality/config-validation.d.ts +11 -0
- package/dist/esm/core/checks/quality/config-validation.js +188 -0
- package/dist/esm/core/checks/quality/coverage.d.ts +2 -0
- package/dist/esm/core/checks/quality/coverage.js +62 -0
- package/dist/esm/core/checks/quality/dead-code.d.ts +2 -0
- package/dist/esm/core/checks/quality/dead-code.js +124 -0
- package/dist/esm/core/checks/quality/duplicate-check.d.ts +2 -0
- package/dist/esm/core/checks/quality/duplicate-check.js +141 -0
- package/dist/esm/core/checks/quality/license-header.d.ts +7 -0
- package/dist/esm/core/checks/quality/license-header.js +81 -0
- package/dist/esm/core/checks/quality/markdown-lint.d.ts +2 -0
- package/dist/esm/core/checks/quality/markdown-lint.js +104 -0
- package/dist/esm/core/checks/quality/package-size.d.ts +36 -0
- package/dist/esm/core/checks/quality/package-size.js +196 -0
- package/dist/esm/core/checks/quality/spellcheck.d.ts +77 -0
- package/dist/esm/core/checks/quality/spellcheck.js +296 -0
- package/dist/esm/core/checks/quality/symlinks.d.ts +16 -0
- package/dist/esm/core/checks/quality/symlinks.js +57 -0
- package/dist/esm/core/checks/quality/yaml-lint.d.ts +20 -0
- package/dist/esm/core/checks/quality/yaml-lint.js +116 -0
- package/dist/esm/core/checks/security/diff-security.d.ts +2 -0
- package/dist/esm/core/checks/security/diff-security.js +354 -0
- package/dist/esm/core/checks/security/dockerfile-security.d.ts +2 -0
- package/dist/esm/core/checks/security/dockerfile-security.js +98 -0
- package/dist/esm/core/checks/security/migration-safety.d.ts +2 -0
- package/dist/esm/core/checks/security/migration-safety.js +137 -0
- package/dist/esm/core/checks/security/security.d.ts +63 -0
- package/dist/esm/core/checks/security/security.js +201 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.d.ts +2 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.js +160 -0
- package/dist/esm/core/checks/security/workflow-security.d.ts +12 -0
- package/dist/esm/core/checks/security/workflow-security.js +100 -0
- package/dist/esm/core/checks/tool-install.d.ts +102 -0
- package/dist/esm/core/checks/tool-install.js +66 -0
- package/dist/esm/core/commands.d.ts +27 -0
- package/dist/esm/core/commands.js +89 -0
- package/dist/esm/core/context.d.ts +62 -0
- package/dist/esm/core/context.js +241 -0
- package/dist/esm/core/index.d.ts +4 -0
- package/dist/esm/core/index.js +4 -0
- package/dist/esm/core/install/cache.d.ts +58 -0
- package/dist/esm/core/install/cache.js +142 -0
- package/dist/esm/core/install/doctor.d.ts +35 -0
- package/dist/esm/core/install/doctor.js +164 -0
- package/dist/esm/core/install/ensure.d.ts +77 -0
- package/dist/esm/core/install/ensure.js +269 -0
- package/dist/esm/core/install/lock.d.ts +34 -0
- package/dist/esm/core/install/lock.js +92 -0
- package/dist/esm/core/install/merge.d.ts +47 -0
- package/dist/esm/core/install/merge.js +85 -0
- package/dist/esm/core/install/prepare.d.ts +76 -0
- package/dist/esm/core/install/prepare.js +142 -0
- package/dist/esm/core/install/profiles.d.ts +78 -0
- package/dist/esm/core/install/profiles.js +192 -0
- package/dist/esm/core/install/reuse.d.ts +41 -0
- package/dist/esm/core/install/reuse.js +100 -0
- package/dist/esm/core/registry.d.ts +6 -0
- package/dist/esm/core/registry.js +109 -0
- package/dist/esm/core/reporters.d.ts +18 -0
- package/dist/esm/core/reporters.js +266 -0
- package/dist/esm/core/run-checks.d.ts +33 -0
- package/dist/esm/core/run-checks.js +293 -0
- package/dist/esm/core/targets.d.ts +140 -0
- package/dist/esm/core/targets.js +213 -0
- package/dist/esm/core/types.d.ts +195 -0
- package/dist/esm/core/types.js +38 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/init.d.ts +38 -0
- package/dist/esm/init.js +421 -0
- package/dist/esm/interfaces/index.d.ts +432 -0
- package/dist/esm/interfaces/index.js +2 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/scripts/copy-configs.d.ts +1 -0
- package/dist/esm/scripts/copy-configs.js +64 -0
- package/dist/esm/scripts/generate-install-manifests.d.ts +39 -0
- package/dist/esm/scripts/generate-install-manifests.js +115 -0
- package/dist/esm/scripts/publish-github.d.ts +1 -0
- package/dist/esm/scripts/publish-github.js +45 -0
- package/dist/esm/utils/ci.d.ts +11 -0
- package/dist/esm/utils/ci.js +40 -0
- package/dist/esm/utils/detect-language.d.ts +48 -0
- package/dist/esm/utils/detect-language.js +234 -0
- package/dist/esm/utils/direct-deps.d.ts +21 -0
- package/dist/esm/utils/direct-deps.js +220 -0
- package/dist/esm/utils/execa.d.ts +22 -0
- package/dist/{utils → esm/utils}/execa.js +1 -4
- package/dist/esm/utils/git.d.ts +14 -0
- package/dist/esm/utils/git.js +21 -0
- package/dist/esm/utils/glob.d.ts +24 -0
- package/dist/esm/utils/glob.js +40 -0
- package/dist/esm/utils/http.d.ts +59 -0
- package/dist/esm/utils/http.js +115 -0
- package/dist/esm/utils/index.d.ts +15 -0
- package/dist/esm/utils/index.js +26 -0
- package/dist/esm/utils/logger.d.ts +65 -0
- package/dist/esm/utils/logger.js +157 -0
- package/dist/esm/utils/own-deps.d.ts +16 -0
- package/dist/esm/utils/own-deps.js +107 -0
- package/dist/esm/utils/package-version.d.ts +4 -0
- package/dist/esm/utils/package-version.js +38 -0
- package/dist/esm/utils/pool.d.ts +49 -0
- package/dist/esm/utils/pool.js +113 -0
- package/dist/esm/utils/resolve-bin.d.ts +67 -0
- package/dist/esm/utils/resolve-bin.js +156 -0
- package/dist/esm/utils/result-collector.d.ts +33 -0
- package/dist/esm/utils/result-collector.js +44 -0
- package/dist/esm/utils/update-notifier.d.ts +19 -0
- package/dist/esm/utils/update-notifier.js +108 -0
- package/install-manifests/core/package-lock.json +4 -4
- package/install-manifests/core/package.json +1 -1
- package/package.json +15 -13
- package/dist/core/checks/languages/lint.d.ts +0 -2
- package/dist/core/index.d.ts +0 -4
- package/dist/core/registry.js +0 -112
- package/dist/index.d.ts +0 -12
- package/dist/utils/index.d.ts +0 -15
- /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
- /package/dist/{config → cjs/config}/constants.d.ts +0 -0
- /package/dist/{config → cjs/config}/constants.js +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow-docker.yml +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow.yml +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.d.ts +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.js +0 -0
- /package/dist/{core → cjs/core}/commands.d.ts +0 -0
- /package/dist/{core → cjs/core}/commands.js +0 -0
- /package/dist/{core → cjs/core}/install/cache.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/lock.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.js +0 -0
- /package/dist/{core → cjs/core}/install/profiles.js +0 -0
- /package/dist/{core → cjs/core}/types.js +0 -0
- /package/dist/{init.d.ts → cjs/init.d.ts} +0 -0
- /package/dist/{interfaces → cjs/interfaces}/index.js +0 -0
- /package/dist/{scripts → cjs/scripts}/copy-configs.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/generate-install-manifests.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/publish-github.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.js +0 -0
- /package/dist/{utils → cjs/utils}/detect-language.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.js +0 -0
- /package/dist/{utils → cjs/utils}/execa.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/git.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.js +0 -0
- /package/dist/{utils → cjs/utils}/http.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.js +0 -0
- /package/dist/{utils → cjs/utils}/package-version.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.js +0 -0
- /package/dist/{utils → cjs/utils}/resolve-bin.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.js +0 -0
- /package/dist/{utils → cjs/utils}/update-notifier.d.ts +0 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build output, dependency, tooling, and report directories that are never
|
|
3
|
+
* product code. Every check excludes them by directory-name segment match (see
|
|
4
|
+
* `targets.ts`): a match on any segment of a path drops the file. Untracked
|
|
5
|
+
* build dirs are already excluded because checks read git-tracked files only —
|
|
6
|
+
* this list additionally covers dirs that repos commonly *commit* (`.github`,
|
|
7
|
+
* `.vscode`, `.idea`, `.claude`) and any checked-in build artifacts.
|
|
8
|
+
*
|
|
9
|
+
* Covers the common ecosystems: Node/JS/web, Python, Java/Kotlin/Gradle/Android,
|
|
10
|
+
* Swift/iOS/Xcode, and C/C++/CMake. Add more here.
|
|
11
|
+
*/
|
|
12
|
+
export const IGNORED_DIRS = [
|
|
13
|
+
// VCS, editors, and CI/tooling config
|
|
14
|
+
'.git',
|
|
15
|
+
'.github',
|
|
16
|
+
'.gitlab',
|
|
17
|
+
'.vscode',
|
|
18
|
+
'.vs',
|
|
19
|
+
'.idea',
|
|
20
|
+
'.claude',
|
|
21
|
+
'.cursor',
|
|
22
|
+
'.husky',
|
|
23
|
+
'.circleci',
|
|
24
|
+
// Node / JS / web — build output & caches
|
|
25
|
+
'node_modules',
|
|
26
|
+
'dist',
|
|
27
|
+
'build',
|
|
28
|
+
'build-release',
|
|
29
|
+
'out',
|
|
30
|
+
'coverage',
|
|
31
|
+
'.next',
|
|
32
|
+
'.nuxt',
|
|
33
|
+
'.svelte-kit',
|
|
34
|
+
'.turbo',
|
|
35
|
+
'.cache',
|
|
36
|
+
'.parcel-cache',
|
|
37
|
+
'.vercel',
|
|
38
|
+
'.wrangler',
|
|
39
|
+
'.serverless',
|
|
40
|
+
'.terraform',
|
|
41
|
+
// Python
|
|
42
|
+
'__pycache__',
|
|
43
|
+
'.pytest_cache',
|
|
44
|
+
'.mypy_cache',
|
|
45
|
+
'.ruff_cache',
|
|
46
|
+
'.tox',
|
|
47
|
+
'.venv',
|
|
48
|
+
'venv',
|
|
49
|
+
'.eggs',
|
|
50
|
+
'htmlcov',
|
|
51
|
+
// Java / Kotlin / Gradle / Android
|
|
52
|
+
'.gradle',
|
|
53
|
+
'.kotlin',
|
|
54
|
+
'target',
|
|
55
|
+
'gen',
|
|
56
|
+
'captures',
|
|
57
|
+
// Swift / iOS / Xcode
|
|
58
|
+
'.build',
|
|
59
|
+
'.swiftpm',
|
|
60
|
+
'DerivedData',
|
|
61
|
+
'Pods',
|
|
62
|
+
'Carthage',
|
|
63
|
+
// C / C++ / CMake
|
|
64
|
+
'CMakeFiles',
|
|
65
|
+
'cmake-build-debug',
|
|
66
|
+
'cmake-build-release',
|
|
67
|
+
'_deps',
|
|
68
|
+
// Test reports / results / logs / release artifacts
|
|
69
|
+
'reports',
|
|
70
|
+
'report',
|
|
71
|
+
'test-reports',
|
|
72
|
+
'test-report',
|
|
73
|
+
'test-output',
|
|
74
|
+
'test-results',
|
|
75
|
+
'results',
|
|
76
|
+
'result',
|
|
77
|
+
'logs',
|
|
78
|
+
'allure-report',
|
|
79
|
+
'allure-results',
|
|
80
|
+
'playwright-report',
|
|
81
|
+
'.wdio',
|
|
82
|
+
// Generated knowledge-graph output. Committed by repos that keep the graph in
|
|
83
|
+
// version control, and machine-written from end to end: a multi-megabyte
|
|
84
|
+
// `graph.json` trips the large-file check, and `GRAPH_REPORT.md` carries every
|
|
85
|
+
// identifier in the codebase past the spellchecker. Neither is anyone's source.
|
|
86
|
+
'graphify-out',
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Glob form of the ignore list, for tools that take glob ignores directly
|
|
90
|
+
* (ESLint `--ignore-pattern`, cspell `--exclude`, the generated
|
|
91
|
+
* `.prettierignore`). Combines {@link IGNORED_DIRS} with a few tool-specific
|
|
92
|
+
* nested report globs that are not plain directory names.
|
|
93
|
+
*/
|
|
94
|
+
export const IGNORE_PATTERNS = [
|
|
95
|
+
...IGNORED_DIRS.map(dir => `**/${dir}/**`),
|
|
96
|
+
// Tool-specific nested report dirs / files (not bare directory names)
|
|
97
|
+
'**/jest-html-reporters-*/**',
|
|
98
|
+
'**/jest-stare/**',
|
|
99
|
+
'**/cypress/reports/**',
|
|
100
|
+
'**/cypress/videos/**',
|
|
101
|
+
'**/cypress/screenshots/**',
|
|
102
|
+
'**/mochawesome-report/**',
|
|
103
|
+
'**/mochawesome-reports/**',
|
|
104
|
+
'**/target/surefire-reports/**',
|
|
105
|
+
'**/target/failsafe-reports/**',
|
|
106
|
+
'**/wdio-logs/**',
|
|
107
|
+
'**/lint-report/**',
|
|
108
|
+
'**/audit-report/**',
|
|
109
|
+
];
|
|
110
|
+
/**
|
|
111
|
+
* Where test code lives, as globs.
|
|
112
|
+
*
|
|
113
|
+
* Deliberately NOT part of {@link IGNORED_DIRS}: that list hides a directory from
|
|
114
|
+
* every check, and test code still wants linting, type-checking and formatting.
|
|
115
|
+
* What test code does not want is the handful of checks whose findings are noise
|
|
116
|
+
* on it — duplication (setup boilerplate repeats by design), unused exports (the
|
|
117
|
+
* runner consumes them), spelling (fixture identifiers) and the diff security
|
|
118
|
+
* scan (a test's whole job may be to call the dangerous thing). Each of those
|
|
119
|
+
* defaults to this list, and each lets a client replace it.
|
|
120
|
+
*/
|
|
121
|
+
export const TEST_PATH_GLOBS = [
|
|
122
|
+
'**/__tests__/**',
|
|
123
|
+
'**/__mocks__/**',
|
|
124
|
+
'**/*.test.*',
|
|
125
|
+
'**/*.spec.*',
|
|
126
|
+
'**/test/**',
|
|
127
|
+
'**/tests/**',
|
|
128
|
+
];
|
|
129
|
+
/**
|
|
130
|
+
* Test files/folders excluded from duplicate-code detection by default.
|
|
131
|
+
* Test suites legitimately repeat setup/arrange/assert boilerplate, so counting
|
|
132
|
+
* them as clones is noise that drowns out real production duplication. Clients can
|
|
133
|
+
* override this list via `duplicate.ignore` in pr-checkmate.json.
|
|
134
|
+
*/
|
|
135
|
+
export const DUPLICATE_IGNORE_DEFAULTS = [...TEST_PATH_GLOBS];
|
|
136
|
+
/**
|
|
137
|
+
* Paths the diff security scan skips by default.
|
|
138
|
+
*
|
|
139
|
+
* A security test corpus is built out of the exact constructs the scan hunts for
|
|
140
|
+
* — `eval()`, `document.write()`, `__proto__` — so scanning it turns every added
|
|
141
|
+
* test case into a finding, and under `severity: error` into a blocked merge.
|
|
142
|
+
* Clients can override via `diffSecurity.ignorePaths` (which REPLACES this list).
|
|
143
|
+
*/
|
|
144
|
+
export const DIFF_SECURITY_IGNORE_DEFAULTS = [...TEST_PATH_GLOBS];
|
|
145
|
+
/**
|
|
146
|
+
* Files written by a release tool rather than by a person.
|
|
147
|
+
*
|
|
148
|
+
* `CHANGELOG.md` is assembled from commit subjects, so every typo anyone has ever
|
|
149
|
+
* committed reappears in it — 39 of 42 spellcheck findings in one real repository
|
|
150
|
+
* came from that one file, none of them actionable: the text cannot be corrected
|
|
151
|
+
* without rewriting git history, and the next release regenerates it anyway.
|
|
152
|
+
*
|
|
153
|
+
* Matched at ANY depth, not just at the repository root. The root-only form was
|
|
154
|
+
* the original, and it left every nested changelog unhandled: a component-config
|
|
155
|
+
* repository with one per component produced 157 of 157 spelling findings and 240
|
|
156
|
+
* of 246 markdown findings from files nobody writes by hand. A generated file is
|
|
157
|
+
* generated wherever it sits.
|
|
158
|
+
*/
|
|
159
|
+
export const GENERATED_DOC_FILES = ['**/CHANGELOG.md'];
|
|
160
|
+
/**
|
|
161
|
+
* Files excluded from the dead-code (unused-exports) report by default. These are
|
|
162
|
+
* REGEX sources (matched against each reported file path), not globs — dead-code's
|
|
163
|
+
* `ignoreFiles` is regex-based. Test and mock files legitimately export helpers and
|
|
164
|
+
* mocks consumed only by the test runner (jest.mock, dynamic imports), which
|
|
165
|
+
* ts-unused-exports cannot see as usage, so flagging them is noise. Clients can
|
|
166
|
+
* override via `deadCode.ignoreFiles` in pr-checkmate.json (setting it replaces
|
|
167
|
+
* this list).
|
|
168
|
+
*/
|
|
169
|
+
export const DEAD_CODE_IGNORE_DEFAULTS = [
|
|
170
|
+
'/__tests__/',
|
|
171
|
+
'/__mocks__/',
|
|
172
|
+
'/__mock__/',
|
|
173
|
+
'/tests?/',
|
|
174
|
+
'\\.test\\.',
|
|
175
|
+
'\\.spec\\.',
|
|
176
|
+
];
|
|
177
|
+
export const CONFIG_FILE_PATTERNS = [
|
|
178
|
+
'**/*.config.js',
|
|
179
|
+
'**/*.config.cjs',
|
|
180
|
+
'**/*.config.mjs',
|
|
181
|
+
'**/*.config.ts',
|
|
182
|
+
'**/.eslintrc.*',
|
|
183
|
+
'**/eslint.config.*',
|
|
184
|
+
'**/jest.config.*',
|
|
185
|
+
'**/wdio.config.*',
|
|
186
|
+
'**/playwright.config.*',
|
|
187
|
+
'**/cypress.config.*',
|
|
188
|
+
];
|
|
189
|
+
/**
|
|
190
|
+
* jscpd formats the duplicate-CODE check scans. Restricting to code formats keeps
|
|
191
|
+
* config/CI YAML and JSON out of the report — they are data, not code, and their
|
|
192
|
+
* repetition is not meaningful duplication. This mirrors the code-only file set the
|
|
193
|
+
* check already uses when scanning a git diff, so full-tree and diff scans agree.
|
|
194
|
+
*
|
|
195
|
+
* One entry per language pr-checkmate detects, all of them verified against the
|
|
196
|
+
* jscpd binary rather than assumed: the list used to stop at C++ while the check
|
|
197
|
+
* only ever handed jscpd `.ts`/`.js` files, so the Go, Rust, C#, Ruby and PHP
|
|
198
|
+
* halves were unreachable and the Python one was decoration. Copy-paste is a
|
|
199
|
+
* language-independent smell, and the tokenizer behind this check has always been
|
|
200
|
+
* able to see it — the file list was the only thing in the way.
|
|
201
|
+
*/
|
|
202
|
+
export const DUPLICATE_CODE_FORMATS = [
|
|
203
|
+
'javascript',
|
|
204
|
+
'typescript',
|
|
205
|
+
'jsx',
|
|
206
|
+
'tsx',
|
|
207
|
+
'python',
|
|
208
|
+
'kotlin',
|
|
209
|
+
'swift',
|
|
210
|
+
'c',
|
|
211
|
+
'cpp',
|
|
212
|
+
'csharp',
|
|
213
|
+
'go',
|
|
214
|
+
'php',
|
|
215
|
+
'ruby',
|
|
216
|
+
'rust',
|
|
217
|
+
];
|
|
218
|
+
/**
|
|
219
|
+
* File extensions to check
|
|
220
|
+
*/
|
|
221
|
+
export const SOURCE_EXTENSIONS = {
|
|
222
|
+
typescript: ['.ts', '.tsx'],
|
|
223
|
+
javascript: ['.js', '.jsx'],
|
|
224
|
+
markdown: ['.md', '.mdx'],
|
|
225
|
+
json: ['.json'],
|
|
226
|
+
all: ['.ts', '.tsx', '.js', '.jsx', '.json', '.md', '.mdx'],
|
|
227
|
+
};
|
|
228
|
+
export const DEFAULT_COMMANDS = {
|
|
229
|
+
'npx pr-checkmate init': 'Create pr-checkmate.json and the CI workflow (first-run setup)',
|
|
230
|
+
'npx pr-checkmate all': 'Run all checks over the changes — the PR diff in CI, your branch changes locally',
|
|
231
|
+
'npx pr-checkmate all --full': 'Run all checks over every tracked file, CI included',
|
|
232
|
+
'npx pr-checkmate lint': 'Lint code using ESLint',
|
|
233
|
+
'npx pr-checkmate prettier': 'Format code using Prettier',
|
|
234
|
+
'npx pr-checkmate deps': 'Check project dependencies',
|
|
235
|
+
'npx pr-checkmate npm-audit': 'Run package vulnerabilities check',
|
|
236
|
+
'npx pr-checkmate security': 'Security scan',
|
|
237
|
+
'npx pr-checkmate spellcheck': 'Run spellcheck via cspell',
|
|
238
|
+
'npx pr-checkmate typecheck': 'TypeScript type check (tsc --noEmit)',
|
|
239
|
+
'npx pr-checkmate diff-smell': 'Scan git diff for code smells',
|
|
240
|
+
'npx pr-checkmate pr-body': 'Validate PR description',
|
|
241
|
+
'npx pr-checkmate duplicate': 'Detect duplicate code blocks (jscpd)',
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Packages allow-listed for the license check by default.
|
|
245
|
+
*
|
|
246
|
+
* These are the optional cspell language dictionaries. Some ship under copyleft
|
|
247
|
+
* licenses (GPL/LGPL), and a client who installs one to spellcheck their own
|
|
248
|
+
* language should not have that turn into a licence finding: the dictionary is
|
|
249
|
+
* data for our check, not code they ship.
|
|
250
|
+
*/
|
|
251
|
+
export const DEFAULT_ALLOW_PACKAGES = [
|
|
252
|
+
'@cspell/dict-es-es',
|
|
253
|
+
'@cspell/dict-fr-fr',
|
|
254
|
+
'@cspell/dict-he',
|
|
255
|
+
'@cspell/dict-ru_ru',
|
|
256
|
+
'@cspell/dict-uk-ua',
|
|
257
|
+
];
|
|
258
|
+
/**
|
|
259
|
+
* Canonical entry point to the PR CheckMate docs. Single source of truth: it is
|
|
260
|
+
* written into every generated `pr-checkmate.json` (via {@link documentation})
|
|
261
|
+
* and printed in the "new version available" notice, so the two can never drift.
|
|
262
|
+
*/
|
|
263
|
+
export const DOCS_URL = 'https://github.com/Mybono/pr_checkmate_public/tree/main/documentation';
|
|
264
|
+
/**
|
|
265
|
+
* The fully annotated configuration, with every option at its default value.
|
|
266
|
+
*
|
|
267
|
+
* A URL rather than a file inside the package on purpose: half the audience runs
|
|
268
|
+
* pr-checkmate through `npx` on a pipeline and has no `node_modules` at all, so
|
|
269
|
+
* a path into the installed package is a dead end for them. The release workflow
|
|
270
|
+
* publishes `src/config/pr-checkmate.template.json` to the public mirror under
|
|
271
|
+
* this name, which keeps one copy for everyone.
|
|
272
|
+
*/
|
|
273
|
+
export const FULL_CONFIG_URL = 'https://github.com/Mybono/pr_checkmate_public/blob/main/pr-checkmate.json';
|
|
274
|
+
export const documentation = {
|
|
275
|
+
pr_checkmate: DOCS_URL,
|
|
276
|
+
eslint: 'https://eslint.org/docs/latest/rules/',
|
|
277
|
+
typescriptEslint: 'https://typescript-eslint.io/rules/',
|
|
278
|
+
prettier: 'https://prettier.io/docs/en/options.html',
|
|
279
|
+
cspell: 'https://cspell.org/configuration/',
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Every top-level key PR CheckMate recognises in pr-checkmate.json — the union
|
|
283
|
+
* of the `PRCheckMateConfig` interface fields and the keys the `init` generator
|
|
284
|
+
* writes (which use `eslint`/`cspell`/`markdownlint` rather than the interface's
|
|
285
|
+
* `lint`/`spellcheck`). The Config Validation check warns on any key not in this
|
|
286
|
+
* set (typos), ignoring `//`-prefixed comment keys and `$schema`. Keep in sync
|
|
287
|
+
* when adding a new configurable check.
|
|
288
|
+
*/
|
|
289
|
+
export const KNOWN_CONFIG_KEYS = new Set([
|
|
290
|
+
// core
|
|
291
|
+
'sourcePath',
|
|
292
|
+
'ignoreDirs',
|
|
293
|
+
'excludePaths',
|
|
294
|
+
'languages',
|
|
295
|
+
'detect',
|
|
296
|
+
'install',
|
|
297
|
+
'severity',
|
|
298
|
+
'severityDefaults',
|
|
299
|
+
'run',
|
|
300
|
+
'reporter',
|
|
301
|
+
'log',
|
|
302
|
+
'customRules',
|
|
303
|
+
'$schema',
|
|
304
|
+
'commands',
|
|
305
|
+
'documentation',
|
|
306
|
+
'configValidation',
|
|
307
|
+
// linters/formatters (interface + init aliases)
|
|
308
|
+
'lint',
|
|
309
|
+
'eslint',
|
|
310
|
+
'prettier',
|
|
311
|
+
'spellcheck',
|
|
312
|
+
'cspell',
|
|
313
|
+
'markdownlint',
|
|
314
|
+
'yamlLint',
|
|
315
|
+
'shellcheck',
|
|
316
|
+
'symlinks',
|
|
317
|
+
'typecheck',
|
|
318
|
+
// security
|
|
319
|
+
'security',
|
|
320
|
+
'diffSecurity',
|
|
321
|
+
'workflowSecurity',
|
|
322
|
+
'dockerfileSecurity',
|
|
323
|
+
'sensitiveFileGuard',
|
|
324
|
+
'migrationSafety',
|
|
325
|
+
// dependencies
|
|
326
|
+
'dependency',
|
|
327
|
+
'circularDeps',
|
|
328
|
+
'outdatedDeps',
|
|
329
|
+
'licenseCheck',
|
|
330
|
+
'vulnScan',
|
|
331
|
+
'grypeScan',
|
|
332
|
+
'bannedImports',
|
|
333
|
+
// git-diff / PR
|
|
334
|
+
'mergeConflict',
|
|
335
|
+
'diffSmell',
|
|
336
|
+
'leftoverDebug',
|
|
337
|
+
'todoFixme',
|
|
338
|
+
'lockfileDrift',
|
|
339
|
+
'largeFiles',
|
|
340
|
+
'missingTests',
|
|
341
|
+
'coverage',
|
|
342
|
+
'caseCollision',
|
|
343
|
+
'licenseHeader',
|
|
344
|
+
'duplicate',
|
|
345
|
+
'deadCode',
|
|
346
|
+
'packageSize',
|
|
347
|
+
'prBody',
|
|
348
|
+
'prSize',
|
|
349
|
+
'commitlint',
|
|
350
|
+
// languages
|
|
351
|
+
'cpp',
|
|
352
|
+
'python',
|
|
353
|
+
'swift',
|
|
354
|
+
'kotlin',
|
|
355
|
+
'go',
|
|
356
|
+
'rust',
|
|
357
|
+
'csharp',
|
|
358
|
+
'ruby',
|
|
359
|
+
'php',
|
|
360
|
+
]);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export * from './constants.js';
|
|
2
|
+
export { loadProjectConfig } from '../config/loader.js';
|
|
3
|
+
/**
|
|
4
|
+
* The configured source path(s), normalised to a list.
|
|
5
|
+
*
|
|
6
|
+
* Accepts a string or an array; empty and invalid values fall back to `['.']`,
|
|
7
|
+
* the whole repository. Clients narrow scanning to a subdirectory by setting
|
|
8
|
+
* `sourcePath`.
|
|
9
|
+
*
|
|
10
|
+
* `cwd` is a parameter rather than `process.cwd()` baked in, and that is the
|
|
11
|
+
* whole of ticket 074. This used to read a `CONFIG_FILE` constant resolved at
|
|
12
|
+
* *module load*, so the answer was fixed to whatever directory the process
|
|
13
|
+
* started in — `chdir` could not change it and neither could a caller. For the
|
|
14
|
+
* CLI that is harmless, since its working directory never moves; for
|
|
15
|
+
* `runChecks({ cwd })` it meant the SDK consumer's own `sourcePath` was applied
|
|
16
|
+
* to somebody else's repository, silently scoping every scoped check to a
|
|
17
|
+
* directory that may not exist there.
|
|
18
|
+
*
|
|
19
|
+
* It also read the file itself, duplicating `loadProjectConfig` with its own
|
|
20
|
+
* defaults. One reader is now the only reader.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSourcePaths(cwd?: string): string[];
|
|
23
|
+
/**
|
|
24
|
+
* The first configured source path, for callers that only support one directory.
|
|
25
|
+
* Prefer {@link getSourcePaths} for scan targets.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getSourcePath(cwd?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get the effective list of directory names excluded from every check
|
|
30
|
+
* (client `ignoreDirs` in pr-checkmate.json, or the curated default).
|
|
31
|
+
*/
|
|
32
|
+
export declare function getIgnoredDirs(cwd?: string): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Get path to package config files
|
|
35
|
+
*/
|
|
36
|
+
export declare function getPackageConfigPath(fileName: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Check if project has local config
|
|
39
|
+
*/
|
|
40
|
+
export declare function hasLocalConfig(configNames: string[], cwd?: string): boolean;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
2
|
+
import { dirname as __dirnameFn } from 'node:path';
|
|
3
|
+
const __dirname = __dirnameFn(__fileURLToPath(import.meta.url));
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { loadProjectConfig } from '../config/loader.js';
|
|
7
|
+
import { findOwnPackageRoot } from '../utils/own-deps.js';
|
|
8
|
+
export * from './constants.js';
|
|
9
|
+
export { loadProjectConfig } from '../config/loader.js';
|
|
10
|
+
/**
|
|
11
|
+
* The configured source path(s), normalised to a list.
|
|
12
|
+
*
|
|
13
|
+
* Accepts a string or an array; empty and invalid values fall back to `['.']`,
|
|
14
|
+
* the whole repository. Clients narrow scanning to a subdirectory by setting
|
|
15
|
+
* `sourcePath`.
|
|
16
|
+
*
|
|
17
|
+
* `cwd` is a parameter rather than `process.cwd()` baked in, and that is the
|
|
18
|
+
* whole of ticket 074. This used to read a `CONFIG_FILE` constant resolved at
|
|
19
|
+
* *module load*, so the answer was fixed to whatever directory the process
|
|
20
|
+
* started in — `chdir` could not change it and neither could a caller. For the
|
|
21
|
+
* CLI that is harmless, since its working directory never moves; for
|
|
22
|
+
* `runChecks({ cwd })` it meant the SDK consumer's own `sourcePath` was applied
|
|
23
|
+
* to somebody else's repository, silently scoping every scoped check to a
|
|
24
|
+
* directory that may not exist there.
|
|
25
|
+
*
|
|
26
|
+
* It also read the file itself, duplicating `loadProjectConfig` with its own
|
|
27
|
+
* defaults. One reader is now the only reader.
|
|
28
|
+
*/
|
|
29
|
+
export function getSourcePaths(cwd = process.cwd()) {
|
|
30
|
+
const { sourcePath } = loadProjectConfig(cwd);
|
|
31
|
+
const paths = (Array.isArray(sourcePath) ? sourcePath : [sourcePath]).filter((p) => typeof p === 'string' && p.trim().length > 0);
|
|
32
|
+
return paths.length > 0 ? paths : ['.'];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The first configured source path, for callers that only support one directory.
|
|
36
|
+
* Prefer {@link getSourcePaths} for scan targets.
|
|
37
|
+
*/
|
|
38
|
+
export function getSourcePath(cwd) {
|
|
39
|
+
return getSourcePaths(cwd)[0];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the effective list of directory names excluded from every check
|
|
43
|
+
* (client `ignoreDirs` in pr-checkmate.json, or the curated default).
|
|
44
|
+
*/
|
|
45
|
+
export function getIgnoredDirs(cwd) {
|
|
46
|
+
return loadProjectConfig(cwd).ignoreDirs ?? [];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get path to package config files
|
|
50
|
+
*/
|
|
51
|
+
export function getPackageConfigPath(fileName) {
|
|
52
|
+
const packageRoot = findOwnPackageRoot() ?? path.resolve(__dirname, '../../..');
|
|
53
|
+
return path.join(packageRoot, fileName);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check if project has local config
|
|
57
|
+
*/
|
|
58
|
+
export function hasLocalConfig(configNames, cwd = process.cwd()) {
|
|
59
|
+
return configNames.some(name => fs.existsSync(path.join(cwd, name)));
|
|
60
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { logger } from '../utils/index.js';
|
|
4
|
+
import { DEAD_CODE_IGNORE_DEFAULTS, DEFAULT_ALLOW_PACKAGES, DUPLICATE_CODE_FORMATS, DUPLICATE_IGNORE_DEFAULTS, IGNORED_DIRS, } from './constants.js';
|
|
5
|
+
/**
|
|
6
|
+
* Load project configuration from pr-checkmate.json
|
|
7
|
+
* Falls back to defaults if not found
|
|
8
|
+
*/
|
|
9
|
+
export function loadProjectConfig(cwd = process.cwd()) {
|
|
10
|
+
const configPath = path.join(cwd, 'pr-checkmate.json');
|
|
11
|
+
if (fs.existsSync(configPath)) {
|
|
12
|
+
try {
|
|
13
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
14
|
+
const config = JSON.parse(content);
|
|
15
|
+
return mergeWithDefaults(config);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
logger.warn(`[loadProjectConfig]: ⚠️ Failed to parse pr-checkmate.json: ${err}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return getDefaultConfig();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deep merge user config with defaults
|
|
25
|
+
*/
|
|
26
|
+
function mergeWithDefaults(userConfig) {
|
|
27
|
+
const defaults = getDefaultConfig();
|
|
28
|
+
return {
|
|
29
|
+
// Preserve every key the user set — including opt-in checks (vulnScan,
|
|
30
|
+
// grypeScan) and controls with no default entry below (severity, customRules,
|
|
31
|
+
// prSize, caseCollision, go/rust/ruby/php, …). The explicitly-merged keys
|
|
32
|
+
// that follow override this spread with their default-merged values.
|
|
33
|
+
...userConfig,
|
|
34
|
+
sourcePath: userConfig.sourcePath || defaults.sourcePath,
|
|
35
|
+
// Replace (not merge): the client sees the full default list in their
|
|
36
|
+
// generated config and edits it directly, so their list is authoritative.
|
|
37
|
+
ignoreDirs: userConfig.ignoreDirs ?? defaults.ignoreDirs,
|
|
38
|
+
lint: {
|
|
39
|
+
rules: { ...defaults.lint?.rules, ...userConfig.lint?.rules },
|
|
40
|
+
ignorePatterns: [
|
|
41
|
+
...(defaults.lint?.ignorePatterns || []),
|
|
42
|
+
...(userConfig.lint?.ignorePatterns || []),
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
prettier: {
|
|
46
|
+
config: { ...defaults.prettier?.config, ...userConfig.prettier?.config },
|
|
47
|
+
},
|
|
48
|
+
spellcheck: {
|
|
49
|
+
words: [...(userConfig.spellcheck?.words || [])],
|
|
50
|
+
ignoreWords: [...(userConfig.spellcheck?.ignoreWords || [])],
|
|
51
|
+
ignorePaths: [
|
|
52
|
+
...(defaults.spellcheck?.ignorePaths || []),
|
|
53
|
+
...(userConfig.spellcheck?.ignorePaths || []),
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
security: {
|
|
57
|
+
...defaults.security,
|
|
58
|
+
...userConfig.security,
|
|
59
|
+
gitleaks: { ...defaults.security?.gitleaks, ...userConfig.security?.gitleaks },
|
|
60
|
+
'npm-audit': { ...defaults.security?.['npm-audit'], ...userConfig.security?.['npm-audit'] },
|
|
61
|
+
},
|
|
62
|
+
typecheck: { ...defaults.typecheck, ...userConfig.typecheck },
|
|
63
|
+
cpp: {
|
|
64
|
+
...defaults.cpp,
|
|
65
|
+
...userConfig.cpp,
|
|
66
|
+
clangFormat: { ...defaults.cpp?.clangFormat, ...userConfig.cpp?.clangFormat },
|
|
67
|
+
},
|
|
68
|
+
python: {
|
|
69
|
+
...defaults.python,
|
|
70
|
+
...userConfig.python,
|
|
71
|
+
ruff: { ...defaults.python?.ruff, ...userConfig.python?.ruff },
|
|
72
|
+
},
|
|
73
|
+
swift: { ...defaults.swift, ...userConfig.swift },
|
|
74
|
+
kotlin: { ...defaults.kotlin, ...userConfig.kotlin },
|
|
75
|
+
diffSmell: { ...defaults.diffSmell, ...userConfig.diffSmell },
|
|
76
|
+
prBody: { ...defaults.prBody, ...userConfig.prBody },
|
|
77
|
+
duplicate: { ...defaults.duplicate, ...userConfig.duplicate },
|
|
78
|
+
dependency: { ...defaults.dependency, ...userConfig.dependency },
|
|
79
|
+
outdatedDeps: { ...defaults.outdatedDeps, ...userConfig.outdatedDeps },
|
|
80
|
+
commitlint: { ...defaults.commitlint, ...userConfig.commitlint },
|
|
81
|
+
deadCode: { ...defaults.deadCode, ...userConfig.deadCode },
|
|
82
|
+
licenseCheck: {
|
|
83
|
+
allowPackages: [
|
|
84
|
+
...(defaults.licenseCheck?.allowPackages || []),
|
|
85
|
+
...(userConfig.licenseCheck?.allowPackages || []),
|
|
86
|
+
],
|
|
87
|
+
allowLicenses: [
|
|
88
|
+
...(defaults.licenseCheck?.allowLicenses || []),
|
|
89
|
+
...(userConfig.licenseCheck?.allowLicenses || []),
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get default configuration
|
|
96
|
+
*/
|
|
97
|
+
function getDefaultConfig() {
|
|
98
|
+
return {
|
|
99
|
+
sourcePath: '.',
|
|
100
|
+
ignoreDirs: [...IGNORED_DIRS],
|
|
101
|
+
lint: {
|
|
102
|
+
rules: {
|
|
103
|
+
'no-console': 'warn',
|
|
104
|
+
'no-debugger': 'error',
|
|
105
|
+
'prefer-const': 'error',
|
|
106
|
+
eqeqeq: ['error', 'always'],
|
|
107
|
+
'@typescript-eslint/no-unused-vars': [
|
|
108
|
+
'error',
|
|
109
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
110
|
+
],
|
|
111
|
+
'@typescript-eslint/explicit-function-return-type': ['warn'],
|
|
112
|
+
'@typescript-eslint/no-explicit-any': ['warn'],
|
|
113
|
+
'@typescript-eslint/no-floating-promises': ['error'],
|
|
114
|
+
'max-len': ['warn', { code: 100 }],
|
|
115
|
+
semi: ['error', 'always'],
|
|
116
|
+
quotes: ['error', 'single', { avoidEscape: true }],
|
|
117
|
+
'object-curly-spacing': ['error', 'always'],
|
|
118
|
+
'keyword-spacing': ['error', { before: true, after: true }],
|
|
119
|
+
},
|
|
120
|
+
ignorePatterns: [
|
|
121
|
+
'**/node_modules/**',
|
|
122
|
+
'**/dist/**',
|
|
123
|
+
'**/.git/**',
|
|
124
|
+
'**/build/**',
|
|
125
|
+
'**/coverage/**',
|
|
126
|
+
'**/.next/**',
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
prettier: {
|
|
130
|
+
config: {
|
|
131
|
+
semi: true,
|
|
132
|
+
singleQuote: true,
|
|
133
|
+
trailingComma: 'all',
|
|
134
|
+
bracketSpacing: true,
|
|
135
|
+
arrowParens: 'avoid',
|
|
136
|
+
printWidth: 100,
|
|
137
|
+
tabWidth: 2,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
spellcheck: {
|
|
141
|
+
words: [],
|
|
142
|
+
ignoreWords: [],
|
|
143
|
+
ignorePaths: ['**/node_modules/**', '**/dist/**', '**/.git/**', '**/build/**'],
|
|
144
|
+
},
|
|
145
|
+
security: {
|
|
146
|
+
gitleaks: { enabled: true },
|
|
147
|
+
'npm-audit': { enabled: true, auditLevel: 'moderate' },
|
|
148
|
+
},
|
|
149
|
+
typecheck: { enabled: true },
|
|
150
|
+
cpp: { enabled: true, clangFormat: { style: 'LLVM' } },
|
|
151
|
+
python: { enabled: true, ruff: { lint: true, format: true } },
|
|
152
|
+
swift: { enabled: true },
|
|
153
|
+
kotlin: { enabled: true },
|
|
154
|
+
diffSmell: { enabled: true },
|
|
155
|
+
prBody: { enabled: true, minLength: 20, requireTicket: true },
|
|
156
|
+
duplicate: {
|
|
157
|
+
enabled: true,
|
|
158
|
+
minLines: 5,
|
|
159
|
+
minTokens: 50,
|
|
160
|
+
ignore: DUPLICATE_IGNORE_DEFAULTS,
|
|
161
|
+
formats: DUPLICATE_CODE_FORMATS,
|
|
162
|
+
},
|
|
163
|
+
dependency: { enabled: true, ignore: [] },
|
|
164
|
+
outdatedDeps: { enabled: true, ignore: [] },
|
|
165
|
+
deadCode: { enabled: true, ignoreFiles: DEAD_CODE_IGNORE_DEFAULTS },
|
|
166
|
+
commitlint: {
|
|
167
|
+
enabled: true,
|
|
168
|
+
types: [
|
|
169
|
+
'feat',
|
|
170
|
+
'fix',
|
|
171
|
+
'docs',
|
|
172
|
+
'chore',
|
|
173
|
+
'ci',
|
|
174
|
+
'refactor',
|
|
175
|
+
'perf',
|
|
176
|
+
'style',
|
|
177
|
+
'revert',
|
|
178
|
+
'test',
|
|
179
|
+
'build',
|
|
180
|
+
],
|
|
181
|
+
// Skip release PRs and squash-merge titles that don't follow conventional
|
|
182
|
+
// commits (e.g. "Release 15 (#114)"). commitlint already ignores literal
|
|
183
|
+
// "Merge"/"Revert" messages, but not GitHub squash-merge PR titles.
|
|
184
|
+
ignores: ['^Release\\b', '^chore\\(release\\):'],
|
|
185
|
+
},
|
|
186
|
+
licenseCheck: {
|
|
187
|
+
allowPackages: [...DEFAULT_ALLOW_PACKAGES],
|
|
188
|
+
allowLicenses: [],
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|