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
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.deadCodeCheck = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
9
|
+
const constants_js_1 = require("../../../config/constants.js");
|
|
10
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
11
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
12
|
+
const reuse_js_1 = require("../../install/reuse.js");
|
|
13
|
+
const types_js_1 = require("../../types.js");
|
|
14
14
|
/**
|
|
15
15
|
* Resolve ts-unused-exports, preferring the consumer project's own copy (so a
|
|
16
16
|
* repo pinned to a different major keeps its own behaviour) and falling back to
|
|
@@ -27,9 +27,9 @@ function resolveTsUnusedExports(ctx) {
|
|
|
27
27
|
// No configuration of its own — it reads the module graph via tsconfig — so
|
|
28
28
|
// the version check is the right question here and `clientOwnsConfig` stays
|
|
29
29
|
// off, same as dpdm.
|
|
30
|
-
for (const options of [{ paths: (0,
|
|
30
|
+
for (const options of [{ paths: (0, reuse_js_1.clientToolPaths)('ts-unused-exports', ctx) }, undefined]) {
|
|
31
31
|
try {
|
|
32
|
-
return (0,
|
|
32
|
+
return (0, index_js_1.resolvePackageBin)('ts-unused-exports', 'bin/ts-unused-exports', options);
|
|
33
33
|
}
|
|
34
34
|
catch {
|
|
35
35
|
// Try the next location; both failing is a skip, handled by the caller.
|
|
@@ -49,11 +49,11 @@ exports.deadCodeCheck = {
|
|
|
49
49
|
async run(ctx) {
|
|
50
50
|
const tsConfigPath = node_path_1.default.join(ctx.cwd, 'tsconfig.json');
|
|
51
51
|
if (!node_fs_1.default.existsSync(tsConfigPath)) {
|
|
52
|
-
return (0,
|
|
52
|
+
return (0, types_js_1.skip)('no tsconfig.json found');
|
|
53
53
|
}
|
|
54
54
|
const bin = resolveTsUnusedExports(ctx);
|
|
55
55
|
if (!bin) {
|
|
56
|
-
return (0,
|
|
56
|
+
return (0, types_js_1.skip)('ts-unused-exports could not be resolved');
|
|
57
57
|
}
|
|
58
58
|
try {
|
|
59
59
|
// Run the full analysis unfiltered: ignore patterns are applied to the
|
|
@@ -62,16 +62,16 @@ exports.deadCodeCheck = {
|
|
|
62
62
|
// counting as usage — ignoring a barrel or entry point would then cascade
|
|
63
63
|
// and flag everything it re-exports. Filtering the output instead keeps
|
|
64
64
|
// every usage edge intact and only hides the exempted files' own reports.
|
|
65
|
-
const result = await (0,
|
|
65
|
+
const result = await (0, execa_js_1.execa)(process.execPath, [bin, tsConfigPath], {
|
|
66
66
|
cwd: ctx.cwd,
|
|
67
67
|
reject: false,
|
|
68
68
|
});
|
|
69
69
|
const output = [result.stdout, result.stderr].filter(Boolean).join('\n').trim();
|
|
70
70
|
if (!output || result.exitCode === 0) {
|
|
71
|
-
|
|
72
|
-
return (0,
|
|
71
|
+
index_js_1.logger.info('[Dead Code]: ✅ No unused exports found');
|
|
72
|
+
return (0, types_js_1.pass)();
|
|
73
73
|
}
|
|
74
|
-
const ignore = compileIgnorePatterns(ctx.config.deadCode?.ignoreFiles ??
|
|
74
|
+
const ignore = compileIgnorePatterns(ctx.config.deadCode?.ignoreFiles ?? constants_js_1.DEAD_CODE_IGNORE_DEFAULTS);
|
|
75
75
|
// ts-unused-exports prints one `path: sym1, sym2` line per file, preceded
|
|
76
76
|
// by a `N modules with unused exports` summary line we skip.
|
|
77
77
|
const parsed = output
|
|
@@ -91,25 +91,25 @@ exports.deadCodeCheck = {
|
|
|
91
91
|
// existence while grepping for console wording that had changed. Same
|
|
92
92
|
// resolution as Grype Scan: say so rather than invent a verdict.
|
|
93
93
|
if (parsed.length === 0) {
|
|
94
|
-
|
|
95
|
-
return (0,
|
|
94
|
+
index_js_1.logger.warn(`[Dead Code]: ⚠️ ts-unused-exports produced no parseable output:\n${output}`);
|
|
95
|
+
return (0, types_js_1.warn)('ts-unused-exports produced no parseable output');
|
|
96
96
|
}
|
|
97
97
|
const entries = parsed.filter(entry => !ignore.some(re => re.test(entry.file)));
|
|
98
98
|
if (entries.length === 0) {
|
|
99
|
-
|
|
100
|
-
return (0,
|
|
99
|
+
index_js_1.logger.info('[Dead Code]: ✅ No unused exports found');
|
|
100
|
+
return (0, types_js_1.pass)();
|
|
101
101
|
}
|
|
102
102
|
const fileCount = entries.length;
|
|
103
103
|
const exportCount = entries.reduce((sum, entry) => sum + entry.symbols.length, 0);
|
|
104
|
-
|
|
104
|
+
index_js_1.logger.warn(`[Dead Code]: ⚠️ ${exportCount} unused export(s) across ${fileCount} file(s):`);
|
|
105
105
|
for (const entry of entries) {
|
|
106
|
-
|
|
106
|
+
index_js_1.logger.warn(`${entry.file}: ${entry.symbols.join(', ')}`);
|
|
107
107
|
}
|
|
108
|
-
return (0,
|
|
108
|
+
return (0, types_js_1.warn)(`${exportCount} unused export(s) in ${fileCount} file(s)`);
|
|
109
109
|
}
|
|
110
110
|
catch (err) {
|
|
111
|
-
|
|
112
|
-
return (0,
|
|
111
|
+
index_js_1.logger.warn(`[Dead Code]: ⚠️ Could not run dead code check\n${err}`);
|
|
112
|
+
return (0, types_js_1.skip)('ts-unused-exports unavailable');
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
};
|
|
@@ -123,7 +123,7 @@ function compileIgnorePatterns(patterns) {
|
|
|
123
123
|
return [new RegExp(pattern)];
|
|
124
124
|
}
|
|
125
125
|
catch {
|
|
126
|
-
|
|
126
|
+
index_js_1.logger.warn(`[Dead Code]: ⚠️ Ignoring invalid ignoreFiles pattern: ${pattern}`);
|
|
127
127
|
return [];
|
|
128
128
|
}
|
|
129
129
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
2
|
export declare const duplicateCheck: Check;
|
|
@@ -7,13 +7,13 @@ exports.duplicateCheck = void 0;
|
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_os_1 = __importDefault(require("node:os"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
10
|
+
const constants_js_1 = require("../../../config/constants.js");
|
|
11
|
+
const index_js_1 = require("../../../config/index.js");
|
|
12
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
13
|
+
const index_js_2 = require("../../../utils/index.js");
|
|
14
|
+
const targets_js_1 = require("../../targets.js");
|
|
15
|
+
const types_js_1 = require("../../types.js");
|
|
16
|
+
const findings_js_1 = require("../findings.js");
|
|
17
17
|
/**
|
|
18
18
|
* The files to hand jscpd, per language.
|
|
19
19
|
*
|
|
@@ -49,7 +49,7 @@ function globsFor(languages) {
|
|
|
49
49
|
// meaningful production duplication. Config files (eslint/*.config.*) are data,
|
|
50
50
|
// not logic, and are commonly shipped in two formats (e.g. .eslintrc + flat
|
|
51
51
|
// config), so their repetition is expected rather than a code smell.
|
|
52
|
-
const BASE_IGNORE = ['node_modules/**', 'dist/**', '.git/**', ...
|
|
52
|
+
const BASE_IGNORE = ['node_modules/**', 'dist/**', '.git/**', ...constants_js_1.CONFIG_FILE_PATTERNS];
|
|
53
53
|
/** `<path>:<start>-<end>`, repo-relative, for one end of a clone. */
|
|
54
54
|
function locate(cwd, at) {
|
|
55
55
|
const name = at?.name ?? '';
|
|
@@ -73,20 +73,20 @@ exports.duplicateCheck = {
|
|
|
73
73
|
async run(ctx) {
|
|
74
74
|
const minLines = ctx.config.duplicate?.minLines ?? 5;
|
|
75
75
|
const minTokens = ctx.config.duplicate?.minTokens ?? 50;
|
|
76
|
-
const targetPaths = await (0,
|
|
76
|
+
const targetPaths = await (0, targets_js_1.resolveScopedTargetFiles)(ctx, globsFor(ctx.languages), (0, index_js_1.getSourcePaths)(ctx.cwd));
|
|
77
77
|
if (targetPaths === null)
|
|
78
|
-
return (0,
|
|
78
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
79
79
|
if (targetPaths.length === 0)
|
|
80
|
-
return (0,
|
|
81
|
-
const jscpdBin = (0,
|
|
80
|
+
return (0, types_js_1.skip)('no relevant files');
|
|
81
|
+
const jscpdBin = (0, index_js_2.resolvePackageBin)('jscpd', 'run-jscpd.js');
|
|
82
82
|
// Client-configurable exclusions (pr-checkmate.json `duplicate.ignore`),
|
|
83
83
|
// defaulting to test files/folders, appended to the always-on base ignores.
|
|
84
|
-
const configuredIgnore = ctx.config.duplicate?.ignore ??
|
|
84
|
+
const configuredIgnore = ctx.config.duplicate?.ignore ?? constants_js_1.DUPLICATE_IGNORE_DEFAULTS;
|
|
85
85
|
const ignore = [...BASE_IGNORE, ...configuredIgnore].join(',');
|
|
86
86
|
// Client-configurable formats (pr-checkmate.json `duplicate.formats`),
|
|
87
87
|
// defaulting to source-code formats so data files (yaml/json/markdown) are
|
|
88
88
|
// not scanned. Clients can add them back explicitly.
|
|
89
|
-
const formats = (ctx.config.duplicate?.formats ??
|
|
89
|
+
const formats = (ctx.config.duplicate?.formats ?? constants_js_1.DUPLICATE_CODE_FORMATS).join(',');
|
|
90
90
|
// The JSON reporter writes a file, so it needs somewhere to write it. Outside
|
|
91
91
|
// the repository deliberately: with no `--output`, jscpd creates `report/`
|
|
92
92
|
// in the client's working tree, and a check that leaves a directory behind is
|
|
@@ -97,7 +97,7 @@ exports.duplicateCheck = {
|
|
|
97
97
|
// That is what retired `stripJscpdPromo` — six string markers matching the
|
|
98
98
|
// funding lines jscpd v5 prints after its report, each good until the next
|
|
99
99
|
// release of somebody else's package.
|
|
100
|
-
const result = await (0,
|
|
100
|
+
const result = await (0, execa_js_1.execa)(process.execPath, [
|
|
101
101
|
jscpdBin,
|
|
102
102
|
'--min-lines',
|
|
103
103
|
String(minLines),
|
|
@@ -120,9 +120,9 @@ exports.duplicateCheck = {
|
|
|
120
120
|
// No report and nothing to read it from: jscpd did not get as far as
|
|
121
121
|
// writing one. Its stderr is the only thing that can say why, and a skip
|
|
122
122
|
// is the honest outcome — an empty report would read as "no duplication".
|
|
123
|
-
|
|
123
|
+
index_js_2.logger.warn(`[Duplicate Code]: ⚠️ jscpd wrote no report (exit ${result.exitCode ?? 'killed'})` +
|
|
124
124
|
`${result.stderr ? `\n${result.stderr}` : ''}`);
|
|
125
|
-
return (0,
|
|
125
|
+
return (0, types_js_1.skip)('jscpd produced no report');
|
|
126
126
|
}
|
|
127
127
|
const report = JSON.parse(node_fs_1.default.readFileSync(reportPath, 'utf-8'));
|
|
128
128
|
const clones = report.duplicates ?? [];
|
|
@@ -132,13 +132,13 @@ exports.duplicateCheck = {
|
|
|
132
132
|
// reported it as a pass.
|
|
133
133
|
const cloneCount = report.statistics?.total?.clones ?? clones.length;
|
|
134
134
|
if (cloneCount === 0)
|
|
135
|
-
return (0,
|
|
136
|
-
(0,
|
|
137
|
-
return (0,
|
|
135
|
+
return (0, types_js_1.pass)();
|
|
136
|
+
(0, findings_js_1.logSample)('Duplicate Code', `${cloneCount} duplicate block(s):`, clones.map(clone => describe(ctx.cwd, clone)));
|
|
137
|
+
return (0, types_js_1.warn)(`${cloneCount} duplicate block(s)`);
|
|
138
138
|
}
|
|
139
139
|
catch (err) {
|
|
140
|
-
|
|
141
|
-
return (0,
|
|
140
|
+
index_js_2.logger.warn(`[Duplicate Code]: ⚠️ Could not run duplicate check\n${err}`);
|
|
141
|
+
return (0, types_js_1.skip)('jscpd unavailable');
|
|
142
142
|
}
|
|
143
143
|
finally {
|
|
144
144
|
node_fs_1.default.rmSync(reportDir, { recursive: true, force: true });
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.licenseHeaderCheck = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
9
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
10
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
11
|
+
const targets_js_1 = require("../../targets.js");
|
|
12
|
+
const types_js_1 = require("../../types.js");
|
|
13
13
|
/** Source extensions a license header is expected on. */
|
|
14
14
|
const SOURCE_EXT = /\.(ts|tsx|js|jsx|mjs|cjs|py|kt|java|go|rs|cs|rb|php|swift|c|cc|cpp|h|hpp)$/i;
|
|
15
15
|
const DEFAULT_HEADER_LINES = 10;
|
|
@@ -31,35 +31,35 @@ exports.licenseHeaderCheck = {
|
|
|
31
31
|
async run(ctx) {
|
|
32
32
|
const patternSrc = ctx.config.licenseHeader?.pattern;
|
|
33
33
|
if (!patternSrc)
|
|
34
|
-
return (0,
|
|
34
|
+
return (0, types_js_1.skip)('no licenseHeader.pattern configured');
|
|
35
35
|
let header;
|
|
36
36
|
try {
|
|
37
37
|
header = new RegExp(patternSrc);
|
|
38
38
|
}
|
|
39
39
|
catch (err) {
|
|
40
|
-
|
|
41
|
-
return (0,
|
|
40
|
+
index_js_1.logger.warn(`[License Header]: ⚠️ invalid pattern\n${err}`);
|
|
41
|
+
return (0, types_js_1.skip)('invalid licenseHeader.pattern');
|
|
42
42
|
}
|
|
43
43
|
const maxLines = ctx.config.licenseHeader?.lines ?? DEFAULT_HEADER_LINES;
|
|
44
44
|
let added;
|
|
45
45
|
try {
|
|
46
46
|
if (!ctx.baseSha && ctx.config.run?.fullScanBehaviour === 'skip')
|
|
47
|
-
return (0,
|
|
47
|
+
return (0, types_js_1.pass)();
|
|
48
48
|
// Added files in delta mode; every tracked source file in full mode.
|
|
49
49
|
const args = ctx.baseSha
|
|
50
50
|
? ['diff', '--name-only', '--diff-filter=A', ctx.baseSha, ctx.headSha ?? 'HEAD']
|
|
51
51
|
: ['ls-files'];
|
|
52
|
-
const { stdout } = await (0,
|
|
52
|
+
const { stdout } = await (0, execa_js_1.execa)('git', args, { cwd: ctx.cwd });
|
|
53
53
|
// Its own git call rather than `resolveTargets`, and for one reason:
|
|
54
54
|
// `--diff-filter=A`. This check is about files a PR ADDS, and the shared
|
|
55
55
|
// resolver asks for ACMR — routing through it would start demanding a
|
|
56
56
|
// header on every modified file too, which is a different check. So the
|
|
57
57
|
// client's `excludePaths` is applied here explicitly instead (ticket 080).
|
|
58
|
-
added = (0,
|
|
58
|
+
added = (0, targets_js_1.excludeClientPaths)(stdout.split('\n').filter(Boolean), ctx.cwd).filter(f => SOURCE_EXT.test(f));
|
|
59
59
|
}
|
|
60
60
|
catch (err) {
|
|
61
|
-
|
|
62
|
-
return (0,
|
|
61
|
+
index_js_1.logger.warn(`[License Header]: ⚠️ Could not analyze diff\n${err}`);
|
|
62
|
+
return (0, types_js_1.skip)('diff unavailable');
|
|
63
63
|
}
|
|
64
64
|
const missing = [];
|
|
65
65
|
for (const file of added) {
|
|
@@ -78,10 +78,10 @@ exports.licenseHeaderCheck = {
|
|
|
78
78
|
missing.push(file);
|
|
79
79
|
}
|
|
80
80
|
if (missing.length === 0)
|
|
81
|
-
return (0,
|
|
82
|
-
missing.slice(0, 10).forEach(f =>
|
|
81
|
+
return (0, types_js_1.pass)();
|
|
82
|
+
missing.slice(0, 10).forEach(f => index_js_1.logger.warn(`[License Header]: ⚠️ missing header: ${f}`));
|
|
83
83
|
if (missing.length > 10)
|
|
84
|
-
|
|
85
|
-
return (0,
|
|
84
|
+
index_js_1.logger.warn(`[License Header]: ⚠️ ... and ${missing.length - 10} more`);
|
|
85
|
+
return (0, types_js_1.warn)(`${missing.length} new source file(s) missing the license header`);
|
|
86
86
|
},
|
|
87
87
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
2
|
export declare const markdownLintCheck: Check;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.markdownLintCheck = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_url_1 = require("node:url");
|
|
10
|
+
const index_js_1 = require("../../../config/index.js");
|
|
11
|
+
const index_js_2 = require("../../../utils/index.js");
|
|
12
|
+
const targets_js_1 = require("../../targets.js");
|
|
13
|
+
const types_js_1 = require("../../types.js");
|
|
14
|
+
function loadUserMarkdownConfig(cwd) {
|
|
15
|
+
const configPath = node_path_1.default.join(cwd, 'pr-checkmate.json');
|
|
16
|
+
if (!node_fs_1.default.existsSync(configPath))
|
|
17
|
+
return {};
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8')).markdownlint || {};
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
index_js_2.logger.warn(`[Markdown]: ⚠️ Failed to read markdownlint config: ${err}`);
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Load the markdownlint library, or `null` when it cannot be found.
|
|
28
|
+
*
|
|
29
|
+
* The library rather than `markdownlint-cli2`: the CLI drags in globby →
|
|
30
|
+
* micromatch → braces, which carries an unpatched advisory every client's
|
|
31
|
+
* `npm audit` then reports against pr-checkmate. We already have the file list
|
|
32
|
+
* from git, so the CLI's globbing bought nothing.
|
|
33
|
+
*
|
|
34
|
+
* Resolved through `resolvePackageBin` and loaded by a dynamic `import()` for the
|
|
35
|
+
* same two reasons as the bundled gofmt: the package may live in a fetched
|
|
36
|
+
* profile directory, and it is ESM while we emit CommonJS.
|
|
37
|
+
*/
|
|
38
|
+
async function loadMarkdownlint() {
|
|
39
|
+
try {
|
|
40
|
+
const promiseEntry = (0, index_js_2.resolvePackageBin)('markdownlint', 'lib/exports-promise.mjs');
|
|
41
|
+
const mainEntry = node_path_1.default.join(node_path_1.default.dirname(promiseEntry), 'exports.mjs');
|
|
42
|
+
const promise = (await import((0, node_url_1.pathToFileURL)(promiseEntry).href));
|
|
43
|
+
const main = (await import((0, node_url_1.pathToFileURL)(mainEntry).href));
|
|
44
|
+
return { lint: promise.lint, readConfig: promise.readConfig, applyFixes: main.applyFixes };
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
index_js_2.logger.warn(`[Markdown]: ⚠️ markdownlint could not be loaded\n${err}`);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The rules to lint with: the repository's own config when it has one, ours
|
|
53
|
+
* (plus the client's `markdownlint.rules`) when it does not. Someone with a
|
|
54
|
+
* `.markdownlint.json` has an opinion; merging ours into it would silently
|
|
55
|
+
* override the rules they wrote.
|
|
56
|
+
*/
|
|
57
|
+
async function readLintConfig(lib, cwd, userRules) {
|
|
58
|
+
const local = ['.markdownlint.json', '.markdownlint.jsonc'].find(name => (0, index_js_1.hasLocalConfig)([name], cwd));
|
|
59
|
+
if (local)
|
|
60
|
+
return lib.readConfig(node_path_1.default.join(cwd, local));
|
|
61
|
+
if ((0, index_js_1.hasLocalConfig)(['.markdownlint.yaml', '.markdownlint.yml'], cwd)) {
|
|
62
|
+
index_js_2.logger.warn('[Markdown]: ⚠️ YAML markdownlint configs are not supported, using bundled rules');
|
|
63
|
+
}
|
|
64
|
+
const bundled = await lib.readConfig((0, index_js_1.getPackageConfigPath)('.markdownlint.json'));
|
|
65
|
+
return { ...bundled, ...userRules };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An ignore pattern as a regular expression over a repo-relative path.
|
|
69
|
+
*
|
|
70
|
+
* A bare directory name excludes its contents; a file name matches exactly; `*`
|
|
71
|
+
* stays within a segment and `**` crosses them. `path.extname` is what tells a
|
|
72
|
+
* directory from a file, and it reads a leading dot as part of the name, so
|
|
73
|
+
* `.claude` is still the directory it is.
|
|
74
|
+
*/
|
|
75
|
+
function toIgnoreRegExp(pattern) {
|
|
76
|
+
const clean = pattern.replace(/\/+$/, '');
|
|
77
|
+
const escaped = clean
|
|
78
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
79
|
+
.replace(/\*\*\//g, '\u0001')
|
|
80
|
+
.replace(/\*\*/g, '\u0000')
|
|
81
|
+
.replace(/\*/g, '[^/]*')
|
|
82
|
+
.replace(/\u0001/g, '(?:.*/)?')
|
|
83
|
+
.replace(/\u0000/g, '.*');
|
|
84
|
+
const isDir = !clean.includes('*') && !node_path_1.default.extname(clean);
|
|
85
|
+
return new RegExp(`^${escaped}${isDir ? '(/.*)?' : ''}$`);
|
|
86
|
+
}
|
|
87
|
+
exports.markdownLintCheck = {
|
|
88
|
+
name: 'Markdown',
|
|
89
|
+
phase: 'informational',
|
|
90
|
+
applies() {
|
|
91
|
+
return true;
|
|
92
|
+
},
|
|
93
|
+
async run(ctx) {
|
|
94
|
+
const targets = await (0, targets_js_1.resolveTargetFiles)(ctx, ['*.md', '*.mdx']);
|
|
95
|
+
if (targets === null)
|
|
96
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
97
|
+
if (targets.length === 0)
|
|
98
|
+
return (0, types_js_1.skip)('no markdown files');
|
|
99
|
+
const userConfig = loadUserMarkdownConfig(ctx.cwd);
|
|
100
|
+
const userRules = userConfig.rules ?? {};
|
|
101
|
+
const lib = await loadMarkdownlint();
|
|
102
|
+
if (!lib)
|
|
103
|
+
return (0, types_js_1.warn)('markdownlint failed to run (exit 2) — check the markdownlint config');
|
|
104
|
+
const ignores = [
|
|
105
|
+
'node_modules/**',
|
|
106
|
+
'dist/**',
|
|
107
|
+
'coverage/**',
|
|
108
|
+
'graphify-out/**',
|
|
109
|
+
'.claude/**',
|
|
110
|
+
// Release-tool output, not prose anyone edits — see GENERATED_DOC_FILES.
|
|
111
|
+
...index_js_1.GENERATED_DOC_FILES,
|
|
112
|
+
...(userConfig.ignores ?? []),
|
|
113
|
+
].map(toIgnoreRegExp);
|
|
114
|
+
const files = targets.filter(file => !ignores.some(re => re.test(file)));
|
|
115
|
+
if (files.length === 0)
|
|
116
|
+
return (0, types_js_1.skip)('no markdown files');
|
|
117
|
+
try {
|
|
118
|
+
const config = await readLintConfig(lib, ctx.cwd, userRules);
|
|
119
|
+
const results = await lib.lint({ files: files.map(f => node_path_1.default.resolve(ctx.cwd, f)), config });
|
|
120
|
+
let findings = 0;
|
|
121
|
+
for (const [file, errors] of Object.entries(results)) {
|
|
122
|
+
if (errors.length === 0)
|
|
123
|
+
continue;
|
|
124
|
+
const rel = node_path_1.default.relative(ctx.cwd, file);
|
|
125
|
+
let remaining = errors;
|
|
126
|
+
if (ctx.write && errors.some(e => e.fixInfo)) {
|
|
127
|
+
const fixed = lib.applyFixes(node_fs_1.default.readFileSync(file, 'utf-8'), errors);
|
|
128
|
+
node_fs_1.default.writeFileSync(file, fixed);
|
|
129
|
+
remaining = errors.filter(e => !e.fixInfo);
|
|
130
|
+
}
|
|
131
|
+
for (const e of remaining) {
|
|
132
|
+
findings++;
|
|
133
|
+
const col = e.errorRange?.[0] ? `:${e.errorRange[0]}` : '';
|
|
134
|
+
index_js_2.logger.warn(`${rel}:${e.lineNumber}${col} ${e.ruleNames.join('/')} ${e.ruleDescription}` +
|
|
135
|
+
(e.errorDetail ? ` [${e.errorDetail}]` : ''));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return findings === 0 ? (0, types_js_1.pass)() : (0, types_js_1.warn)('markdown lint issues found');
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
// An unreadable config or a file that vanished: the tool could not run,
|
|
142
|
+
// which is not the same claim as "the prose has problems".
|
|
143
|
+
index_js_2.logger.warn(`[Markdown]: ⚠️ ${err}`);
|
|
144
|
+
return (0, types_js_1.warn)('markdownlint failed to run (exit 2) — check the markdownlint config');
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
};
|
|
@@ -7,10 +7,10 @@ exports.packageSizeCheck = void 0;
|
|
|
7
7
|
exports.classifyQueryFailure = classifyQueryFailure;
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
10
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
11
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
12
|
+
const types_js_1 = require("../../types.js");
|
|
13
|
+
const findings_js_1 = require("../findings.js");
|
|
14
14
|
/** Growth that is worth a row in the report, unless the client says otherwise. */
|
|
15
15
|
const DEFAULT_MAX_GROWTH = 20;
|
|
16
16
|
/** How many of the files behind the growth are named. */
|
|
@@ -44,7 +44,7 @@ async function packManifest(cwd, spec, registry) {
|
|
|
44
44
|
'--ignore-scripts',
|
|
45
45
|
...(registry ? ['--registry', registry] : []),
|
|
46
46
|
];
|
|
47
|
-
const result = await (0,
|
|
47
|
+
const result = await (0, execa_js_1.execa)('npm', args, { cwd, reject: false });
|
|
48
48
|
if (result.exitCode !== 0)
|
|
49
49
|
return { failure: classifyQueryFailure(result.stderr ?? '') };
|
|
50
50
|
try {
|
|
@@ -152,13 +152,13 @@ exports.packageSizeCheck = {
|
|
|
152
152
|
async run(ctx) {
|
|
153
153
|
const target = published(ctx.cwd);
|
|
154
154
|
if (!target)
|
|
155
|
-
return (0,
|
|
155
|
+
return (0, types_js_1.skip)('no publishable package.json');
|
|
156
156
|
const tag = ctx.config.packageSize?.compareWith ?? 'latest';
|
|
157
157
|
const maxGrowth = ctx.config.packageSize?.maxGrowthPercent ?? DEFAULT_MAX_GROWTH;
|
|
158
158
|
const spec = `${target.name}@${tag}`;
|
|
159
159
|
const local = await packManifest(ctx.cwd);
|
|
160
160
|
if (!('manifest' in local))
|
|
161
|
-
return (0,
|
|
161
|
+
return (0, types_js_1.skip)('npm could not describe this package');
|
|
162
162
|
const current = local.manifest;
|
|
163
163
|
// Never a pass: a green row over a comparison that did not happen is the
|
|
164
164
|
// mistake of ticket 072. And never one reason standing in for three — the
|
|
@@ -186,7 +186,7 @@ exports.packageSizeCheck = {
|
|
|
186
186
|
unauthenticated: `no credentials for ${host ?? 'the registry'}`,
|
|
187
187
|
unreadable: `could not read the published version${at}`,
|
|
188
188
|
}[remote.failure];
|
|
189
|
-
return (0,
|
|
189
|
+
return (0, types_js_1.skip)(reason);
|
|
190
190
|
}
|
|
191
191
|
const previous = remote.manifest;
|
|
192
192
|
const delta = current.unpackedSize - previous.unpackedSize;
|
|
@@ -194,10 +194,10 @@ exports.packageSizeCheck = {
|
|
|
194
194
|
const summary = `${mb(previous.unpackedSize)} → ${mb(current.unpackedSize)} ` +
|
|
195
195
|
`(${growth >= 0 ? '+' : ''}${growth.toFixed(1)}%) vs ${previous.version}`;
|
|
196
196
|
if (growth <= maxGrowth) {
|
|
197
|
-
|
|
198
|
-
return (0,
|
|
197
|
+
index_js_1.logger.info(`[Package Size]: ✅ ${summary}`);
|
|
198
|
+
return (0, types_js_1.pass)(summary);
|
|
199
199
|
}
|
|
200
|
-
(0,
|
|
201
|
-
return (0,
|
|
200
|
+
(0, findings_js_1.logSample)('Package Size', `${summary}:`, growthByFile(previous.files, current.files));
|
|
201
|
+
return (0, types_js_1.warn)(summary);
|
|
202
202
|
},
|
|
203
203
|
};
|
|
@@ -11,11 +11,11 @@ exports.resolveImports = resolveImports;
|
|
|
11
11
|
exports.dropMissingLanguages = dropMissingLanguages;
|
|
12
12
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
14
|
+
const index_js_1 = require("../../../config/index.js");
|
|
15
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
16
|
+
const index_js_2 = require("../../../utils/index.js");
|
|
17
|
+
const targets_js_1 = require("../../targets.js");
|
|
18
|
+
const types_js_1 = require("../../types.js");
|
|
19
19
|
function loadUserCspellConfig(cwd) {
|
|
20
20
|
const configPath = node_path_1.default.join(cwd, 'pr-checkmate.json');
|
|
21
21
|
if (!node_fs_1.default.existsSync(configPath))
|
|
@@ -24,7 +24,7 @@ function loadUserCspellConfig(cwd) {
|
|
|
24
24
|
return JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8')).cspell || {};
|
|
25
25
|
}
|
|
26
26
|
catch (err) {
|
|
27
|
-
|
|
27
|
+
index_js_2.logger.warn(`[Spellcheck]: ⚠️ Failed to read cspell config: ${err}`);
|
|
28
28
|
return {};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -213,7 +213,7 @@ function resolveFrom(cwd) {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
function createTempCspellConfig(cwd) {
|
|
216
|
-
const packageConfigPath = (0,
|
|
216
|
+
const packageConfigPath = (0, index_js_1.getPackageConfigPath)('cspell.json');
|
|
217
217
|
const packageConfigDir = node_path_1.default.dirname(packageConfigPath);
|
|
218
218
|
const defaultConfig = JSON.parse(node_fs_1.default.readFileSync(packageConfigPath, 'utf-8'));
|
|
219
219
|
const userConfig = loadUserCspellConfig(cwd);
|
|
@@ -222,14 +222,14 @@ function createTempCspellConfig(cwd) {
|
|
|
222
222
|
const { resolved, missing } = resolveImports(merged.import ?? [], packageConfigDir, resolve);
|
|
223
223
|
const available = availableDictionaries(resolve);
|
|
224
224
|
for (const { pkg } of missing) {
|
|
225
|
-
|
|
225
|
+
index_js_2.logger.info(`[Spellcheck]: dictionary ${pkg} is not installed and was skipped. Add it with \`npm i -D ${pkg}\`.`);
|
|
226
226
|
}
|
|
227
227
|
if (available.absent.length > 0) {
|
|
228
228
|
// `info`, not `debug`. A client who installed a dictionary and saw no change
|
|
229
229
|
// had nothing to read: the one line that would have explained it was behind a
|
|
230
230
|
// flag. Which dictionaries are in play decides which findings appear, so it
|
|
231
231
|
// belongs in the ordinary log (ticket 081).
|
|
232
|
-
|
|
232
|
+
index_js_2.logger.info(`[Spellcheck]: optional dictionaries not installed: ${available.absent.join(', ')}. ` +
|
|
233
233
|
`Install any of them to spellcheck that language (\`npm i -D ${available.absent[0]}\`).`);
|
|
234
234
|
}
|
|
235
235
|
// A language the client asked for whose dictionary is absent is dropped rather
|
|
@@ -259,9 +259,9 @@ exports.spellcheckCheck = {
|
|
|
259
259
|
return ctx.config.cspell?.enabled !== false && ctx.config.spellcheck?.enabled !== false;
|
|
260
260
|
},
|
|
261
261
|
async run(ctx) {
|
|
262
|
-
const targets = await (0,
|
|
262
|
+
const targets = await (0, targets_js_1.resolveScopedTargetFiles)(ctx, ['*.ts', '*.tsx', '*.js', '*.jsx', '*.md', '*.mdx', '*.json'], (0, index_js_1.getSourcePaths)(ctx.cwd));
|
|
263
263
|
if (targets === null)
|
|
264
|
-
return (0,
|
|
264
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
265
265
|
// Committed build output and test reports are dropped here, in JS, against
|
|
266
266
|
// repo-RELATIVE paths — a client cannot fix a typo in a generated file, so
|
|
267
267
|
// reporting one is noise that buries the real findings. Neither cspell
|
|
@@ -272,12 +272,12 @@ exports.spellcheckCheck = {
|
|
|
272
272
|
// rule for every repo. `ignoreDirs` already covers plain directory names via
|
|
273
273
|
// `resolveTargetFiles`; this adds the composite globs it cannot express
|
|
274
274
|
// (`**/cypress/videos/**`, `**/jest-html-reporters-*/**`).
|
|
275
|
-
const files = targets.filter(f => !(0,
|
|
275
|
+
const files = targets.filter(f => !(0, index_js_2.matchesAnyGlob)(f, index_js_1.IGNORE_PATTERNS));
|
|
276
276
|
if (files.length === 0)
|
|
277
|
-
return (0,
|
|
278
|
-
const hasLocal = (0,
|
|
277
|
+
return (0, types_js_1.pass)('no files to spellcheck');
|
|
278
|
+
const hasLocal = (0, index_js_1.hasLocalConfig)(['cspell.json', '.cspell.json', 'cspell.config.json'], ctx.cwd);
|
|
279
279
|
let tempConfigPath = null;
|
|
280
|
-
const cspellBin = (0,
|
|
280
|
+
const cspellBin = (0, index_js_2.resolvePackageBin)('cspell', 'bin.mjs');
|
|
281
281
|
// `--no-must-find-files`: cspell exits 1 when it checked nothing, which the
|
|
282
282
|
// exit-code mapping below would report as "spelling issues found" — a warning
|
|
283
283
|
// about problems that do not exist. Every file being excluded is a pass, not a
|
|
@@ -292,16 +292,16 @@ exports.spellcheckCheck = {
|
|
|
292
292
|
args = [...baseArgs, '--config', tempConfigPath];
|
|
293
293
|
}
|
|
294
294
|
try {
|
|
295
|
-
const result = await (0,
|
|
295
|
+
const result = await (0, execa_js_1.execa)(process.execPath, [cspellBin, ...args], {
|
|
296
296
|
cwd: ctx.cwd,
|
|
297
297
|
reject: false,
|
|
298
298
|
stdio: 'inherit',
|
|
299
299
|
});
|
|
300
|
-
return result.exitCode === 0 ? (0,
|
|
300
|
+
return result.exitCode === 0 ? (0, types_js_1.pass)() : (0, types_js_1.warn)('spelling issues found');
|
|
301
301
|
}
|
|
302
302
|
finally {
|
|
303
303
|
if (tempConfigPath)
|
|
304
|
-
(0,
|
|
304
|
+
(0, index_js_2.cleanupTempFile)(tempConfigPath);
|
|
305
305
|
}
|
|
306
306
|
},
|
|
307
307
|
};
|