pr-checkmate 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cli.js → cjs/cli.js} +30 -30
- package/dist/{config → cjs/config}/index.d.ts +2 -2
- package/dist/{config → cjs/config}/index.js +8 -7
- package/dist/{config → cjs/config}/loader.d.ts +1 -1
- package/dist/{config → cjs/config}/loader.js +8 -8
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.js +10 -10
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.js +27 -27
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.js +17 -17
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.js +18 -18
- package/dist/{core → cjs/core}/checks/dependencies/license-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/license-check.js +12 -12
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.js +14 -14
- package/dist/{core → cjs/core}/checks/findings.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/findings.js +16 -16
- package/dist/{core → cjs/core}/checks/git/custom-rules.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/custom-rules.js +19 -19
- package/dist/{core → cjs/core}/checks/git/diff-smell.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/git/diff-smell.js +13 -13
- package/dist/{core → cjs/core}/checks/git/large-files.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/large-files.js +15 -15
- package/dist/{core → cjs/core}/checks/git/leftover-debug.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/leftover-debug.js +13 -13
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.js +12 -12
- package/dist/{core → cjs/core}/checks/git/merge-conflict.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/merge-conflict.js +15 -15
- package/dist/{core → cjs/core}/checks/git/missing-tests.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/missing-tests.js +15 -15
- package/dist/{core → cjs/core}/checks/git/todo-fixme.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/todo-fixme.js +11 -11
- package/dist/{core → cjs/core}/checks/languages/cpp-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/cpp-format.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/external-checks.d.ts +9 -9
- package/dist/{core → cjs/core}/checks/languages/external-checks.js +10 -10
- package/dist/{core → cjs/core}/checks/languages/external-runner.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/languages/external-runner.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/go-format.d.ts +1 -1
- package/dist/cjs/core/checks/languages/go-format.js +202 -0
- package/dist/cjs/core/checks/languages/lint.d.ts +2 -0
- package/dist/{core → cjs/core}/checks/languages/lint.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/prettier.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/prettier.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/python-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-format.js +14 -14
- package/dist/{core → cjs/core}/checks/languages/python-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-lint.js +13 -13
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.js +29 -29
- package/dist/{core → cjs/core}/checks/languages/typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/typecheck.js +13 -13
- package/dist/{core → cjs/core}/checks/pr/commitlint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/commitlint.js +12 -12
- package/dist/{core → cjs/core}/checks/pr/pr-body.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-body.js +8 -8
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.js +10 -10
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/case-collision.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/case-collision.js +7 -7
- package/dist/{core → cjs/core}/checks/quality/config-validation.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/config-validation.js +9 -9
- package/dist/{core → cjs/core}/checks/quality/coverage.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/coverage.js +4 -4
- package/dist/{core → cjs/core}/checks/quality/dead-code.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/dead-code.js +23 -23
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.js +22 -22
- package/dist/{core → cjs/core}/checks/quality/license-header.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/license-header.js +16 -16
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.js +17 -17
- package/dist/{core → cjs/core}/checks/quality/package-size.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/package-size.js +12 -12
- package/dist/{core → cjs/core}/checks/quality/spellcheck.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/quality/spellcheck.js +18 -18
- package/dist/{core → cjs/core}/checks/quality/symlinks.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/symlinks.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.js +12 -12
- package/dist/{core → cjs/core}/checks/security/diff-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/diff-security.js +15 -15
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.js +16 -16
- package/dist/{core → cjs/core}/checks/security/migration-safety.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/migration-safety.js +17 -17
- package/dist/{core → cjs/core}/checks/security/security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/security.js +21 -21
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.js +14 -14
- package/dist/{core → cjs/core}/checks/security/workflow-security.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/security/workflow-security.js +14 -14
- package/dist/{core → cjs/core}/checks/tool-install.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/tool-install.js +2 -2
- package/dist/{core → cjs/core}/context.d.ts +1 -1
- package/dist/{core → cjs/core}/context.js +16 -16
- package/dist/cjs/core/index.d.ts +4 -0
- package/dist/{core → cjs/core}/index.js +7 -7
- package/dist/{core → cjs/core}/install/cache.js +2 -2
- package/dist/{core → cjs/core}/install/doctor.d.ts +4 -4
- package/dist/{core → cjs/core}/install/doctor.js +34 -34
- package/dist/{core → cjs/core}/install/ensure.d.ts +2 -2
- package/dist/{core → cjs/core}/install/ensure.js +15 -14
- package/dist/{core → cjs/core}/install/lock.js +4 -4
- package/dist/{core → cjs/core}/install/prepare.d.ts +4 -4
- package/dist/{core → cjs/core}/install/prepare.js +13 -13
- package/dist/{core → cjs/core}/install/profiles.d.ts +2 -2
- package/dist/{core → cjs/core}/install/reuse.d.ts +1 -1
- package/dist/{core → cjs/core}/install/reuse.js +4 -4
- package/dist/{core → cjs/core}/registry.d.ts +1 -1
- package/dist/cjs/core/registry.js +112 -0
- package/dist/{core → cjs/core}/reporters.d.ts +1 -1
- package/dist/{core → cjs/core}/reporters.js +28 -28
- package/dist/{core → cjs/core}/run-checks.d.ts +2 -2
- package/dist/{core → cjs/core}/run-checks.js +31 -31
- package/dist/{core → cjs/core}/targets.d.ts +1 -1
- package/dist/{core → cjs/core}/targets.js +20 -20
- package/dist/{core → cjs/core}/types.d.ts +3 -3
- package/dist/cjs/index.d.ts +12 -0
- package/dist/{index.js → cjs/index.js} +18 -18
- package/dist/{init.js → cjs/init.js} +68 -56
- package/dist/{interfaces → cjs/interfaces}/index.d.ts +3 -3
- package/dist/cjs/package.json +1 -0
- package/dist/{scripts → cjs/scripts}/copy-configs.js +22 -7
- package/dist/{scripts → cjs/scripts}/generate-install-manifests.js +2 -2
- package/dist/{scripts → cjs/scripts}/publish-github.js +4 -4
- package/dist/{utils → cjs/utils}/detect-language.js +12 -12
- package/dist/cjs/utils/execa.js +46 -0
- package/dist/{utils → cjs/utils}/git.js +2 -2
- package/dist/{utils → cjs/utils}/http.js +2 -2
- package/dist/cjs/utils/index.d.ts +15 -0
- package/dist/{utils → cjs/utils}/index.js +13 -13
- package/dist/{utils → cjs/utils}/own-deps.d.ts +2 -0
- package/dist/{utils → cjs/utils}/own-deps.js +1 -0
- package/dist/{utils → cjs/utils}/package-version.js +2 -1
- package/dist/{utils → cjs/utils}/resolve-bin.js +2 -1
- package/dist/{utils → cjs/utils}/update-notifier.js +4 -4
- package/dist/esm/cli.d.ts +2 -0
- package/dist/esm/cli.js +137 -0
- package/dist/esm/config/constants.d.ts +153 -0
- package/dist/esm/config/constants.js +360 -0
- package/dist/esm/config/index.d.ts +40 -0
- package/dist/esm/config/index.js +60 -0
- package/dist/esm/config/loader.d.ts +6 -0
- package/dist/esm/config/loader.js +191 -0
- package/dist/esm/config/pr-checkmate-workflow-docker.yml +79 -0
- package/dist/esm/config/pr-checkmate-workflow.yml +92 -0
- package/dist/esm/core/checks/dependencies/banned-imports.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/banned-imports.js +70 -0
- package/dist/esm/core/checks/dependencies/circular-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/circular-deps.js +155 -0
- package/dist/esm/core/checks/dependencies/dependency-check.d.ts +43 -0
- package/dist/esm/core/checks/dependencies/dependency-check.js +174 -0
- package/dist/esm/core/checks/dependencies/grype-scan.d.ts +22 -0
- package/dist/esm/core/checks/dependencies/grype-scan.js +112 -0
- package/dist/esm/core/checks/dependencies/license-check.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/license-check.js +61 -0
- package/dist/esm/core/checks/dependencies/npm-audit.d.ts +6 -0
- package/dist/esm/core/checks/dependencies/npm-audit.js +80 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.js +66 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.js +54 -0
- package/dist/esm/core/checks/findings.d.ts +299 -0
- package/dist/esm/core/checks/findings.js +701 -0
- package/dist/esm/core/checks/git/custom-rules.d.ts +2 -0
- package/dist/esm/core/checks/git/custom-rules.js +106 -0
- package/dist/esm/core/checks/git/diff-smell.d.ts +19 -0
- package/dist/esm/core/checks/git/diff-smell.js +69 -0
- package/dist/esm/core/checks/git/large-files.d.ts +2 -0
- package/dist/esm/core/checks/git/large-files.js +112 -0
- package/dist/esm/core/checks/git/leftover-debug.d.ts +2 -0
- package/dist/esm/core/checks/git/leftover-debug.js +89 -0
- package/dist/esm/core/checks/git/lockfile-drift.d.ts +2 -0
- package/dist/esm/core/checks/git/lockfile-drift.js +114 -0
- package/dist/esm/core/checks/git/merge-conflict.d.ts +2 -0
- package/dist/esm/core/checks/git/merge-conflict.js +117 -0
- package/dist/esm/core/checks/git/missing-tests.d.ts +2 -0
- package/dist/esm/core/checks/git/missing-tests.js +105 -0
- package/dist/esm/core/checks/git/todo-fixme.d.ts +7 -0
- package/dist/esm/core/checks/git/todo-fixme.js +80 -0
- package/dist/esm/core/checks/languages/cpp-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/cpp-format.js +91 -0
- package/dist/esm/core/checks/languages/external-checks.d.ts +77 -0
- package/dist/esm/core/checks/languages/external-checks.js +197 -0
- package/dist/esm/core/checks/languages/external-runner.d.ts +119 -0
- package/dist/esm/core/checks/languages/external-runner.js +138 -0
- package/dist/esm/core/checks/languages/go-format.d.ts +8 -0
- package/dist/{core → esm/core}/checks/languages/go-format.js +29 -35
- package/dist/esm/core/checks/languages/lint.d.ts +2 -0
- package/dist/esm/core/checks/languages/lint.js +92 -0
- package/dist/esm/core/checks/languages/prettier.d.ts +2 -0
- package/dist/esm/core/checks/languages/prettier.js +85 -0
- package/dist/esm/core/checks/languages/python-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/python-format.js +61 -0
- package/dist/esm/core/checks/languages/python-lint.d.ts +9 -0
- package/dist/esm/core/checks/languages/python-lint.js +55 -0
- package/dist/esm/core/checks/languages/python-typecheck.d.ts +14 -0
- package/dist/esm/core/checks/languages/python-typecheck.js +184 -0
- package/dist/esm/core/checks/languages/ruff-shared.d.ts +10 -0
- package/dist/esm/core/checks/languages/ruff-shared.js +35 -0
- package/dist/esm/core/checks/languages/typecheck.d.ts +2 -0
- package/dist/esm/core/checks/languages/typecheck.js +61 -0
- package/dist/esm/core/checks/pr/commitlint.d.ts +2 -0
- package/dist/esm/core/checks/pr/commitlint.js +102 -0
- package/dist/esm/core/checks/pr/pr-body.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-body.js +43 -0
- package/dist/esm/core/checks/pr/pr-size-check.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-size-check.js +42 -0
- package/dist/esm/core/checks/pr/pr-title-lint.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-title-lint.js +31 -0
- package/dist/esm/core/checks/quality/case-collision.d.ts +8 -0
- package/dist/esm/core/checks/quality/case-collision.js +39 -0
- package/dist/esm/core/checks/quality/config-validation.d.ts +11 -0
- package/dist/esm/core/checks/quality/config-validation.js +188 -0
- package/dist/esm/core/checks/quality/coverage.d.ts +2 -0
- package/dist/esm/core/checks/quality/coverage.js +62 -0
- package/dist/esm/core/checks/quality/dead-code.d.ts +2 -0
- package/dist/esm/core/checks/quality/dead-code.js +124 -0
- package/dist/esm/core/checks/quality/duplicate-check.d.ts +2 -0
- package/dist/esm/core/checks/quality/duplicate-check.js +141 -0
- package/dist/esm/core/checks/quality/license-header.d.ts +7 -0
- package/dist/esm/core/checks/quality/license-header.js +81 -0
- package/dist/esm/core/checks/quality/markdown-lint.d.ts +2 -0
- package/dist/esm/core/checks/quality/markdown-lint.js +104 -0
- package/dist/esm/core/checks/quality/package-size.d.ts +36 -0
- package/dist/esm/core/checks/quality/package-size.js +196 -0
- package/dist/esm/core/checks/quality/spellcheck.d.ts +77 -0
- package/dist/esm/core/checks/quality/spellcheck.js +296 -0
- package/dist/esm/core/checks/quality/symlinks.d.ts +16 -0
- package/dist/esm/core/checks/quality/symlinks.js +57 -0
- package/dist/esm/core/checks/quality/yaml-lint.d.ts +20 -0
- package/dist/esm/core/checks/quality/yaml-lint.js +116 -0
- package/dist/esm/core/checks/security/diff-security.d.ts +2 -0
- package/dist/esm/core/checks/security/diff-security.js +354 -0
- package/dist/esm/core/checks/security/dockerfile-security.d.ts +2 -0
- package/dist/esm/core/checks/security/dockerfile-security.js +98 -0
- package/dist/esm/core/checks/security/migration-safety.d.ts +2 -0
- package/dist/esm/core/checks/security/migration-safety.js +137 -0
- package/dist/esm/core/checks/security/security.d.ts +63 -0
- package/dist/esm/core/checks/security/security.js +201 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.d.ts +2 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.js +160 -0
- package/dist/esm/core/checks/security/workflow-security.d.ts +12 -0
- package/dist/esm/core/checks/security/workflow-security.js +100 -0
- package/dist/esm/core/checks/tool-install.d.ts +102 -0
- package/dist/esm/core/checks/tool-install.js +66 -0
- package/dist/esm/core/commands.d.ts +27 -0
- package/dist/esm/core/commands.js +89 -0
- package/dist/esm/core/context.d.ts +62 -0
- package/dist/esm/core/context.js +241 -0
- package/dist/esm/core/index.d.ts +4 -0
- package/dist/esm/core/index.js +4 -0
- package/dist/esm/core/install/cache.d.ts +58 -0
- package/dist/esm/core/install/cache.js +142 -0
- package/dist/esm/core/install/doctor.d.ts +35 -0
- package/dist/esm/core/install/doctor.js +164 -0
- package/dist/esm/core/install/ensure.d.ts +77 -0
- package/dist/esm/core/install/ensure.js +269 -0
- package/dist/esm/core/install/lock.d.ts +34 -0
- package/dist/esm/core/install/lock.js +92 -0
- package/dist/esm/core/install/merge.d.ts +47 -0
- package/dist/esm/core/install/merge.js +85 -0
- package/dist/esm/core/install/prepare.d.ts +76 -0
- package/dist/esm/core/install/prepare.js +142 -0
- package/dist/esm/core/install/profiles.d.ts +78 -0
- package/dist/esm/core/install/profiles.js +192 -0
- package/dist/esm/core/install/reuse.d.ts +41 -0
- package/dist/esm/core/install/reuse.js +100 -0
- package/dist/esm/core/registry.d.ts +6 -0
- package/dist/esm/core/registry.js +109 -0
- package/dist/esm/core/reporters.d.ts +18 -0
- package/dist/esm/core/reporters.js +266 -0
- package/dist/esm/core/run-checks.d.ts +33 -0
- package/dist/esm/core/run-checks.js +293 -0
- package/dist/esm/core/targets.d.ts +140 -0
- package/dist/esm/core/targets.js +213 -0
- package/dist/esm/core/types.d.ts +195 -0
- package/dist/esm/core/types.js +38 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/init.d.ts +38 -0
- package/dist/esm/init.js +421 -0
- package/dist/esm/interfaces/index.d.ts +432 -0
- package/dist/esm/interfaces/index.js +2 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/scripts/copy-configs.d.ts +1 -0
- package/dist/esm/scripts/copy-configs.js +64 -0
- package/dist/esm/scripts/generate-install-manifests.d.ts +39 -0
- package/dist/esm/scripts/generate-install-manifests.js +115 -0
- package/dist/esm/scripts/publish-github.d.ts +1 -0
- package/dist/esm/scripts/publish-github.js +45 -0
- package/dist/esm/utils/ci.d.ts +11 -0
- package/dist/esm/utils/ci.js +40 -0
- package/dist/esm/utils/detect-language.d.ts +48 -0
- package/dist/esm/utils/detect-language.js +234 -0
- package/dist/esm/utils/direct-deps.d.ts +21 -0
- package/dist/esm/utils/direct-deps.js +220 -0
- package/dist/esm/utils/execa.d.ts +22 -0
- package/dist/{utils → esm/utils}/execa.js +1 -4
- package/dist/esm/utils/git.d.ts +14 -0
- package/dist/esm/utils/git.js +21 -0
- package/dist/esm/utils/glob.d.ts +24 -0
- package/dist/esm/utils/glob.js +40 -0
- package/dist/esm/utils/http.d.ts +59 -0
- package/dist/esm/utils/http.js +115 -0
- package/dist/esm/utils/index.d.ts +15 -0
- package/dist/esm/utils/index.js +26 -0
- package/dist/esm/utils/logger.d.ts +65 -0
- package/dist/esm/utils/logger.js +157 -0
- package/dist/esm/utils/own-deps.d.ts +16 -0
- package/dist/esm/utils/own-deps.js +107 -0
- package/dist/esm/utils/package-version.d.ts +4 -0
- package/dist/esm/utils/package-version.js +38 -0
- package/dist/esm/utils/pool.d.ts +49 -0
- package/dist/esm/utils/pool.js +113 -0
- package/dist/esm/utils/resolve-bin.d.ts +67 -0
- package/dist/esm/utils/resolve-bin.js +156 -0
- package/dist/esm/utils/result-collector.d.ts +33 -0
- package/dist/esm/utils/result-collector.js +44 -0
- package/dist/esm/utils/update-notifier.d.ts +19 -0
- package/dist/esm/utils/update-notifier.js +108 -0
- package/install-manifests/core/package-lock.json +4 -4
- package/install-manifests/core/package.json +1 -1
- package/package.json +15 -13
- package/dist/core/checks/languages/lint.d.ts +0 -2
- package/dist/core/index.d.ts +0 -4
- package/dist/core/registry.js +0 -112
- package/dist/index.d.ts +0 -12
- package/dist/utils/index.d.ts +0 -15
- /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
- /package/dist/{config → cjs/config}/constants.d.ts +0 -0
- /package/dist/{config → cjs/config}/constants.js +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow-docker.yml +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow.yml +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.d.ts +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.js +0 -0
- /package/dist/{core → cjs/core}/commands.d.ts +0 -0
- /package/dist/{core → cjs/core}/commands.js +0 -0
- /package/dist/{core → cjs/core}/install/cache.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/lock.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.js +0 -0
- /package/dist/{core → cjs/core}/install/profiles.js +0 -0
- /package/dist/{core → cjs/core}/types.js +0 -0
- /package/dist/{init.d.ts → cjs/init.d.ts} +0 -0
- /package/dist/{interfaces → cjs/interfaces}/index.js +0 -0
- /package/dist/{scripts → cjs/scripts}/copy-configs.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/generate-install-manifests.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/publish-github.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.js +0 -0
- /package/dist/{utils → cjs/utils}/detect-language.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.js +0 -0
- /package/dist/{utils → cjs/utils}/execa.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/git.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.js +0 -0
- /package/dist/{utils → cjs/utils}/http.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.js +0 -0
- /package/dist/{utils → cjs/utils}/package-version.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.js +0 -0
- /package/dist/{utils → cjs/utils}/resolve-bin.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.js +0 -0
- /package/dist/{utils → cjs/utils}/update-notifier.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.phpFormatCheck = exports.csharpFormatCheck = exports.rustFormatCheck = exports.rustLintCheck = exports.goLintCheck = exports.shellcheckCheck = exports.rubyLintCheck = exports.swiftLintCheck = exports.kotlinLintCheck = void 0;
|
|
4
|
-
const
|
|
4
|
+
const external_runner_js_1 = require("./external-runner.js");
|
|
5
5
|
/**
|
|
6
6
|
* Every check that runs a linter or formatter we do not ship, as a table.
|
|
7
7
|
*
|
|
@@ -25,7 +25,7 @@ const external_runner_1 = require("./external-runner");
|
|
|
25
25
|
* doubles as the Kotlin format signal). Uses the repo's own `.editorconfig`
|
|
26
26
|
* when present.
|
|
27
27
|
*/
|
|
28
|
-
exports.kotlinLintCheck = (0,
|
|
28
|
+
exports.kotlinLintCheck = (0, external_runner_js_1.defineExternalLint)({
|
|
29
29
|
name: 'ktlint',
|
|
30
30
|
bin: 'ktlint',
|
|
31
31
|
tool: 'ktlint',
|
|
@@ -41,7 +41,7 @@ exports.kotlinLintCheck = (0, external_runner_1.defineExternalLint)({
|
|
|
41
41
|
* its own `.swiftlint.yml` scope, and a file list would bypass the excludes a
|
|
42
42
|
* repo wrote there — so the resolved targets only decide whether it runs at all.
|
|
43
43
|
*/
|
|
44
|
-
exports.swiftLintCheck = (0,
|
|
44
|
+
exports.swiftLintCheck = (0, external_runner_js_1.defineExternalLint)({
|
|
45
45
|
name: 'SwiftLint',
|
|
46
46
|
bin: 'swiftlint',
|
|
47
47
|
tool: 'swiftlint',
|
|
@@ -63,7 +63,7 @@ exports.swiftLintCheck = (0, external_runner_1.defineExternalLint)({
|
|
|
63
63
|
* so it doubles as the Ruby format signal. Uses the repo's own `.rubocop.yml`
|
|
64
64
|
* when present.
|
|
65
65
|
*/
|
|
66
|
-
exports.rubyLintCheck = (0,
|
|
66
|
+
exports.rubyLintCheck = (0, external_runner_js_1.defineExternalLint)({
|
|
67
67
|
name: 'RuboCop',
|
|
68
68
|
bin: 'rubocop',
|
|
69
69
|
tool: 'rubocop',
|
|
@@ -84,7 +84,7 @@ exports.rubyLintCheck = (0, external_runner_1.defineExternalLint)({
|
|
|
84
84
|
* No language gate: shell is not something detection reports, and a `deploy.sh`
|
|
85
85
|
* in a Python repository is exactly the file this check exists for.
|
|
86
86
|
*/
|
|
87
|
-
exports.shellcheckCheck = (0,
|
|
87
|
+
exports.shellcheckCheck = (0, external_runner_js_1.defineExternalLint)({
|
|
88
88
|
name: 'ShellCheck',
|
|
89
89
|
bin: 'shellcheck',
|
|
90
90
|
tool: 'shellcheck',
|
|
@@ -108,7 +108,7 @@ exports.shellcheckCheck = (0, external_runner_1.defineExternalLint)({
|
|
|
108
108
|
* per package, so it runs over the module rather than a file list; the delta
|
|
109
109
|
* only decides whether it runs.
|
|
110
110
|
*/
|
|
111
|
-
exports.goLintCheck = (0,
|
|
111
|
+
exports.goLintCheck = (0, external_runner_js_1.defineExternalLint)({
|
|
112
112
|
name: 'Go Vet',
|
|
113
113
|
bin: 'go',
|
|
114
114
|
tool: 'go',
|
|
@@ -126,7 +126,7 @@ exports.goLintCheck = (0, external_runner_1.defineExternalLint)({
|
|
|
126
126
|
* Lints changed Rust with Clippy. It compiles the crate, so it runs over the
|
|
127
127
|
* crate rather than a file list; the delta only decides whether it runs.
|
|
128
128
|
*/
|
|
129
|
-
exports.rustLintCheck = (0,
|
|
129
|
+
exports.rustLintCheck = (0, external_runner_js_1.defineExternalLint)({
|
|
130
130
|
name: 'Clippy',
|
|
131
131
|
bin: 'cargo',
|
|
132
132
|
tool: 'clippy',
|
|
@@ -148,7 +148,7 @@ exports.rustLintCheck = (0, external_runner_1.defineExternalLint)({
|
|
|
148
148
|
* crate's edition from `Cargo.toml`, and rustfmt invoked directly does not —
|
|
149
149
|
* which silently formats 2015-edition code by 2024 rules.
|
|
150
150
|
*/
|
|
151
|
-
exports.rustFormatCheck = (0,
|
|
151
|
+
exports.rustFormatCheck = (0, external_runner_js_1.defineExternalFormat)({
|
|
152
152
|
name: 'Rustfmt',
|
|
153
153
|
bin: 'cargo',
|
|
154
154
|
tool: 'rustfmt',
|
|
@@ -167,7 +167,7 @@ exports.rustFormatCheck = (0, external_runner_1.defineExternalFormat)({
|
|
|
167
167
|
* (and expects a prior `dotnet restore`), so it runs over the whole project; the
|
|
168
168
|
* delta only decides whether it runs.
|
|
169
169
|
*/
|
|
170
|
-
exports.csharpFormatCheck = (0,
|
|
170
|
+
exports.csharpFormatCheck = (0, external_runner_js_1.defineExternalFormat)({
|
|
171
171
|
name: 'C# Format',
|
|
172
172
|
bin: 'dotnet',
|
|
173
173
|
tool: 'dotnet',
|
|
@@ -186,7 +186,7 @@ exports.csharpFormatCheck = (0, external_runner_1.defineExternalFormat)({
|
|
|
186
186
|
* absolute paths, and a CI checkout directory that changes between runs makes a
|
|
187
187
|
* stale cache report files as clean that were never examined.
|
|
188
188
|
*/
|
|
189
|
-
exports.phpFormatCheck = (0,
|
|
189
|
+
exports.phpFormatCheck = (0, external_runner_js_1.defineExternalFormat)({
|
|
190
190
|
name: 'PHP CS Fixer',
|
|
191
191
|
bin: 'php-cs-fixer',
|
|
192
192
|
tool: 'php-cs-fixer',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Check, CheckContext, type Language } from '../../types';
|
|
2
|
-
import { type ExternalTool } from '../tool-install';
|
|
1
|
+
import { Check, CheckContext, type Language } from '../../types.js';
|
|
2
|
+
import { type ExternalTool } from '../tool-install.js';
|
|
3
3
|
/**
|
|
4
4
|
* The one shape every check that shells out to somebody else's linter has.
|
|
5
5
|
*
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runTool = runTool;
|
|
4
4
|
exports.defineExternalLint = defineExternalLint;
|
|
5
5
|
exports.defineExternalFormat = defineExternalFormat;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
6
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
7
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
8
|
+
const targets_js_1 = require("../../targets.js");
|
|
9
|
+
const types_js_1 = require("../../types.js");
|
|
10
|
+
const findings_js_1 = require("../findings.js");
|
|
11
|
+
const tool_install_js_1 = require("../tool-install.js");
|
|
12
12
|
/**
|
|
13
13
|
* Run an external tool, telling an absent binary apart from a failing one.
|
|
14
14
|
*
|
|
@@ -20,7 +20,7 @@ const tool_install_1 = require("../tool-install");
|
|
|
20
20
|
* copies to lose it.
|
|
21
21
|
*/
|
|
22
22
|
async function runTool(ctx, bin, args) {
|
|
23
|
-
const result = await (0,
|
|
23
|
+
const result = await (0, execa_js_1.execa)(bin, args, { cwd: ctx.cwd, reject: false });
|
|
24
24
|
if (result.code === 'ENOENT')
|
|
25
25
|
return { missing: true };
|
|
26
26
|
return {
|
|
@@ -67,7 +67,7 @@ function defineExternal(spec, phase, work) {
|
|
|
67
67
|
return isEnabled(ctx, spec.configKey, spec.language);
|
|
68
68
|
},
|
|
69
69
|
async run(ctx) {
|
|
70
|
-
const targets = await (0,
|
|
70
|
+
const targets = await (0, targets_js_1.resolveTargets)(ctx, spec.globs, {
|
|
71
71
|
onEmpty: { pass: `no ${spec.subject} changed` },
|
|
72
72
|
});
|
|
73
73
|
if (!Array.isArray(targets))
|
|
@@ -88,15 +88,15 @@ function defineExternalLint(spec) {
|
|
|
88
88
|
return defineExternal(spec, 'informational', async (ctx, targets) => {
|
|
89
89
|
const run = await runTool(ctx, spec.bin, spec.args(ctx, targets));
|
|
90
90
|
if (run.missing)
|
|
91
|
-
return (0,
|
|
91
|
+
return (0, tool_install_js_1.notInstalled)(spec.tool, spec.toolLabel);
|
|
92
92
|
const output = combinedOutput(run, spec.stderrFirst);
|
|
93
93
|
// Exit 0 is the tool's verdict. Empty output on a non-zero exit is a tool
|
|
94
94
|
// that objected without saying to what, and there is nothing to put in a
|
|
95
95
|
// report either way — so both are a pass rather than a warn reading
|
|
96
96
|
// "0 issue(s)".
|
|
97
97
|
if (run.exitCode === 0 || !output) {
|
|
98
|
-
|
|
99
|
-
return (0,
|
|
98
|
+
index_js_1.logger.info(`[${spec.name}]: ✅ No issues found`);
|
|
99
|
+
return (0, types_js_1.pass)();
|
|
100
100
|
}
|
|
101
101
|
const lines = output.split('\n').filter(spec.keep ?? isNotBlank);
|
|
102
102
|
// The tool objected and none of its output matched what this check knows how
|
|
@@ -105,8 +105,8 @@ function defineExternalLint(spec) {
|
|
|
105
105
|
const summary = lines.length > 0
|
|
106
106
|
? (spec.summary ?? countIssues)(lines, targets)
|
|
107
107
|
: `${spec.bin} exited ${run.exitCode ?? 'without a code'} with no readable diagnostics`;
|
|
108
|
-
(0,
|
|
109
|
-
return (0,
|
|
108
|
+
(0, findings_js_1.logSample)(spec.name, `${summary}:`, lines);
|
|
109
|
+
return (0, types_js_1.warn)(summary);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
@@ -121,12 +121,12 @@ function defineExternalFormat(spec) {
|
|
|
121
121
|
return defineExternal(spec, 'format', async (ctx, targets) => {
|
|
122
122
|
const dry = await runTool(ctx, spec.bin, spec.checkArgs(targets));
|
|
123
123
|
if (dry.missing)
|
|
124
|
-
return (0,
|
|
124
|
+
return (0, tool_install_js_1.notInstalled)(spec.tool, spec.toolLabel);
|
|
125
125
|
if (dry.exitCode === 0)
|
|
126
|
-
return (0,
|
|
126
|
+
return (0, types_js_1.pass)();
|
|
127
127
|
if (!ctx.write) {
|
|
128
|
-
|
|
129
|
-
return (0,
|
|
128
|
+
index_js_1.logger.warn(`[${spec.name}]: ⚠️ ${spec.code} needs formatting`);
|
|
129
|
+
return (0, types_js_1.warn)(`${spec.code} needs formatting (run with write to fix)`);
|
|
130
130
|
}
|
|
131
131
|
const fix = await runTool(ctx, spec.bin, spec.writeArgs(targets));
|
|
132
132
|
// `missing` cannot happen here — the same binary answered a moment ago — but
|
|
@@ -134,10 +134,10 @@ function defineExternalFormat(spec) {
|
|
|
134
134
|
// correct and shorter than asserting it away.
|
|
135
135
|
if (fix.missing || fix.exitCode !== 0) {
|
|
136
136
|
const detail = fix.missing ? '' : `\n${fix.stderr}`;
|
|
137
|
-
|
|
138
|
-
return (0,
|
|
137
|
+
index_js_1.logger.warn(`[${spec.name}]: ⚠️ ${spec.bin} failed to rewrite files${detail}`);
|
|
138
|
+
return (0, types_js_1.warn)(`${spec.bin} failed to rewrite files`);
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
return (0,
|
|
140
|
+
index_js_1.logger.info(`[${spec.name}]: ✅ Reformatted ${spec.code}`);
|
|
141
|
+
return (0, types_js_1.pass)(`reformatted ${spec.code}`);
|
|
142
142
|
});
|
|
143
143
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.goFormatCheck = void 0;
|
|
40
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
41
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
42
|
+
const node_url_1 = require("node:url");
|
|
43
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
44
|
+
const targets_js_1 = require("../../targets.js");
|
|
45
|
+
const types_js_1 = require("../../types.js");
|
|
46
|
+
const tool_install_js_1 = require("../tool-install.js");
|
|
47
|
+
const external_runner_js_1 = require("./external-runner.js");
|
|
48
|
+
const GO_GLOBS = ['*.go'];
|
|
49
|
+
/**
|
|
50
|
+
* Load the bundled WASM gofmt, or explain why it could not be loaded.
|
|
51
|
+
*
|
|
52
|
+
* This is what stopped `⏭️ Go Format: gofmt not installed` from being the answer
|
|
53
|
+
* on every runner without a Go toolchain — a ~285 KB WASM build of gofmt does
|
|
54
|
+
* the same job with nothing to install, the same way Ruff covers Python and
|
|
55
|
+
* clang-format covers C++.
|
|
56
|
+
*
|
|
57
|
+
* Three details, each of which was a way to get this wrong:
|
|
58
|
+
*
|
|
59
|
+
* - **Resolved through `resolvePackageBin`, not a bare specifier.** The package
|
|
60
|
+
* may live in a fetched profile directory rather than in our own tree, and only
|
|
61
|
+
* the resolver knows about those. A bare `import('@wasm-fmt/gofmt')` resolves
|
|
62
|
+
* relative to this file and would miss it.
|
|
63
|
+
* - **`gofmt_node.js` explicitly**, because the package's `exports` map routes
|
|
64
|
+
* `.` per runtime and the node entry is the one that reads the `.wasm` off disk.
|
|
65
|
+
* - **A dynamic `import()`.** The package is ESM and we emit CommonJS;
|
|
66
|
+
* `require` cannot load it, and TypeScript preserves dynamic `import()` in CJS
|
|
67
|
+
* output under `module: NodeNext` precisely so this works.
|
|
68
|
+
*/
|
|
69
|
+
async function loadBundledGofmt() {
|
|
70
|
+
try {
|
|
71
|
+
const entry = (0, index_js_1.resolvePackageBin)('@wasm-fmt/gofmt', 'gofmt_node.js');
|
|
72
|
+
const mod = (await Promise.resolve(`${(0, node_url_1.pathToFileURL)(entry).href}`).then(s => __importStar(require(s))));
|
|
73
|
+
return mod.format;
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
index_js_1.logger.warn(`[Go Format]: ⚠️ bundled gofmt could not be loaded\n${err}`);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The verdict, given the files that turned out to need formatting.
|
|
82
|
+
*
|
|
83
|
+
* Shared by both routes on purpose. It was written out twice — once after
|
|
84
|
+
* `gofmt -l` and once after the in-memory comparison — and the two copies are how
|
|
85
|
+
* the wording of a verdict comes to depend on whether Go happens to be installed
|
|
86
|
+
* on the runner (ticket 079). What a client is told about their code must not be a
|
|
87
|
+
* function of our own resolution order.
|
|
88
|
+
*
|
|
89
|
+
* Called only once the rewriting, if any, is done — so reaching the last branch
|
|
90
|
+
* means the files really were rewritten and CI has something to commit. The
|
|
91
|
+
* routes differ in when that happens (the system route shells out to `gofmt -w`,
|
|
92
|
+
* the bundled one wrote each file as it went) and in nothing this function can
|
|
93
|
+
* see.
|
|
94
|
+
*/
|
|
95
|
+
function verdictFor(ctx, unformatted) {
|
|
96
|
+
if (unformatted.length === 0)
|
|
97
|
+
return (0, types_js_1.pass)();
|
|
98
|
+
if (!ctx.write) {
|
|
99
|
+
index_js_1.logger.warn(`[Go Format]: ⚠️ ${unformatted.length} Go file(s) need formatting`);
|
|
100
|
+
unformatted.slice(0, 10).forEach(file => index_js_1.logger.warn(` ${file}`));
|
|
101
|
+
return (0, types_js_1.warn)(`${unformatted.length} file(s) need formatting (run with write to fix)`);
|
|
102
|
+
}
|
|
103
|
+
index_js_1.logger.info(`[Go Format]: ✅ Reformatted ${unformatted.length} Go file(s)`);
|
|
104
|
+
return (0, types_js_1.pass)(`reformatted ${unformatted.length} file(s)`);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Format with the runner's own `gofmt`, when it has one.
|
|
108
|
+
*
|
|
109
|
+
* Tried ahead of the bundled copy on purpose, and it is the same policy as
|
|
110
|
+
* preferring a repo's `.clang-format` or its own ESLint: gofmt's output is a
|
|
111
|
+
* function of the Go release, and the one release we know a repository agrees
|
|
112
|
+
* with is the one installed beside it. Reaching for ours first would mean
|
|
113
|
+
* rewriting a Go 1.18 tree by current rules in `write` mode — us and their CI
|
|
114
|
+
* reformatting the same files in opposite directions.
|
|
115
|
+
*
|
|
116
|
+
* @returns The outcome, or `null` when there is no system `gofmt` to ask.
|
|
117
|
+
*/
|
|
118
|
+
async function formatWithSystemGofmt(ctx, targets) {
|
|
119
|
+
const list = await (0, external_runner_js_1.runTool)(ctx, 'gofmt', ['-l', ...targets]);
|
|
120
|
+
if (list.missing)
|
|
121
|
+
return null;
|
|
122
|
+
const unformatted = list.stdout.split('\n').filter(Boolean);
|
|
123
|
+
// Decided before the rewrite, so a read-only run answers without `gofmt -w`
|
|
124
|
+
// having been considered at all.
|
|
125
|
+
if (unformatted.length === 0 || !ctx.write)
|
|
126
|
+
return verdictFor(ctx, unformatted);
|
|
127
|
+
const fix = await (0, external_runner_js_1.runTool)(ctx, 'gofmt', ['-w', ...unformatted]);
|
|
128
|
+
if (fix.missing || fix.exitCode !== 0) {
|
|
129
|
+
index_js_1.logger.warn(`[Go Format]: ⚠️ gofmt -w failed\n${fix.missing ? '' : fix.stderr}`);
|
|
130
|
+
return (0, types_js_1.warn)('gofmt failed to rewrite files');
|
|
131
|
+
}
|
|
132
|
+
return verdictFor(ctx, unformatted);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Format in-process with the bundled WASM gofmt — the route taken on a runner
|
|
136
|
+
* with no Go toolchain, which is most of them.
|
|
137
|
+
*
|
|
138
|
+
* Compares rather than trusting an exit code, because the WASM build is a
|
|
139
|
+
* library and not a CLI: it formats a string and says nothing about whether it
|
|
140
|
+
* changed anything. Mirrors the Ruff format check for that reason.
|
|
141
|
+
*/
|
|
142
|
+
function formatWithBundledGofmt(ctx, targets, format) {
|
|
143
|
+
const unformatted = [];
|
|
144
|
+
for (const rel of targets) {
|
|
145
|
+
const abs = node_path_1.default.join(ctx.cwd, rel);
|
|
146
|
+
let content;
|
|
147
|
+
try {
|
|
148
|
+
content = node_fs_1.default.readFileSync(abs, 'utf-8');
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
continue; // renamed or removed between the diff and the read
|
|
152
|
+
}
|
|
153
|
+
let formatted;
|
|
154
|
+
try {
|
|
155
|
+
formatted = format(content);
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
// gofmt parses before it formats, so a throw here is a syntax error. That
|
|
159
|
+
// is Go Vet's finding to report, not a formatting verdict — and calling it
|
|
160
|
+
// one sends people looking for a style problem that does not exist.
|
|
161
|
+
index_js_1.logger.warn(`[Go Format]: ⚠️ could not parse ${rel} (syntax error?)\n${err}`);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (formatted === content)
|
|
165
|
+
continue;
|
|
166
|
+
unformatted.push(rel);
|
|
167
|
+
if (ctx.write)
|
|
168
|
+
node_fs_1.default.writeFileSync(abs, formatted);
|
|
169
|
+
}
|
|
170
|
+
return verdictFor(ctx, unformatted);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Formats changed Go files with gofmt — the runner's own when it has one, and a
|
|
174
|
+
* bundled WASM build otherwise, so the check has no runner dependency at all.
|
|
175
|
+
* Read-only in check mode; rewrites in place when `write`, so CI can auto-commit
|
|
176
|
+
* — mirrors the Prettier/C++/Ruff format checks.
|
|
177
|
+
*/
|
|
178
|
+
exports.goFormatCheck = {
|
|
179
|
+
name: 'Go Format',
|
|
180
|
+
phase: 'format',
|
|
181
|
+
applies(ctx) {
|
|
182
|
+
return ctx.config.go?.enabled !== false && ctx.languages.includes('go');
|
|
183
|
+
},
|
|
184
|
+
async run(ctx) {
|
|
185
|
+
const targets = await (0, targets_js_1.resolveTargets)(ctx, GO_GLOBS, {
|
|
186
|
+
onEmpty: { pass: 'no Go files changed' },
|
|
187
|
+
});
|
|
188
|
+
if (!Array.isArray(targets))
|
|
189
|
+
return targets;
|
|
190
|
+
const viaSystem = await formatWithSystemGofmt(ctx, targets);
|
|
191
|
+
if (viaSystem)
|
|
192
|
+
return viaSystem;
|
|
193
|
+
const format = await loadBundledGofmt();
|
|
194
|
+
// Neither route: no Go toolchain on the runner AND our own copy could not be
|
|
195
|
+
// loaded, which means a partial install of this package. Installing Go is
|
|
196
|
+
// the fix a client can actually act on.
|
|
197
|
+
if (!format)
|
|
198
|
+
return (0, tool_install_js_1.notInstalled)('gofmt', 'gofmt');
|
|
199
|
+
index_js_1.logger.debug('[Go Format]: no system gofmt — using the bundled WASM formatter');
|
|
200
|
+
return formatWithBundledGofmt(ctx, targets, format);
|
|
201
|
+
},
|
|
202
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lintCheck = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
4
|
+
const index_js_1 = require("../../../config/index.js");
|
|
5
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
6
|
+
const index_js_2 = require("../../../utils/index.js");
|
|
7
|
+
const reuse_js_1 = require("../../install/reuse.js");
|
|
8
|
+
const targets_js_1 = require("../../targets.js");
|
|
9
|
+
const types_js_1 = require("../../types.js");
|
|
10
10
|
/**
|
|
11
11
|
* Resolve the ESLint binary under the client's `install.reuseLocal` policy.
|
|
12
12
|
*
|
|
@@ -18,13 +18,13 @@ const types_1 = require("../../types");
|
|
|
18
18
|
* `clientOwnsConfig` exists (ticket 064, lever A).
|
|
19
19
|
*/
|
|
20
20
|
function resolveESLintBin(ctx, clientOwnsConfig) {
|
|
21
|
-
return (0,
|
|
22
|
-
paths: (0,
|
|
21
|
+
return (0, index_js_2.resolvePackageBin)('eslint', 'bin/eslint.js', {
|
|
22
|
+
paths: (0, reuse_js_1.clientToolPaths)('eslint', ctx, { clientOwnsConfig }),
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
async function getESLintMajorVersion(eslintBin) {
|
|
26
26
|
try {
|
|
27
|
-
const { stdout } = await (0,
|
|
27
|
+
const { stdout } = await (0, execa_js_1.execa)(process.execPath, [eslintBin, '--version']);
|
|
28
28
|
const match = stdout.match(/v?(\d+)\./);
|
|
29
29
|
return match ? parseInt(match[1], 10) : 8;
|
|
30
30
|
}
|
|
@@ -39,15 +39,15 @@ exports.lintCheck = {
|
|
|
39
39
|
return ctx.languages.includes('typescript') || ctx.languages.includes('javascript');
|
|
40
40
|
},
|
|
41
41
|
async run(ctx) {
|
|
42
|
-
const targets = await (0,
|
|
42
|
+
const targets = await (0, targets_js_1.resolveScopedTargetFiles)(ctx, ['*.ts', '*.tsx', '*.js', '*.jsx'], (0, index_js_1.getSourcePaths)(ctx.cwd));
|
|
43
43
|
if (targets === null)
|
|
44
|
-
return (0,
|
|
44
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
45
45
|
if (targets.length === 0)
|
|
46
|
-
return (0,
|
|
46
|
+
return (0, types_js_1.pass)('no TypeScript/JavaScript files to lint');
|
|
47
47
|
// Whose config decides whose binary, so this is read BEFORE resolving one.
|
|
48
48
|
// It used to be the other way round, which is how a client's ESLint 8 ended
|
|
49
49
|
// up pointed at the flat config we generate.
|
|
50
|
-
const hasLocal = (0,
|
|
50
|
+
const hasLocal = (0, index_js_1.hasLocalConfig)(['eslint.config.mjs', 'eslint.config.js', '.eslintrc.js', '.eslintrc.json', '.eslintrc'], ctx.cwd);
|
|
51
51
|
const eslintBin = resolveESLintBin(ctx, hasLocal);
|
|
52
52
|
const version = await getESLintMajorVersion(eslintBin);
|
|
53
53
|
const args = [...targets];
|
|
@@ -68,28 +68,28 @@ exports.lintCheck = {
|
|
|
68
68
|
if (ctx.write)
|
|
69
69
|
args.push('--fix');
|
|
70
70
|
if (hasLocal) {
|
|
71
|
-
|
|
71
|
+
index_js_2.logger.info(`[ESLint]: Using local config (${targets.length} file(s))`);
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
74
|
const configFile = version >= 9 ? 'eslint.config.mjs' : '.eslintrc.js';
|
|
75
|
-
args.push('--config', (0,
|
|
76
|
-
|
|
75
|
+
args.push('--config', (0, index_js_1.getPackageConfigPath)(configFile));
|
|
76
|
+
index_js_2.logger.info(`[ESLint]: Using pr-checkmate config (ESLint v${version}, ${configFile})`);
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
const result = await (0,
|
|
78
|
+
index_js_1.IGNORE_PATTERNS.forEach(p => args.push('--ignore-pattern', p));
|
|
79
|
+
const result = await (0, execa_js_1.execa)(process.execPath, [eslintBin, ...args], {
|
|
80
80
|
cwd: ctx.cwd,
|
|
81
81
|
stdio: 'inherit',
|
|
82
82
|
reject: false,
|
|
83
83
|
});
|
|
84
84
|
if (result.exitCode === 0)
|
|
85
|
-
return (0,
|
|
85
|
+
return (0, types_js_1.pass)();
|
|
86
86
|
// ESLint exits 1 for lint errors and 2 for a fatal error — a config it cannot
|
|
87
87
|
// load, an unresolvable plugin, a parser it cannot construct. Only the
|
|
88
88
|
// former is the client's code. Treating exit 2 as "lint errors found" turned
|
|
89
89
|
// a config incompatibility (often between our bundled config and the client's
|
|
90
90
|
// toolchain) into a red gate on their PR, and named the wrong cause.
|
|
91
91
|
if (result.exitCode === 1)
|
|
92
|
-
return (0,
|
|
93
|
-
return (0,
|
|
92
|
+
return (0, types_js_1.fail)('lint errors found');
|
|
93
|
+
return (0, types_js_1.warn)(`eslint failed to run (exit ${result.exitCode ?? 'killed'})${hasLocal ? '' : ' — using the pr-checkmate config'}`);
|
|
94
94
|
},
|
|
95
95
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
2
|
export declare const prettierCheck: Check;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.prettierCheck = 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 index_js_1 = require("../../../config/index.js");
|
|
10
|
+
const execa_js_1 = require("../../../utils/execa.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
14
|
function loadUserPrettierConfig(cwd) {
|
|
15
15
|
const configPath = node_path_1.default.join(cwd, 'pr-checkmate.json');
|
|
16
16
|
if (!node_fs_1.default.existsSync(configPath))
|
|
@@ -19,12 +19,12 @@ function loadUserPrettierConfig(cwd) {
|
|
|
19
19
|
return JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8')).prettier?.rules || {};
|
|
20
20
|
}
|
|
21
21
|
catch (err) {
|
|
22
|
-
|
|
22
|
+
index_js_2.logger.warn(`[Prettier]: ⚠️ Failed to read prettier config: ${err}`);
|
|
23
23
|
return {};
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function createTempPrettierConfig(cwd) {
|
|
27
|
-
const defaultConfig = JSON.parse(node_fs_1.default.readFileSync((0,
|
|
27
|
+
const defaultConfig = JSON.parse(node_fs_1.default.readFileSync((0, index_js_1.getPackageConfigPath)('.prettierrc'), 'utf-8'));
|
|
28
28
|
const merged = { ...defaultConfig, ...loadUserPrettierConfig(cwd) };
|
|
29
29
|
const tempConfigPath = node_path_1.default.join(cwd, '.prettierrc.temp.json');
|
|
30
30
|
node_fs_1.default.writeFileSync(tempConfigPath, JSON.stringify(merged, null, 2));
|
|
@@ -32,7 +32,7 @@ function createTempPrettierConfig(cwd) {
|
|
|
32
32
|
}
|
|
33
33
|
function createTempIgnoreFile(cwd) {
|
|
34
34
|
const file = node_path_1.default.join(cwd, '.prettierignore.temp');
|
|
35
|
-
node_fs_1.default.writeFileSync(file,
|
|
35
|
+
node_fs_1.default.writeFileSync(file, index_js_1.IGNORE_PATTERNS.join('\n'), 'utf-8');
|
|
36
36
|
return file;
|
|
37
37
|
}
|
|
38
38
|
exports.prettierCheck = {
|
|
@@ -42,11 +42,11 @@ exports.prettierCheck = {
|
|
|
42
42
|
return ctx.languages.includes('typescript') || ctx.languages.includes('javascript');
|
|
43
43
|
},
|
|
44
44
|
async run(ctx) {
|
|
45
|
-
const targets = await (0,
|
|
45
|
+
const targets = await (0, targets_js_1.resolveScopedTargetFiles)(ctx, ['*.ts', '*.tsx', '*.js', '*.jsx', '*.json', '*.md'], (0, index_js_1.getSourcePaths)(ctx.cwd));
|
|
46
46
|
if (targets === null)
|
|
47
|
-
return (0,
|
|
47
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
48
48
|
if (targets.length === 0)
|
|
49
|
-
return (0,
|
|
49
|
+
return (0, types_js_1.pass)('no files to format');
|
|
50
50
|
const projectIgnore = node_path_1.default.join(ctx.cwd, '.prettierignore');
|
|
51
51
|
const gitignore = node_path_1.default.join(ctx.cwd, '.gitignore');
|
|
52
52
|
let tempIgnore = null;
|
|
@@ -57,7 +57,7 @@ exports.prettierCheck = {
|
|
|
57
57
|
ignorePath = gitignore;
|
|
58
58
|
else
|
|
59
59
|
ignorePath = tempIgnore = createTempIgnoreFile(ctx.cwd);
|
|
60
|
-
const hasLocal = (0,
|
|
60
|
+
const hasLocal = (0, index_js_1.hasLocalConfig)(['.prettierrc', '.prettierrc.json', '.prettierrc.js', 'prettier.config.js'], ctx.cwd);
|
|
61
61
|
// write=true → format in place; write=false → report-only (`--check`, never mutates files).
|
|
62
62
|
const mode = ctx.write ? '--write' : '--check';
|
|
63
63
|
let tempConfig = null;
|
|
@@ -69,23 +69,23 @@ exports.prettierCheck = {
|
|
|
69
69
|
tempConfig = createTempPrettierConfig(ctx.cwd);
|
|
70
70
|
args = [mode, ...targets, '--config', tempConfig, '--ignore-path', ignorePath];
|
|
71
71
|
}
|
|
72
|
-
const prettierBin = (0,
|
|
72
|
+
const prettierBin = (0, index_js_2.resolvePackageBin)('prettier', 'bin/prettier.cjs');
|
|
73
73
|
try {
|
|
74
|
-
const result = await (0,
|
|
74
|
+
const result = await (0, execa_js_1.execa)(process.execPath, [prettierBin, ...args], {
|
|
75
75
|
cwd: ctx.cwd,
|
|
76
76
|
stdio: 'inherit',
|
|
77
77
|
reject: false,
|
|
78
78
|
});
|
|
79
79
|
if (result.exitCode === 0)
|
|
80
|
-
return (0,
|
|
80
|
+
return (0, types_js_1.pass)();
|
|
81
81
|
// In --check mode a non-zero exit means "some files are not formatted".
|
|
82
|
-
return (0,
|
|
82
|
+
return (0, types_js_1.warn)(ctx.write ? 'prettier failed' : 'unformatted files (run with write to fix)');
|
|
83
83
|
}
|
|
84
84
|
finally {
|
|
85
85
|
if (tempIgnore)
|
|
86
|
-
(0,
|
|
86
|
+
(0, index_js_2.cleanupTempFile)(tempIgnore);
|
|
87
87
|
if (tempConfig)
|
|
88
|
-
(0,
|
|
88
|
+
(0, index_js_2.cleanupTempFile)(tempConfig);
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
};
|