pr-checkmate 3.0.4 → 3.2.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/{core → cjs/core}/checks/languages/go-format.js +21 -21
- 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/cjs/core/checks/quality/markdown-lint.js +147 -0
- 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/profiles.js +1 -1
- 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/{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/esm/core/checks/languages/go-format.js +163 -0
- 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 +141 -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/esm/utils/execa.js +10 -0
- 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/install-manifests/duplicate/package-lock.json +0 -12
- package/install-manifests/js/package-lock.json +17 -41
- package/install-manifests/js/package.json +1 -1
- package/install-manifests/markdown/package-lock.json +1 -492
- package/install-manifests/markdown/package.json +1 -1
- package/package.json +17 -15
- package/dist/core/checks/languages/lint.d.ts +0 -2
- package/dist/core/checks/quality/markdown-lint.js +0 -110
- 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}/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}/execa.js +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,66 @@
|
|
|
1
|
+
import { execa } from '../../../utils/execa.js';
|
|
2
|
+
import { logger } from '../../../utils/index.js';
|
|
3
|
+
import { isNpmProject, pass, skip, warn } from '../../types.js';
|
|
4
|
+
const DEFAULT_TIMEOUT_MS = 30000;
|
|
5
|
+
export const outdatedDepsCheck = {
|
|
6
|
+
name: 'Outdated Deps',
|
|
7
|
+
phase: 'informational',
|
|
8
|
+
applies(ctx) {
|
|
9
|
+
if (ctx.config.outdatedDeps?.enabled === false)
|
|
10
|
+
return false;
|
|
11
|
+
return isNpmProject(ctx);
|
|
12
|
+
},
|
|
13
|
+
async run(ctx) {
|
|
14
|
+
// `npm outdated` queries the registry for every dependency and can take a
|
|
15
|
+
// long time on big dependency trees — cap it so an advisory check never
|
|
16
|
+
// holds up CI. On timeout, skip rather than fail.
|
|
17
|
+
const timeout = ctx.config.outdatedDeps?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
18
|
+
// npm outdated exits 1 when outdated packages exist — use reject:false.
|
|
19
|
+
const result = await execa('npm', ['outdated', '--json'], {
|
|
20
|
+
cwd: ctx.cwd,
|
|
21
|
+
reject: false,
|
|
22
|
+
timeout,
|
|
23
|
+
});
|
|
24
|
+
if (result.timedOut) {
|
|
25
|
+
logger.warn(`[Outdated Deps]: ⚠️ npm outdated timed out after ${timeout}ms — skipping`);
|
|
26
|
+
return skip('npm outdated timed out');
|
|
27
|
+
}
|
|
28
|
+
if (!result.stdout?.trim())
|
|
29
|
+
return pass();
|
|
30
|
+
let outdated;
|
|
31
|
+
try {
|
|
32
|
+
outdated = JSON.parse(result.stdout);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return pass();
|
|
36
|
+
}
|
|
37
|
+
// Packages deliberately pinned behind their latest major (see outdatedDeps.ignore
|
|
38
|
+
// in pr-checkmate.json) are dropped before counting, so they never warn.
|
|
39
|
+
const ignore = new Set(ctx.config.outdatedDeps?.ignore ?? []);
|
|
40
|
+
const entries = Object.entries(outdated).filter(([pkg]) => !ignore.has(pkg));
|
|
41
|
+
if (entries.length === 0)
|
|
42
|
+
return pass();
|
|
43
|
+
// `current` is only populated when the package is installed in node_modules.
|
|
44
|
+
// In CI (npx-invoked validator, no `npm ci` for the target repo) it's absent,
|
|
45
|
+
// so fall back to `wanted` — the version the package.json range resolves to,
|
|
46
|
+
// which npm computes from the registry even without node_modules. Comparing
|
|
47
|
+
// that baseline to `latest` keeps the check meaningful in CI. Skip entries
|
|
48
|
+
// with neither, rather than treating a missing baseline as major 0.
|
|
49
|
+
const majorBehind = entries
|
|
50
|
+
.map(([pkg, info]) => ({ pkg, baseline: info.current ?? info.wanted, latest: info.latest }))
|
|
51
|
+
.filter(({ baseline, latest }) => {
|
|
52
|
+
if (!baseline)
|
|
53
|
+
return false;
|
|
54
|
+
return parseInt(latest?.split('.')[0] ?? '0', 10) > parseInt(baseline.split('.')[0], 10);
|
|
55
|
+
});
|
|
56
|
+
if (majorBehind.length > 0) {
|
|
57
|
+
majorBehind.forEach(({ pkg, baseline, latest }) => logger.warn(`[Outdated Deps]: ⚠️ ${pkg}: ${baseline} → ${latest}`));
|
|
58
|
+
return warn(`${majorBehind.length} package(s) major versions behind`);
|
|
59
|
+
}
|
|
60
|
+
const minorBehind = entries.length - majorBehind.length;
|
|
61
|
+
if (minorBehind > 0) {
|
|
62
|
+
logger.info(`[Outdated Deps]: ${minorBehind} package(s) have minor/patch updates`);
|
|
63
|
+
}
|
|
64
|
+
return pass();
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { execa } from '../../../utils/execa.js';
|
|
2
|
+
import { logger } from '../../../utils/index.js';
|
|
3
|
+
import { pass, skip, warn } from '../../types.js';
|
|
4
|
+
import { notInstalled } from '../tool-install.js';
|
|
5
|
+
/**
|
|
6
|
+
* Cross-language dependency vulnerability scan via osv-scanner, which reads
|
|
7
|
+
* lockfiles across ecosystems (npm, PyPI, Go, crates, Maven, …) against the OSV
|
|
8
|
+
* database. Runner-dependency and opt-in (`vulnScan.enabled: true`): osv-scanner
|
|
9
|
+
* must be on the runner, and the check skips gracefully when it is absent.
|
|
10
|
+
* Complements the JS-only `npm-audit` with coverage for every other ecosystem.
|
|
11
|
+
*
|
|
12
|
+
* `-r .` walks the tree, so the run is capped: an advisory check must never be able
|
|
13
|
+
* to look like a hung commit, which is exactly what an uncapped directory scan does
|
|
14
|
+
* on a repo with dependencies installed.
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_TIMEOUT_MS = 120000;
|
|
17
|
+
export const vulnScanCheck = {
|
|
18
|
+
name: 'Vuln Scan',
|
|
19
|
+
phase: 'informational',
|
|
20
|
+
weight: 'heavy',
|
|
21
|
+
applies(ctx) {
|
|
22
|
+
return ctx.config.vulnScan?.enabled === true;
|
|
23
|
+
},
|
|
24
|
+
async run(ctx) {
|
|
25
|
+
const timeout = ctx.config.vulnScan?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
26
|
+
const result = await execa('osv-scanner', ['-r', '.'], {
|
|
27
|
+
cwd: ctx.cwd,
|
|
28
|
+
reject: false,
|
|
29
|
+
timeout,
|
|
30
|
+
});
|
|
31
|
+
// execa v9 with reject:false resolves (not throws) with `code: 'ENOENT'`
|
|
32
|
+
// when the binary is absent — detect the missing scanner on the result.
|
|
33
|
+
if (result.code === 'ENOENT')
|
|
34
|
+
return notInstalled('osv-scanner');
|
|
35
|
+
if (result.timedOut) {
|
|
36
|
+
logger.warn(`[Vuln Scan]: ⚠️ osv-scanner timed out after ${timeout}ms — skipping`);
|
|
37
|
+
return skip('osv-scanner timed out');
|
|
38
|
+
}
|
|
39
|
+
if (result.exitCode === 0) {
|
|
40
|
+
logger.info('[Vuln Scan]: ✅ No known vulnerabilities');
|
|
41
|
+
return pass();
|
|
42
|
+
}
|
|
43
|
+
const lines = [result.stdout, result.stderr]
|
|
44
|
+
.filter(Boolean)
|
|
45
|
+
.join('\n')
|
|
46
|
+
.split('\n')
|
|
47
|
+
.filter(l => /\b(CVE-|GHSA-|vulnerab|advisor)/i.test(l));
|
|
48
|
+
logger.warn('[Vuln Scan]: ⚠️ known vulnerabilities found:');
|
|
49
|
+
lines.slice(0, 10).forEach(l => logger.warn(` ${l.trim()}`));
|
|
50
|
+
if (lines.length > 10)
|
|
51
|
+
logger.warn(` ... and ${lines.length - 10} more`);
|
|
52
|
+
return warn(`${lines.length || 'unknown'} vulnerability finding(s) (osv-scanner)`);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { CheckContext, CheckOutcome } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Client-configurable severity for a check's findings, read from that check's
|
|
4
|
+
* config block (e.g. `mergeConflict.severity`). `error` fails the run, `warn`
|
|
5
|
+
* only advises. Every check declares a natural default; the client overrides it
|
|
6
|
+
* per repo in pr-checkmate.json — promoting an advisory check to a gate, or
|
|
7
|
+
* downgrading a blocking one, with no code change.
|
|
8
|
+
*
|
|
9
|
+
* Deliberately not exported, here and for {@link SeverityEmitter}: no module
|
|
10
|
+
* names either type, and `tsc` inlines both into `findings.d.ts` anyway, so an
|
|
11
|
+
* `export` would only be API surface the Dead Code check then reports as unused.
|
|
12
|
+
*/
|
|
13
|
+
type Severity = 'error' | 'warn';
|
|
14
|
+
interface SeverityEmitter {
|
|
15
|
+
/** Log at the resolved level (`logger.error` for error, `logger.warn` for warn). */
|
|
16
|
+
log: (msg: string) => void;
|
|
17
|
+
/** Prefix icon matching the level. */
|
|
18
|
+
icon: string;
|
|
19
|
+
/** Build the outcome at the resolved level (`fail` for error, `warn` for warn). */
|
|
20
|
+
emit: (details: string) => CheckOutcome;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolve a check's effective severity (`configured` from config, else its
|
|
24
|
+
* `fallback`) into a matched logger, icon, and outcome constructor — so a check
|
|
25
|
+
* logs and returns consistently at whatever level the client chose.
|
|
26
|
+
*/
|
|
27
|
+
export declare function severityEmitter(configured: Severity | undefined, fallback: Severity): SeverityEmitter;
|
|
28
|
+
/** Findings grouped by label → matching sample strings. */
|
|
29
|
+
export type FindingBucket = Record<string, string[]>;
|
|
30
|
+
/** One scan's findings, split by the level each pattern assigned them. */
|
|
31
|
+
export interface SeverityBuckets {
|
|
32
|
+
errors: FindingBucket;
|
|
33
|
+
warnings: FindingBucket;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fold one scan's findings into a check's running totals.
|
|
37
|
+
*
|
|
38
|
+
* Checks accumulate across several scans — one per language, or one per file on
|
|
39
|
+
* the full-scan path — so every accumulating check needs this, and each had the
|
|
40
|
+
* same pair of nested loops written out inline.
|
|
41
|
+
*/
|
|
42
|
+
export declare function mergeSeverityBuckets(into: SeverityBuckets, from: SeverityBuckets): void;
|
|
43
|
+
/** A fresh pair of empty buckets for a check to accumulate into. */
|
|
44
|
+
export declare function emptyBuckets(): SeverityBuckets;
|
|
45
|
+
/**
|
|
46
|
+
* Run `git diff` over the given file globs, returning the raw unified diff
|
|
47
|
+
* (zero context, added/copied/modified/renamed files) for added-line scanning.
|
|
48
|
+
*/
|
|
49
|
+
export declare function diffAddedLines(ctx: CheckContext, globs: string[]): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Present tracked files as if every line had just been added, so a check written
|
|
52
|
+
* for a diff can review the whole repository unchanged.
|
|
53
|
+
*
|
|
54
|
+
* The patterns are anchored on the diff's `+` marker (`/^\+(?!\+)…/`), which is
|
|
55
|
+
* why `--full` used to skip most of the security surface: no diff, no lines
|
|
56
|
+
* starting with `+`, no findings. Rather than rewrite forty patterns — and lose
|
|
57
|
+
* the guarantee that both modes agree — the file contents are wrapped in the
|
|
58
|
+
* shape the pipeline already understands. Comment stripping, string blanking,
|
|
59
|
+
* `view: 'code'`, grouping and every client knob then work identically.
|
|
60
|
+
*
|
|
61
|
+
* Files are read one at a time and handed to `onFile` rather than concatenated:
|
|
62
|
+
* a monorepo would otherwise be assembled into a single multi-megabyte string
|
|
63
|
+
* before the first pattern ran.
|
|
64
|
+
*/
|
|
65
|
+
export declare function scanTrackedFiles(ctx: CheckContext, files: string[], onFile: (asDiff: string) => void): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Hand a check the lines it should review, from the diff when there is one and
|
|
68
|
+
* from the tracked files otherwise.
|
|
69
|
+
*
|
|
70
|
+
* The single entry point every content check uses, so the choice between the two
|
|
71
|
+
* modes is made once rather than re-implemented per check — and so a check cannot
|
|
72
|
+
* accidentally support only one of them, which is how `--full` ended up with no
|
|
73
|
+
* security coverage at all (ticket 067).
|
|
74
|
+
*
|
|
75
|
+
* `onChunk` is called once per diff in delta mode and once per file in full mode,
|
|
76
|
+
* which keeps a whole monorepo from being concatenated before matching starts.
|
|
77
|
+
*
|
|
78
|
+
* Returns whether the review actually happened. `false` means git could not
|
|
79
|
+
* produce a file list, and the caller has to say so rather than report a pass:
|
|
80
|
+
* a check that reviewed nothing looks exactly like a check that found nothing,
|
|
81
|
+
* and that is the whole of ticket 072. `fullScanBehaviour: "skip"` is the one
|
|
82
|
+
* case where `true` is returned having reviewed nothing on purpose — the client
|
|
83
|
+
* asked for that, so it is not a hole in coverage.
|
|
84
|
+
*/
|
|
85
|
+
export declare function reviewLines(ctx: CheckContext, globs: string[], onChunk: (stdout: string) => void): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Which comment markers apply to a file, since they are not universal:
|
|
88
|
+
* - `c-like` — `//` only. `#` is NOT a comment in C-family syntax, where it
|
|
89
|
+
* opens a JS private field (`this.#handler`) or a C preprocessor directive.
|
|
90
|
+
* - `hash` — `#` only. `//` in Python or YAML is division or part of a URL.
|
|
91
|
+
* - `both` — unknown extension: strip either, which over-strips rather than
|
|
92
|
+
* under-reports. The conservative default, and the pre-060 behaviour.
|
|
93
|
+
*/
|
|
94
|
+
export type CommentSyntax = 'c-like' | 'hash' | 'both';
|
|
95
|
+
/** Comment syntax for a repo-relative path; `both` when the extension is unknown. */
|
|
96
|
+
export declare function commentSyntaxFor(file: string): CommentSyntax;
|
|
97
|
+
/**
|
|
98
|
+
* Strip a trailing line comment from a line, tracking quote state so a marker
|
|
99
|
+
* inside a string literal (a `#` in `"#fff"`, a `//` in a quoted URL) survives.
|
|
100
|
+
*
|
|
101
|
+
* Heuristic, not a tokenizer. `syntax` selects the applicable markers — passing
|
|
102
|
+
* the wrong one is how a valid `this.#handler = eval(payload)` used to be read
|
|
103
|
+
* as a comment and dropped entirely (ticket 059).
|
|
104
|
+
*
|
|
105
|
+
* Block comments are handled by the caller, which alone can track `/* *\/` state
|
|
106
|
+
* across lines; see {@link scanDiffPatterns}.
|
|
107
|
+
*/
|
|
108
|
+
export declare function stripInlineComment(line: string, syntax?: CommentSyntax): string;
|
|
109
|
+
/**
|
|
110
|
+
* Blank out the contents of string literals, keeping the quotes and the original
|
|
111
|
+
* length so the rest of the line still reads as code.
|
|
112
|
+
*
|
|
113
|
+
* This is what lets a pattern ask "is a real call being made here" without a
|
|
114
|
+
* lookahead that guesses at quoting. The `eval` rule used to carry
|
|
115
|
+
* `(?![^'"`]*['"`])` — intended to skip `eval` written inside a string, but in
|
|
116
|
+
* practice it disabled the rule on any line containing a quote anywhere, so
|
|
117
|
+
* `eval(userInput + "x")` and ``eval(`${payload}`)`` both went unreported
|
|
118
|
+
* (ticket 058).
|
|
119
|
+
*
|
|
120
|
+
* Only for patterns that match *code*. Rules that look for string *contents* —
|
|
121
|
+
* an SQL keyword inside quotes, a hardcoded URL — must keep reading the raw
|
|
122
|
+
* line, which is what {@link DiffPattern.view} selects.
|
|
123
|
+
*/
|
|
124
|
+
export declare function stripStringLiterals(line: string): string;
|
|
125
|
+
/** One regex-matched finding: which added lines to flag, under what label and level. */
|
|
126
|
+
export interface DiffPattern {
|
|
127
|
+
pattern: RegExp;
|
|
128
|
+
label: string;
|
|
129
|
+
severity: Severity;
|
|
130
|
+
/**
|
|
131
|
+
* Which view of the line the pattern reads.
|
|
132
|
+
* - `raw` (default) — the line as written, comments already stripped. Required
|
|
133
|
+
* by rules that inspect string *contents*, e.g. an SQL keyword in quotes.
|
|
134
|
+
* - `code` — string literals blanked by {@link stripStringLiterals}, so a rule
|
|
135
|
+
* matching a *call* is not thrown off by unrelated quoting on the same line.
|
|
136
|
+
*/
|
|
137
|
+
view?: 'raw' | 'code';
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* How many added lines a taint survives, for the one check that asks for it.
|
|
141
|
+
*
|
|
142
|
+
* Exported because the default belongs to Diff Security, not to this function:
|
|
143
|
+
* `scanDiffPatterns` is shared by Diff Smells, Workflow Security and Dockerfile
|
|
144
|
+
* Security too, and defaulting the heuristic ON here leaked a finding labelled
|
|
145
|
+
* "SQL injection risk" into a code-smell report — under the wrong check, three
|
|
146
|
+
* times per run, off a config key (`diffSecurity.dataflowWindow`) that has no
|
|
147
|
+
* meaning for any of them. Caught by our own Diff Smells row.
|
|
148
|
+
*/
|
|
149
|
+
export declare const DEFAULT_DATAFLOW_WINDOW = 10;
|
|
150
|
+
/**
|
|
151
|
+
* Bucket added diff lines by the {@link DiffPattern}s they match, split by
|
|
152
|
+
* severity. Patterns are expected to anchor on the leading `+` themselves
|
|
153
|
+
* (`/^\+(?!\+)…/`), which is what keeps `+++` file headers and context lines out.
|
|
154
|
+
*
|
|
155
|
+
* Comment handling follows the file each hunk belongs to, read from the `+++`
|
|
156
|
+
* headers as the diff is walked — a single run reviews files of several
|
|
157
|
+
* languages, so a repo-wide setting would be wrong for most of them.
|
|
158
|
+
*
|
|
159
|
+
* `skipIgnored` re-applies the `pr-checkmate-ignore` opt-out for callers that run
|
|
160
|
+
* `git diff` themselves; a diff obtained from {@link diffAddedLines} is already
|
|
161
|
+
* filtered and should leave it off.
|
|
162
|
+
*
|
|
163
|
+
* `comments: 'off'` scans lines verbatim, which is how a client audits code that
|
|
164
|
+
* was commented out rather than deleted.
|
|
165
|
+
*/
|
|
166
|
+
export declare function scanDiffPatterns(stdout: string, patterns: readonly DiffPattern[], opts?: {
|
|
167
|
+
skipIgnored?: boolean;
|
|
168
|
+
comments?: 'language' | 'legacy' | 'off';
|
|
169
|
+
/** Globs whose files are skipped entirely (client `<check>.ignorePaths`). */
|
|
170
|
+
ignorePaths?: string[];
|
|
171
|
+
/**
|
|
172
|
+
* Added lines a taint survives for the cross-line SQL heuristic.
|
|
173
|
+
*
|
|
174
|
+
* Off unless the caller asks. Only Diff Security owns this behaviour — it is
|
|
175
|
+
* configured by `diffSecurity.dataflowWindow` and reports a security label —
|
|
176
|
+
* so every other caller of this function gets a plain pattern scan.
|
|
177
|
+
*/
|
|
178
|
+
dataflowWindow?: number;
|
|
179
|
+
}): SeverityBuckets;
|
|
180
|
+
/**
|
|
181
|
+
* Log a capped sample of raw output lines under a one-line summary.
|
|
182
|
+
*
|
|
183
|
+
* The cap is the point: a linter with 400 offences must not push the rest of the
|
|
184
|
+
* report out of a CI log's scrollback, and the count that follows the sample is
|
|
185
|
+
* what keeps the truncation from reading as the whole story.
|
|
186
|
+
*
|
|
187
|
+
* Deliberately not the private `logFindings` below, which this nearly collided
|
|
188
|
+
* with. That one takes findings already grouped into labelled buckets and pairs
|
|
189
|
+
* the log with a severity; this one takes lines a tool printed and does nothing
|
|
190
|
+
* but show them, which is what a check wrapping somebody else's output needs and
|
|
191
|
+
* the only thing it can honestly claim about them.
|
|
192
|
+
*
|
|
193
|
+
* Here rather than beside its first caller because three categories want it now —
|
|
194
|
+
* the language runner, the Python type check, and Duplicate Code — and a
|
|
195
|
+
* `quality/` check importing from `languages/` to get a logger was the wrong
|
|
196
|
+
* shape (ticket 079).
|
|
197
|
+
*/
|
|
198
|
+
export declare function logSample(name: string, summary: string, lines: string[]): void;
|
|
199
|
+
export declare function bucketTotal(bucket: FindingBucket): number;
|
|
200
|
+
/**
|
|
201
|
+
* Report a bucket at the check's configured level, summarized as
|
|
202
|
+
* `9× console.*(), 1× debugger statement`.
|
|
203
|
+
*
|
|
204
|
+
* The phrasing every keyword-counting check uses: the label already says what
|
|
205
|
+
* was found, so only the count varies. Written out per check, the four-step tail
|
|
206
|
+
* — resolve the level, log at it, join the counts, emit at the same level — was
|
|
207
|
+
* copied verbatim, and `isError: sev.icon === '❌'` is exactly the kind of link
|
|
208
|
+
* between two of those steps that silently rots when only one side is edited.
|
|
209
|
+
*/
|
|
210
|
+
export declare function reportCountedFindings(findings: FindingBucket, ctx: CheckContext, opts: {
|
|
211
|
+
/** Log prefix, e.g. 'TODO/FIXME'. */
|
|
212
|
+
prefix: string;
|
|
213
|
+
/** The client's level for this check, e.g. `ctx.config.todoFixme?.severity`. */
|
|
214
|
+
severity?: Severity;
|
|
215
|
+
/** Level to use when the client configured none. Defaults to `warn`. */
|
|
216
|
+
fallback?: Severity;
|
|
217
|
+
/** Samples printed per label. Defaults to the client's `log.sampleLimit`, else 3. */
|
|
218
|
+
sampleLimit?: number;
|
|
219
|
+
/** Shorten a label for the summary only, e.g. drop an explanatory tail. */
|
|
220
|
+
summaryLabel?: (label: string) => string;
|
|
221
|
+
/** Appended to the summary, e.g. ` (no ticket reference)`. */
|
|
222
|
+
suffix?: string;
|
|
223
|
+
}): CheckOutcome;
|
|
224
|
+
interface SeverityReportOptions {
|
|
225
|
+
/** Log prefix, e.g. 'Diff Security'. */
|
|
226
|
+
prefix: string;
|
|
227
|
+
/** Summary phrasing given the error count. */
|
|
228
|
+
errorSummary: (n: number) => string;
|
|
229
|
+
/** Summary phrasing given the warning count. */
|
|
230
|
+
warningSummary: (n: number) => string;
|
|
231
|
+
/** Append ": N occurrence(s)" after each label (default true). */
|
|
232
|
+
showCount?: boolean;
|
|
233
|
+
/** Max samples printed per label; omit to print all. */
|
|
234
|
+
sampleLimit?: number;
|
|
235
|
+
/**
|
|
236
|
+
* Finding labels to suppress (client `<check>.ignore`). A label is dropped
|
|
237
|
+
* when it contains any ignore entry (case-insensitive), so a repo can mute a
|
|
238
|
+
* single built-in finding without disabling the whole check.
|
|
239
|
+
*/
|
|
240
|
+
ignore?: string[];
|
|
241
|
+
/**
|
|
242
|
+
* What a non-empty error bucket means for the run (client `<check>.failOn`):
|
|
243
|
+
* - `error` — block it (`fail`). The default: a finding the check itself rates
|
|
244
|
+
* `error` is meant to gate the merge, which is what a PR gate is for.
|
|
245
|
+
* - `warn` — report but never block, whatever the finding's own severity.
|
|
246
|
+
* - `never` — always `pass`; the findings are still logged.
|
|
247
|
+
*
|
|
248
|
+
* Falls back to `defaults.failOn`, then to `error`.
|
|
249
|
+
*/
|
|
250
|
+
failOn?: FailOn;
|
|
251
|
+
/**
|
|
252
|
+
* Per-finding level overrides (client `<check>.severityOverrides`), keyed by a
|
|
253
|
+
* case-insensitive substring of the label. Lets a repo demote one noisy rule,
|
|
254
|
+
* promote one it cares about, or drop a single finding — without turning the
|
|
255
|
+
* whole check off. `off` removes the finding entirely, like `ignore`.
|
|
256
|
+
*/
|
|
257
|
+
severityOverrides?: Record<string, 'error' | 'warn' | 'off'>;
|
|
258
|
+
/** Repo-wide fallbacks (client `severityDefaults`), used when the check sets nothing. */
|
|
259
|
+
defaults?: {
|
|
260
|
+
failOn?: FailOn;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* What a non-empty error bucket does to the run.
|
|
265
|
+
*
|
|
266
|
+
* Not exported, for the same reason as {@link Severity}: only this module names
|
|
267
|
+
* it, and `tsc` inlines it into `findings.d.ts` regardless.
|
|
268
|
+
*/
|
|
269
|
+
type FailOn = 'error' | 'warn' | 'never';
|
|
270
|
+
/** The knobs a check reads straight out of its own block in pr-checkmate.json. */
|
|
271
|
+
interface ClientFindingConfig {
|
|
272
|
+
ignore?: string[];
|
|
273
|
+
failOn?: FailOn;
|
|
274
|
+
severityOverrides?: Record<string, 'error' | 'warn' | 'off'>;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The half of {@link SeverityReportOptions} every check fills in identically:
|
|
278
|
+
* the client's own `<check>.ignore` / `failOn` / `severityOverrides`, the shared
|
|
279
|
+
* sample limit, and the repo-wide `severityDefaults` fallback.
|
|
280
|
+
*
|
|
281
|
+
* Only the phrasing (`prefix` and the two summaries) is ever check-specific, so
|
|
282
|
+
* spelling the rest out per check meant five lines of copy-paste that had to be
|
|
283
|
+
* kept in step by hand — and a check that forgot one line silently ignored a
|
|
284
|
+
* knob the client had set.
|
|
285
|
+
*/
|
|
286
|
+
export declare function clientFindingOptions(ctx: CheckContext, cfg?: ClientFindingConfig): Pick<SeverityReportOptions, 'sampleLimit' | 'ignore' | 'failOn' | 'severityOverrides' | 'defaults'>;
|
|
287
|
+
/**
|
|
288
|
+
* Report error/warning finding buckets: log both, then produce the outcome.
|
|
289
|
+
*
|
|
290
|
+
* Order is the contract, and each step exists because the one before it is too
|
|
291
|
+
* blunt on its own:
|
|
292
|
+
* 1. `ignore` — drop the finding outright.
|
|
293
|
+
* 2. `severityOverrides` — re-file what survived.
|
|
294
|
+
* 3. `failOn` — decide what a remaining error means for the run.
|
|
295
|
+
* The universal `severity[<check name>]` map is applied later still, by the
|
|
296
|
+
* orchestrator, so a client can always override a check wholesale by name.
|
|
297
|
+
*/
|
|
298
|
+
export declare function reportSeverityBuckets(errorsIn: FindingBucket, warningsIn: FindingBucket, opts: SeverityReportOptions): CheckOutcome;
|
|
299
|
+
export {};
|