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.
Files changed (378) hide show
  1. package/dist/{cli.js → cjs/cli.js} +30 -30
  2. package/dist/{config → cjs/config}/index.d.ts +2 -2
  3. package/dist/{config → cjs/config}/index.js +8 -7
  4. package/dist/{config → cjs/config}/loader.d.ts +1 -1
  5. package/dist/{config → cjs/config}/loader.js +8 -8
  6. package/dist/{core → cjs/core}/checks/dependencies/banned-imports.d.ts +1 -1
  7. package/dist/{core → cjs/core}/checks/dependencies/banned-imports.js +10 -10
  8. package/dist/{core → cjs/core}/checks/dependencies/circular-deps.d.ts +1 -1
  9. package/dist/{core → cjs/core}/checks/dependencies/circular-deps.js +27 -27
  10. package/dist/{core → cjs/core}/checks/dependencies/dependency-check.d.ts +1 -1
  11. package/dist/{core → cjs/core}/checks/dependencies/dependency-check.js +17 -17
  12. package/dist/{core → cjs/core}/checks/dependencies/grype-scan.d.ts +1 -1
  13. package/dist/{core → cjs/core}/checks/dependencies/grype-scan.js +18 -18
  14. package/dist/{core → cjs/core}/checks/dependencies/license-check.d.ts +1 -1
  15. package/dist/{core → cjs/core}/checks/dependencies/license-check.js +12 -12
  16. package/dist/{core → cjs/core}/checks/dependencies/npm-audit.d.ts +1 -1
  17. package/dist/{core → cjs/core}/checks/dependencies/npm-audit.js +14 -14
  18. package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.d.ts +1 -1
  19. package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.js +14 -14
  20. package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.d.ts +1 -1
  21. package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.js +14 -14
  22. package/dist/{core → cjs/core}/checks/findings.d.ts +1 -1
  23. package/dist/{core → cjs/core}/checks/findings.js +16 -16
  24. package/dist/{core → cjs/core}/checks/git/custom-rules.d.ts +1 -1
  25. package/dist/{core → cjs/core}/checks/git/custom-rules.js +19 -19
  26. package/dist/{core → cjs/core}/checks/git/diff-smell.d.ts +2 -2
  27. package/dist/{core → cjs/core}/checks/git/diff-smell.js +13 -13
  28. package/dist/{core → cjs/core}/checks/git/large-files.d.ts +1 -1
  29. package/dist/{core → cjs/core}/checks/git/large-files.js +15 -15
  30. package/dist/{core → cjs/core}/checks/git/leftover-debug.d.ts +1 -1
  31. package/dist/{core → cjs/core}/checks/git/leftover-debug.js +13 -13
  32. package/dist/{core → cjs/core}/checks/git/lockfile-drift.d.ts +1 -1
  33. package/dist/{core → cjs/core}/checks/git/lockfile-drift.js +12 -12
  34. package/dist/{core → cjs/core}/checks/git/merge-conflict.d.ts +1 -1
  35. package/dist/{core → cjs/core}/checks/git/merge-conflict.js +15 -15
  36. package/dist/{core → cjs/core}/checks/git/missing-tests.d.ts +1 -1
  37. package/dist/{core → cjs/core}/checks/git/missing-tests.js +15 -15
  38. package/dist/{core → cjs/core}/checks/git/todo-fixme.d.ts +1 -1
  39. package/dist/{core → cjs/core}/checks/git/todo-fixme.js +11 -11
  40. package/dist/{core → cjs/core}/checks/languages/cpp-format.d.ts +1 -1
  41. package/dist/{core → cjs/core}/checks/languages/cpp-format.js +18 -18
  42. package/dist/{core → cjs/core}/checks/languages/external-checks.d.ts +9 -9
  43. package/dist/{core → cjs/core}/checks/languages/external-checks.js +10 -10
  44. package/dist/{core → cjs/core}/checks/languages/external-runner.d.ts +2 -2
  45. package/dist/{core → cjs/core}/checks/languages/external-runner.js +21 -21
  46. package/dist/{core → cjs/core}/checks/languages/go-format.d.ts +1 -1
  47. package/dist/cjs/core/checks/languages/go-format.js +202 -0
  48. package/dist/cjs/core/checks/languages/lint.d.ts +2 -0
  49. package/dist/{core → cjs/core}/checks/languages/lint.js +21 -21
  50. package/dist/{core → cjs/core}/checks/languages/prettier.d.ts +1 -1
  51. package/dist/{core → cjs/core}/checks/languages/prettier.js +18 -18
  52. package/dist/{core → cjs/core}/checks/languages/python-format.d.ts +1 -1
  53. package/dist/{core → cjs/core}/checks/languages/python-format.js +14 -14
  54. package/dist/{core → cjs/core}/checks/languages/python-lint.d.ts +1 -1
  55. package/dist/{core → cjs/core}/checks/languages/python-lint.js +13 -13
  56. package/dist/{core → cjs/core}/checks/languages/python-typecheck.d.ts +1 -1
  57. package/dist/{core → cjs/core}/checks/languages/python-typecheck.js +29 -29
  58. package/dist/{core → cjs/core}/checks/languages/typecheck.d.ts +1 -1
  59. package/dist/{core → cjs/core}/checks/languages/typecheck.js +13 -13
  60. package/dist/{core → cjs/core}/checks/pr/commitlint.d.ts +1 -1
  61. package/dist/{core → cjs/core}/checks/pr/commitlint.js +12 -12
  62. package/dist/{core → cjs/core}/checks/pr/pr-body.d.ts +1 -1
  63. package/dist/{core → cjs/core}/checks/pr/pr-body.js +8 -8
  64. package/dist/{core → cjs/core}/checks/pr/pr-size-check.d.ts +1 -1
  65. package/dist/{core → cjs/core}/checks/pr/pr-size-check.js +10 -10
  66. package/dist/{core → cjs/core}/checks/pr/pr-title-lint.d.ts +1 -1
  67. package/dist/{core → cjs/core}/checks/pr/pr-title-lint.js +8 -8
  68. package/dist/{core → cjs/core}/checks/quality/case-collision.d.ts +1 -1
  69. package/dist/{core → cjs/core}/checks/quality/case-collision.js +7 -7
  70. package/dist/{core → cjs/core}/checks/quality/config-validation.d.ts +1 -1
  71. package/dist/{core → cjs/core}/checks/quality/config-validation.js +9 -9
  72. package/dist/{core → cjs/core}/checks/quality/coverage.d.ts +1 -1
  73. package/dist/{core → cjs/core}/checks/quality/coverage.js +4 -4
  74. package/dist/{core → cjs/core}/checks/quality/dead-code.d.ts +1 -1
  75. package/dist/{core → cjs/core}/checks/quality/dead-code.js +23 -23
  76. package/dist/{core → cjs/core}/checks/quality/duplicate-check.d.ts +1 -1
  77. package/dist/{core → cjs/core}/checks/quality/duplicate-check.js +22 -22
  78. package/dist/{core → cjs/core}/checks/quality/license-header.d.ts +1 -1
  79. package/dist/{core → cjs/core}/checks/quality/license-header.js +16 -16
  80. package/dist/{core → cjs/core}/checks/quality/markdown-lint.d.ts +1 -1
  81. package/dist/{core → cjs/core}/checks/quality/markdown-lint.js +17 -17
  82. package/dist/{core → cjs/core}/checks/quality/package-size.d.ts +1 -1
  83. package/dist/{core → cjs/core}/checks/quality/package-size.js +12 -12
  84. package/dist/{core → cjs/core}/checks/quality/spellcheck.d.ts +2 -2
  85. package/dist/{core → cjs/core}/checks/quality/spellcheck.js +18 -18
  86. package/dist/{core → cjs/core}/checks/quality/symlinks.d.ts +1 -1
  87. package/dist/{core → cjs/core}/checks/quality/symlinks.js +8 -8
  88. package/dist/{core → cjs/core}/checks/quality/yaml-lint.d.ts +1 -1
  89. package/dist/{core → cjs/core}/checks/quality/yaml-lint.js +12 -12
  90. package/dist/{core → cjs/core}/checks/security/diff-security.d.ts +1 -1
  91. package/dist/{core → cjs/core}/checks/security/diff-security.js +15 -15
  92. package/dist/{core → cjs/core}/checks/security/dockerfile-security.d.ts +1 -1
  93. package/dist/{core → cjs/core}/checks/security/dockerfile-security.js +16 -16
  94. package/dist/{core → cjs/core}/checks/security/migration-safety.d.ts +1 -1
  95. package/dist/{core → cjs/core}/checks/security/migration-safety.js +17 -17
  96. package/dist/{core → cjs/core}/checks/security/security.d.ts +1 -1
  97. package/dist/{core → cjs/core}/checks/security/security.js +21 -21
  98. package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.d.ts +1 -1
  99. package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.js +14 -14
  100. package/dist/{core → cjs/core}/checks/security/workflow-security.d.ts +2 -2
  101. package/dist/{core → cjs/core}/checks/security/workflow-security.js +14 -14
  102. package/dist/{core → cjs/core}/checks/tool-install.d.ts +1 -1
  103. package/dist/{core → cjs/core}/checks/tool-install.js +2 -2
  104. package/dist/{core → cjs/core}/context.d.ts +1 -1
  105. package/dist/{core → cjs/core}/context.js +16 -16
  106. package/dist/cjs/core/index.d.ts +4 -0
  107. package/dist/{core → cjs/core}/index.js +7 -7
  108. package/dist/{core → cjs/core}/install/cache.js +2 -2
  109. package/dist/{core → cjs/core}/install/doctor.d.ts +4 -4
  110. package/dist/{core → cjs/core}/install/doctor.js +34 -34
  111. package/dist/{core → cjs/core}/install/ensure.d.ts +2 -2
  112. package/dist/{core → cjs/core}/install/ensure.js +15 -14
  113. package/dist/{core → cjs/core}/install/lock.js +4 -4
  114. package/dist/{core → cjs/core}/install/prepare.d.ts +4 -4
  115. package/dist/{core → cjs/core}/install/prepare.js +13 -13
  116. package/dist/{core → cjs/core}/install/profiles.d.ts +2 -2
  117. package/dist/{core → cjs/core}/install/reuse.d.ts +1 -1
  118. package/dist/{core → cjs/core}/install/reuse.js +4 -4
  119. package/dist/{core → cjs/core}/registry.d.ts +1 -1
  120. package/dist/cjs/core/registry.js +112 -0
  121. package/dist/{core → cjs/core}/reporters.d.ts +1 -1
  122. package/dist/{core → cjs/core}/reporters.js +28 -28
  123. package/dist/{core → cjs/core}/run-checks.d.ts +2 -2
  124. package/dist/{core → cjs/core}/run-checks.js +31 -31
  125. package/dist/{core → cjs/core}/targets.d.ts +1 -1
  126. package/dist/{core → cjs/core}/targets.js +20 -20
  127. package/dist/{core → cjs/core}/types.d.ts +3 -3
  128. package/dist/cjs/index.d.ts +12 -0
  129. package/dist/{index.js → cjs/index.js} +18 -18
  130. package/dist/{init.js → cjs/init.js} +68 -56
  131. package/dist/{interfaces → cjs/interfaces}/index.d.ts +3 -3
  132. package/dist/cjs/package.json +1 -0
  133. package/dist/{scripts → cjs/scripts}/copy-configs.js +22 -7
  134. package/dist/{scripts → cjs/scripts}/generate-install-manifests.js +2 -2
  135. package/dist/{scripts → cjs/scripts}/publish-github.js +4 -4
  136. package/dist/{utils → cjs/utils}/detect-language.js +12 -12
  137. package/dist/cjs/utils/execa.js +46 -0
  138. package/dist/{utils → cjs/utils}/git.js +2 -2
  139. package/dist/{utils → cjs/utils}/http.js +2 -2
  140. package/dist/cjs/utils/index.d.ts +15 -0
  141. package/dist/{utils → cjs/utils}/index.js +13 -13
  142. package/dist/{utils → cjs/utils}/own-deps.d.ts +2 -0
  143. package/dist/{utils → cjs/utils}/own-deps.js +1 -0
  144. package/dist/{utils → cjs/utils}/package-version.js +2 -1
  145. package/dist/{utils → cjs/utils}/resolve-bin.js +2 -1
  146. package/dist/{utils → cjs/utils}/update-notifier.js +4 -4
  147. package/dist/esm/cli.d.ts +2 -0
  148. package/dist/esm/cli.js +137 -0
  149. package/dist/esm/config/constants.d.ts +153 -0
  150. package/dist/esm/config/constants.js +360 -0
  151. package/dist/esm/config/index.d.ts +40 -0
  152. package/dist/esm/config/index.js +60 -0
  153. package/dist/esm/config/loader.d.ts +6 -0
  154. package/dist/esm/config/loader.js +191 -0
  155. package/dist/esm/config/pr-checkmate-workflow-docker.yml +79 -0
  156. package/dist/esm/config/pr-checkmate-workflow.yml +92 -0
  157. package/dist/esm/core/checks/dependencies/banned-imports.d.ts +2 -0
  158. package/dist/esm/core/checks/dependencies/banned-imports.js +70 -0
  159. package/dist/esm/core/checks/dependencies/circular-deps.d.ts +2 -0
  160. package/dist/esm/core/checks/dependencies/circular-deps.js +155 -0
  161. package/dist/esm/core/checks/dependencies/dependency-check.d.ts +43 -0
  162. package/dist/esm/core/checks/dependencies/dependency-check.js +174 -0
  163. package/dist/esm/core/checks/dependencies/grype-scan.d.ts +22 -0
  164. package/dist/esm/core/checks/dependencies/grype-scan.js +112 -0
  165. package/dist/esm/core/checks/dependencies/license-check.d.ts +2 -0
  166. package/dist/esm/core/checks/dependencies/license-check.js +61 -0
  167. package/dist/esm/core/checks/dependencies/npm-audit.d.ts +6 -0
  168. package/dist/esm/core/checks/dependencies/npm-audit.js +80 -0
  169. package/dist/esm/core/checks/dependencies/outdated-deps.d.ts +2 -0
  170. package/dist/esm/core/checks/dependencies/outdated-deps.js +66 -0
  171. package/dist/esm/core/checks/dependencies/vuln-scan.d.ts +2 -0
  172. package/dist/esm/core/checks/dependencies/vuln-scan.js +54 -0
  173. package/dist/esm/core/checks/findings.d.ts +299 -0
  174. package/dist/esm/core/checks/findings.js +701 -0
  175. package/dist/esm/core/checks/git/custom-rules.d.ts +2 -0
  176. package/dist/esm/core/checks/git/custom-rules.js +106 -0
  177. package/dist/esm/core/checks/git/diff-smell.d.ts +19 -0
  178. package/dist/esm/core/checks/git/diff-smell.js +69 -0
  179. package/dist/esm/core/checks/git/large-files.d.ts +2 -0
  180. package/dist/esm/core/checks/git/large-files.js +112 -0
  181. package/dist/esm/core/checks/git/leftover-debug.d.ts +2 -0
  182. package/dist/esm/core/checks/git/leftover-debug.js +89 -0
  183. package/dist/esm/core/checks/git/lockfile-drift.d.ts +2 -0
  184. package/dist/esm/core/checks/git/lockfile-drift.js +114 -0
  185. package/dist/esm/core/checks/git/merge-conflict.d.ts +2 -0
  186. package/dist/esm/core/checks/git/merge-conflict.js +117 -0
  187. package/dist/esm/core/checks/git/missing-tests.d.ts +2 -0
  188. package/dist/esm/core/checks/git/missing-tests.js +105 -0
  189. package/dist/esm/core/checks/git/todo-fixme.d.ts +7 -0
  190. package/dist/esm/core/checks/git/todo-fixme.js +80 -0
  191. package/dist/esm/core/checks/languages/cpp-format.d.ts +7 -0
  192. package/dist/esm/core/checks/languages/cpp-format.js +91 -0
  193. package/dist/esm/core/checks/languages/external-checks.d.ts +77 -0
  194. package/dist/esm/core/checks/languages/external-checks.js +197 -0
  195. package/dist/esm/core/checks/languages/external-runner.d.ts +119 -0
  196. package/dist/esm/core/checks/languages/external-runner.js +138 -0
  197. package/dist/esm/core/checks/languages/go-format.d.ts +8 -0
  198. package/dist/{core → esm/core}/checks/languages/go-format.js +29 -35
  199. package/dist/esm/core/checks/languages/lint.d.ts +2 -0
  200. package/dist/esm/core/checks/languages/lint.js +92 -0
  201. package/dist/esm/core/checks/languages/prettier.d.ts +2 -0
  202. package/dist/esm/core/checks/languages/prettier.js +85 -0
  203. package/dist/esm/core/checks/languages/python-format.d.ts +7 -0
  204. package/dist/esm/core/checks/languages/python-format.js +61 -0
  205. package/dist/esm/core/checks/languages/python-lint.d.ts +9 -0
  206. package/dist/esm/core/checks/languages/python-lint.js +55 -0
  207. package/dist/esm/core/checks/languages/python-typecheck.d.ts +14 -0
  208. package/dist/esm/core/checks/languages/python-typecheck.js +184 -0
  209. package/dist/esm/core/checks/languages/ruff-shared.d.ts +10 -0
  210. package/dist/esm/core/checks/languages/ruff-shared.js +35 -0
  211. package/dist/esm/core/checks/languages/typecheck.d.ts +2 -0
  212. package/dist/esm/core/checks/languages/typecheck.js +61 -0
  213. package/dist/esm/core/checks/pr/commitlint.d.ts +2 -0
  214. package/dist/esm/core/checks/pr/commitlint.js +102 -0
  215. package/dist/esm/core/checks/pr/pr-body.d.ts +2 -0
  216. package/dist/esm/core/checks/pr/pr-body.js +43 -0
  217. package/dist/esm/core/checks/pr/pr-size-check.d.ts +2 -0
  218. package/dist/esm/core/checks/pr/pr-size-check.js +42 -0
  219. package/dist/esm/core/checks/pr/pr-title-lint.d.ts +2 -0
  220. package/dist/esm/core/checks/pr/pr-title-lint.js +31 -0
  221. package/dist/esm/core/checks/quality/case-collision.d.ts +8 -0
  222. package/dist/esm/core/checks/quality/case-collision.js +39 -0
  223. package/dist/esm/core/checks/quality/config-validation.d.ts +11 -0
  224. package/dist/esm/core/checks/quality/config-validation.js +188 -0
  225. package/dist/esm/core/checks/quality/coverage.d.ts +2 -0
  226. package/dist/esm/core/checks/quality/coverage.js +62 -0
  227. package/dist/esm/core/checks/quality/dead-code.d.ts +2 -0
  228. package/dist/esm/core/checks/quality/dead-code.js +124 -0
  229. package/dist/esm/core/checks/quality/duplicate-check.d.ts +2 -0
  230. package/dist/esm/core/checks/quality/duplicate-check.js +141 -0
  231. package/dist/esm/core/checks/quality/license-header.d.ts +7 -0
  232. package/dist/esm/core/checks/quality/license-header.js +81 -0
  233. package/dist/esm/core/checks/quality/markdown-lint.d.ts +2 -0
  234. package/dist/esm/core/checks/quality/markdown-lint.js +104 -0
  235. package/dist/esm/core/checks/quality/package-size.d.ts +36 -0
  236. package/dist/esm/core/checks/quality/package-size.js +196 -0
  237. package/dist/esm/core/checks/quality/spellcheck.d.ts +77 -0
  238. package/dist/esm/core/checks/quality/spellcheck.js +296 -0
  239. package/dist/esm/core/checks/quality/symlinks.d.ts +16 -0
  240. package/dist/esm/core/checks/quality/symlinks.js +57 -0
  241. package/dist/esm/core/checks/quality/yaml-lint.d.ts +20 -0
  242. package/dist/esm/core/checks/quality/yaml-lint.js +116 -0
  243. package/dist/esm/core/checks/security/diff-security.d.ts +2 -0
  244. package/dist/esm/core/checks/security/diff-security.js +354 -0
  245. package/dist/esm/core/checks/security/dockerfile-security.d.ts +2 -0
  246. package/dist/esm/core/checks/security/dockerfile-security.js +98 -0
  247. package/dist/esm/core/checks/security/migration-safety.d.ts +2 -0
  248. package/dist/esm/core/checks/security/migration-safety.js +137 -0
  249. package/dist/esm/core/checks/security/security.d.ts +63 -0
  250. package/dist/esm/core/checks/security/security.js +201 -0
  251. package/dist/esm/core/checks/security/sensitive-file-guard.d.ts +2 -0
  252. package/dist/esm/core/checks/security/sensitive-file-guard.js +160 -0
  253. package/dist/esm/core/checks/security/workflow-security.d.ts +12 -0
  254. package/dist/esm/core/checks/security/workflow-security.js +100 -0
  255. package/dist/esm/core/checks/tool-install.d.ts +102 -0
  256. package/dist/esm/core/checks/tool-install.js +66 -0
  257. package/dist/esm/core/commands.d.ts +27 -0
  258. package/dist/esm/core/commands.js +89 -0
  259. package/dist/esm/core/context.d.ts +62 -0
  260. package/dist/esm/core/context.js +241 -0
  261. package/dist/esm/core/index.d.ts +4 -0
  262. package/dist/esm/core/index.js +4 -0
  263. package/dist/esm/core/install/cache.d.ts +58 -0
  264. package/dist/esm/core/install/cache.js +142 -0
  265. package/dist/esm/core/install/doctor.d.ts +35 -0
  266. package/dist/esm/core/install/doctor.js +164 -0
  267. package/dist/esm/core/install/ensure.d.ts +77 -0
  268. package/dist/esm/core/install/ensure.js +269 -0
  269. package/dist/esm/core/install/lock.d.ts +34 -0
  270. package/dist/esm/core/install/lock.js +92 -0
  271. package/dist/esm/core/install/merge.d.ts +47 -0
  272. package/dist/esm/core/install/merge.js +85 -0
  273. package/dist/esm/core/install/prepare.d.ts +76 -0
  274. package/dist/esm/core/install/prepare.js +142 -0
  275. package/dist/esm/core/install/profiles.d.ts +78 -0
  276. package/dist/esm/core/install/profiles.js +192 -0
  277. package/dist/esm/core/install/reuse.d.ts +41 -0
  278. package/dist/esm/core/install/reuse.js +100 -0
  279. package/dist/esm/core/registry.d.ts +6 -0
  280. package/dist/esm/core/registry.js +109 -0
  281. package/dist/esm/core/reporters.d.ts +18 -0
  282. package/dist/esm/core/reporters.js +266 -0
  283. package/dist/esm/core/run-checks.d.ts +33 -0
  284. package/dist/esm/core/run-checks.js +293 -0
  285. package/dist/esm/core/targets.d.ts +140 -0
  286. package/dist/esm/core/targets.js +213 -0
  287. package/dist/esm/core/types.d.ts +195 -0
  288. package/dist/esm/core/types.js +38 -0
  289. package/dist/esm/index.d.ts +12 -0
  290. package/dist/esm/index.js +15 -0
  291. package/dist/esm/init.d.ts +38 -0
  292. package/dist/esm/init.js +421 -0
  293. package/dist/esm/interfaces/index.d.ts +432 -0
  294. package/dist/esm/interfaces/index.js +2 -0
  295. package/dist/esm/package.json +1 -0
  296. package/dist/esm/scripts/copy-configs.d.ts +1 -0
  297. package/dist/esm/scripts/copy-configs.js +64 -0
  298. package/dist/esm/scripts/generate-install-manifests.d.ts +39 -0
  299. package/dist/esm/scripts/generate-install-manifests.js +115 -0
  300. package/dist/esm/scripts/publish-github.d.ts +1 -0
  301. package/dist/esm/scripts/publish-github.js +45 -0
  302. package/dist/esm/utils/ci.d.ts +11 -0
  303. package/dist/esm/utils/ci.js +40 -0
  304. package/dist/esm/utils/detect-language.d.ts +48 -0
  305. package/dist/esm/utils/detect-language.js +234 -0
  306. package/dist/esm/utils/direct-deps.d.ts +21 -0
  307. package/dist/esm/utils/direct-deps.js +220 -0
  308. package/dist/esm/utils/execa.d.ts +22 -0
  309. package/dist/{utils → esm/utils}/execa.js +1 -4
  310. package/dist/esm/utils/git.d.ts +14 -0
  311. package/dist/esm/utils/git.js +21 -0
  312. package/dist/esm/utils/glob.d.ts +24 -0
  313. package/dist/esm/utils/glob.js +40 -0
  314. package/dist/esm/utils/http.d.ts +59 -0
  315. package/dist/esm/utils/http.js +115 -0
  316. package/dist/esm/utils/index.d.ts +15 -0
  317. package/dist/esm/utils/index.js +26 -0
  318. package/dist/esm/utils/logger.d.ts +65 -0
  319. package/dist/esm/utils/logger.js +157 -0
  320. package/dist/esm/utils/own-deps.d.ts +16 -0
  321. package/dist/esm/utils/own-deps.js +107 -0
  322. package/dist/esm/utils/package-version.d.ts +4 -0
  323. package/dist/esm/utils/package-version.js +38 -0
  324. package/dist/esm/utils/pool.d.ts +49 -0
  325. package/dist/esm/utils/pool.js +113 -0
  326. package/dist/esm/utils/resolve-bin.d.ts +67 -0
  327. package/dist/esm/utils/resolve-bin.js +156 -0
  328. package/dist/esm/utils/result-collector.d.ts +33 -0
  329. package/dist/esm/utils/result-collector.js +44 -0
  330. package/dist/esm/utils/update-notifier.d.ts +19 -0
  331. package/dist/esm/utils/update-notifier.js +108 -0
  332. package/install-manifests/core/package-lock.json +4 -4
  333. package/install-manifests/core/package.json +1 -1
  334. package/package.json +15 -13
  335. package/dist/core/checks/languages/lint.d.ts +0 -2
  336. package/dist/core/index.d.ts +0 -4
  337. package/dist/core/registry.js +0 -112
  338. package/dist/index.d.ts +0 -12
  339. package/dist/utils/index.d.ts +0 -15
  340. /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
  341. /package/dist/{config → cjs/config}/constants.d.ts +0 -0
  342. /package/dist/{config → cjs/config}/constants.js +0 -0
  343. /package/dist/{config → cjs/config}/pr-checkmate-workflow-docker.yml +0 -0
  344. /package/dist/{config → cjs/config}/pr-checkmate-workflow.yml +0 -0
  345. /package/dist/{core → cjs/core}/checks/languages/ruff-shared.d.ts +0 -0
  346. /package/dist/{core → cjs/core}/checks/languages/ruff-shared.js +0 -0
  347. /package/dist/{core → cjs/core}/commands.d.ts +0 -0
  348. /package/dist/{core → cjs/core}/commands.js +0 -0
  349. /package/dist/{core → cjs/core}/install/cache.d.ts +0 -0
  350. /package/dist/{core → cjs/core}/install/lock.d.ts +0 -0
  351. /package/dist/{core → cjs/core}/install/merge.d.ts +0 -0
  352. /package/dist/{core → cjs/core}/install/merge.js +0 -0
  353. /package/dist/{core → cjs/core}/install/profiles.js +0 -0
  354. /package/dist/{core → cjs/core}/types.js +0 -0
  355. /package/dist/{init.d.ts → cjs/init.d.ts} +0 -0
  356. /package/dist/{interfaces → cjs/interfaces}/index.js +0 -0
  357. /package/dist/{scripts → cjs/scripts}/copy-configs.d.ts +0 -0
  358. /package/dist/{scripts → cjs/scripts}/generate-install-manifests.d.ts +0 -0
  359. /package/dist/{scripts → cjs/scripts}/publish-github.d.ts +0 -0
  360. /package/dist/{utils → cjs/utils}/ci.d.ts +0 -0
  361. /package/dist/{utils → cjs/utils}/ci.js +0 -0
  362. /package/dist/{utils → cjs/utils}/detect-language.d.ts +0 -0
  363. /package/dist/{utils → cjs/utils}/direct-deps.d.ts +0 -0
  364. /package/dist/{utils → cjs/utils}/direct-deps.js +0 -0
  365. /package/dist/{utils → cjs/utils}/execa.d.ts +0 -0
  366. /package/dist/{utils → cjs/utils}/git.d.ts +0 -0
  367. /package/dist/{utils → cjs/utils}/glob.d.ts +0 -0
  368. /package/dist/{utils → cjs/utils}/glob.js +0 -0
  369. /package/dist/{utils → cjs/utils}/http.d.ts +0 -0
  370. /package/dist/{utils → cjs/utils}/logger.d.ts +0 -0
  371. /package/dist/{utils → cjs/utils}/logger.js +0 -0
  372. /package/dist/{utils → cjs/utils}/package-version.d.ts +0 -0
  373. /package/dist/{utils → cjs/utils}/pool.d.ts +0 -0
  374. /package/dist/{utils → cjs/utils}/pool.js +0 -0
  375. /package/dist/{utils → cjs/utils}/resolve-bin.d.ts +0 -0
  376. /package/dist/{utils → cjs/utils}/result-collector.d.ts +0 -0
  377. /package/dist/{utils → cjs/utils}/result-collector.js +0 -0
  378. /package/dist/{utils → cjs/utils}/update-notifier.d.ts +0 -0
@@ -0,0 +1,105 @@
1
+ import { getSourcePaths } from '../../../config/index.js';
2
+ import { execa } from '../../../utils/execa.js';
3
+ import { logger, matchesAnyGlob } from '../../../utils/index.js';
4
+ import { resolveScopedTargetFiles } from '../../targets.js';
5
+ import { pass, skip } from '../../types.js';
6
+ import { severityEmitter } from '../findings.js';
7
+ /** Source-file extensions across the supported languages. */
8
+ const SOURCE_EXT = /\.(ts|tsx|js|jsx|mjs|cjs|py|kt|kts|java|swift|cpp|cc|cxx|c|h|hpp|go|rb)$/i;
9
+ /** Test-file conventions across languages. */
10
+ function isTestFile(file) {
11
+ return (/\.(test|spec)\.[cm]?[jt]sx?$/i.test(file) || // foo.test.ts, foo.spec.jsx
12
+ /(^|\/)__tests__\//.test(file) ||
13
+ /(^|\/)tests?\//i.test(file) || // test/ or tests/ dir
14
+ /(^|\/)test_[^/]+\.py$/.test(file) || // test_foo.py
15
+ /_test\.(py|go)$/.test(file) || // foo_test.py, foo_test.go
16
+ /(Test|Spec)s?\.(kt|java|swift)$/.test(file) // FooTest.kt, FooSpec.swift
17
+ );
18
+ }
19
+ /**
20
+ * Source files that legitimately ship without a test of their own. Setting
21
+ * `missingTests.ignore` REPLACES this list (same convention as duplicate/
22
+ * dead-code ignores).
23
+ */
24
+ const DEFAULT_IGNORE = [
25
+ '**/*.d.ts',
26
+ '**/index.ts',
27
+ '**/index.tsx',
28
+ '**/index.js',
29
+ '**/index.jsx',
30
+ '**/*.config.*',
31
+ '**/migrations/**',
32
+ '**/migrate/**',
33
+ '**/__init__.py',
34
+ ];
35
+ export const missingTestsCheck = {
36
+ name: 'Missing Tests',
37
+ phase: 'informational',
38
+ requiresDiff: true,
39
+ applies(ctx) {
40
+ return ctx.config.missingTests?.enabled !== false;
41
+ },
42
+ async run(ctx) {
43
+ // Scope the same way lint does — a client's `sourcePath` and `ignoreDirs`
44
+ // both apply, so generated/out-of-scope dirs never count as "new source".
45
+ const scopedList = await resolveScopedTargetFiles(ctx, ['*'], getSourcePaths(ctx.cwd));
46
+ if (scopedList === null)
47
+ return skip('git unavailable');
48
+ const scoped = new Set(scopedList);
49
+ const added = [];
50
+ const touched = [];
51
+ try {
52
+ const { stdout } = await execa('git', [
53
+ 'diff',
54
+ '--name-status',
55
+ '--diff-filter=ACM',
56
+ ctx.baseSha,
57
+ ctx.headSha ?? 'HEAD',
58
+ ], { cwd: ctx.cwd });
59
+ for (const line of stdout.split('\n')) {
60
+ if (!line)
61
+ continue;
62
+ const [status, ...rest] = line.split('\t');
63
+ const file = rest.join('\t');
64
+ if (!file)
65
+ continue;
66
+ // The two halves are scoped differently on purpose.
67
+ //
68
+ // What counts as *new source needing a test* stays inside `sourcePath`,
69
+ // so generated or out-of-scope directories never raise the question.
70
+ //
71
+ // What counts as *evidence a test was written* must not: tests
72
+ // conventionally live OUTSIDE the source directory — `tests/`,
73
+ // `__tests__/`, `spec/` at the repository root. Scoping this side too
74
+ // made the check unsatisfiable in the most ordinary layout there is
75
+ // (`sourcePath: "src"` with tests in `tests/`): no test change was ever
76
+ // visible, so the warning fired on every run however many tests were
77
+ // added with the code. A check that cannot be satisfied teaches people
78
+ // to ignore it, which costs more than the check is worth.
79
+ if (isTestFile(file))
80
+ touched.push(file);
81
+ if (status === 'A' && scoped.has(file))
82
+ added.push(file);
83
+ }
84
+ }
85
+ catch (err) {
86
+ logger.warn(`[Missing Tests]: ⚠️ Could not analyze diff\n${err}`);
87
+ return skip('diff unavailable');
88
+ }
89
+ const ignore = ctx.config.missingTests?.ignore ?? DEFAULT_IGNORE;
90
+ const addedSource = added.filter(f => SOURCE_EXT.test(f) && !isTestFile(f) && !matchesAnyGlob(f, ignore));
91
+ if (addedSource.length === 0)
92
+ return pass(); // no new source that would need a test
93
+ // A test added or modified anywhere in the diff satisfies the check —
94
+ // `touched` only ever holds test files, collected without the source scope.
95
+ if (touched.length > 0)
96
+ return pass();
97
+ const sev = severityEmitter(ctx.config.missingTests?.severity, 'warn');
98
+ addedSource
99
+ .slice(0, 5)
100
+ .forEach(f => sev.log(`[Missing Tests]: ${sev.icon} new source without tests: ${f}`));
101
+ if (addedSource.length > 5)
102
+ sev.log(`[Missing Tests]: ${sev.icon} ... and ${addedSource.length - 5} more`);
103
+ return sev.emit(`${addedSource.length} new source file(s) added without any test changes`);
104
+ },
105
+ };
@@ -0,0 +1,7 @@
1
+ import { Check } from '../../types.js';
2
+ /**
3
+ * Flags leftover TODO/FIXME/XXX/HACK markers in Python and Kotlin/Java comments.
4
+ * JS/TS markers are already handled by the Diff Smells check, so this stays out
5
+ * of those globs to avoid double-reporting (same split as Leftover Debug).
6
+ */
7
+ export declare const todoFixmeCheck: Check;
@@ -0,0 +1,80 @@
1
+ import { logger } from '../../../utils/index.js';
2
+ import { pass, skip } from '../../types.js';
3
+ import { bucketTotal, reportCountedFindings, reviewLines } from '../findings.js';
4
+ const DEFAULT_KEYWORDS = ['TODO', 'FIXME', 'XXX', 'HACK'];
5
+ /** A ticket reference in the comment: `#123` or JIRA-style `PROJ-456`. */
6
+ const TICKET_PATTERN = /#\d+|[A-Z][A-Z0-9]+-\d+/;
7
+ /**
8
+ * Build an added-line matcher for a comment style. `commentFragment` is a regex
9
+ * alternation of the language's comment openers (`#` for Python; `//`/`/*` for
10
+ * Kotlin/Java). Keywords are escaped and captured so the finding is labelled.
11
+ */
12
+ function buildPattern(commentFragment, keywords) {
13
+ const kw = keywords.map(k => k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
14
+ return new RegExp(`^\\+.*(?:${commentFragment})\\s*(${kw})\\b`, 'i');
15
+ }
16
+ /** Bucket matching added lines by keyword, honouring opt-out and requireTicket. */
17
+ function scan(stdout, pattern, requireTicket, findings) {
18
+ for (const line of stdout.split('\n')) {
19
+ if (line.includes('pr-checkmate-ignore'))
20
+ continue;
21
+ const match = pattern.exec(line);
22
+ if (!match)
23
+ continue;
24
+ // With requireTicket, a marker that already links a ticket is acceptable.
25
+ if (requireTicket && TICKET_PATTERN.test(line))
26
+ continue;
27
+ const keyword = match[1].toUpperCase();
28
+ (findings[keyword] ?? (findings[keyword] = [])).push(line.slice(1).trim().substring(0, 100));
29
+ }
30
+ }
31
+ /**
32
+ * Flags leftover TODO/FIXME/XXX/HACK markers in Python and Kotlin/Java comments.
33
+ * JS/TS markers are already handled by the Diff Smells check, so this stays out
34
+ * of those globs to avoid double-reporting (same split as Leftover Debug).
35
+ */
36
+ export const todoFixmeCheck = {
37
+ name: 'TODO/FIXME',
38
+ phase: 'informational',
39
+ // No `requiresDiff`: an untracked TODO is untracked regardless of its age
40
+ // (ticket 067). On a legacy codebase this is exactly the inventory question.
41
+ applies(ctx) {
42
+ return (ctx.config.todoFixme?.enabled !== false &&
43
+ (ctx.languages.includes('python') || ctx.languages.includes('kotlin')));
44
+ },
45
+ async run(ctx) {
46
+ try {
47
+ const cfg = ctx.config.todoFixme;
48
+ const keywords = cfg?.keywords ?? DEFAULT_KEYWORDS;
49
+ const requireTicket = cfg?.requireTicket ?? false;
50
+ const findings = {};
51
+ // One failed language set fails the check: a partial answer reported as a
52
+ // pass says the repository is clean when half of it was never read (072).
53
+ let reviewed = true;
54
+ if (ctx.languages.includes('python')) {
55
+ const pattern = buildPattern('#', keywords);
56
+ reviewed =
57
+ (await reviewLines(ctx, ['*.py'], out => scan(out, pattern, requireTicket, findings))) &&
58
+ reviewed;
59
+ }
60
+ if (ctx.languages.includes('kotlin')) {
61
+ const ktPattern = buildPattern('//|/\\*', keywords);
62
+ reviewed =
63
+ (await reviewLines(ctx, ['*.kt', '*.kts', '*.java'], out => scan(out, ktPattern, requireTicket, findings))) && reviewed;
64
+ }
65
+ if (!reviewed)
66
+ return skip('git unavailable');
67
+ if (bucketTotal(findings) === 0)
68
+ return pass();
69
+ return reportCountedFindings(findings, ctx, {
70
+ prefix: 'TODO/FIXME',
71
+ severity: cfg?.severity,
72
+ suffix: requireTicket ? ' (no ticket reference)' : '',
73
+ });
74
+ }
75
+ catch (err) {
76
+ logger.warn(`[TODO/FIXME]: ⚠️ Could not analyze diff\n${err}`);
77
+ return skip('diff unavailable');
78
+ }
79
+ },
80
+ };
@@ -0,0 +1,7 @@
1
+ import { Check } from '../../types.js';
2
+ /**
3
+ * Formats C/C++ code with clang-format, bundled as a self-contained WASM CLI
4
+ * (`@wasm-fmt/clang-format`) so it runs on a bare Node image with no system
5
+ * clang install. Read-only in check mode; rewrites files in place when `write`.
6
+ */
7
+ export declare const cppFormatCheck: Check;
@@ -0,0 +1,91 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { getSourcePaths } from '../../../config/index.js';
4
+ import { execa } from '../../../utils/execa.js';
5
+ import { logger, resolvePackageBin } from '../../../utils/index.js';
6
+ import { resolveScopedTargetFiles } from '../../targets.js';
7
+ import { pass, warn, skip } from '../../types.js';
8
+ /**
9
+ * C/C++ source & header extensions clang-format understands. `.h` is intentionally
10
+ * included even though it is ambiguous with C — clang-format handles both.
11
+ */
12
+ const CPP_GLOBS = ['*.c', '*.cc', '*.cpp', '*.cxx', '*.c++', '*.h', '*.hh', '*.hpp', '*.hxx'];
13
+ const DEFAULT_STYLE = 'LLVM';
14
+ /**
15
+ * Resolves the clang-format style argument. Prefers the project's own `.clang-format`
16
+ * (via `--style=file`) so pr-checkmate never overrides a repo's established rules;
17
+ * falls back to the configured style, then LLVM.
18
+ */
19
+ function resolveStyleArg(ctx) {
20
+ if (fs.existsSync(path.join(ctx.cwd, '.clang-format'))) {
21
+ return '--style=file';
22
+ }
23
+ const style = ctx.config.cpp?.clangFormat?.style ?? DEFAULT_STYLE;
24
+ return `--style=${style}`;
25
+ }
26
+ /** Counts distinct files flagged in clang-format's `--dry-run --Werror` diagnostics. */
27
+ function countOffendingFiles(stderr) {
28
+ const files = new Set();
29
+ for (const line of stderr.split('\n')) {
30
+ const match = line.match(/^(.+?):\d+:\d+: (?:error|warning):/);
31
+ if (match)
32
+ files.add(match[1]);
33
+ }
34
+ return files.size;
35
+ }
36
+ /**
37
+ * Formats C/C++ code with clang-format, bundled as a self-contained WASM CLI
38
+ * (`@wasm-fmt/clang-format`) so it runs on a bare Node image with no system
39
+ * clang install. Read-only in check mode; rewrites files in place when `write`.
40
+ */
41
+ export const cppFormatCheck = {
42
+ name: 'C++ Format',
43
+ phase: 'format',
44
+ applies(ctx) {
45
+ return ctx.config.cpp?.enabled !== false && ctx.languages.includes('cpp');
46
+ },
47
+ async run(ctx) {
48
+ // Through `targets.ts`, not `git` directly. This check used to run its own
49
+ // `git ls-files`, which is the one mistake the authoring guide exists to
50
+ // prevent: it inherits neither `ignoreDirs` nor `sourcePath`. On a real C++
51
+ // repository that meant 403 files including a vendored copy of OpenCV — and
52
+ // in `write` mode clang-format was rewriting third-party sources the client
53
+ // does not own. It also crashed the WASM formatter, which is how this was
54
+ // found.
55
+ const targets = await resolveScopedTargetFiles(ctx, CPP_GLOBS, getSourcePaths(ctx.cwd));
56
+ if (targets === null)
57
+ return skip('git unavailable');
58
+ if (targets.length === 0)
59
+ return pass('no C/C++ files changed');
60
+ const cfBin = resolvePackageBin('@wasm-fmt/clang-format', 'clang-format-cli.cjs');
61
+ const styleArg = resolveStyleArg(ctx);
62
+ // Detect unformatted files without mutating anything.
63
+ const dry = await execa(process.execPath, [cfBin, '--dry-run', '--Werror', styleArg, ...targets], { cwd: ctx.cwd, reject: false });
64
+ if (dry.exitCode === 0)
65
+ return pass();
66
+ const offending = countOffendingFiles(dry.stderr) || targets.length;
67
+ if (!ctx.write) {
68
+ logger.warn(`[C++ Format]: ⚠️ ${offending} C/C++ file(s) need formatting`);
69
+ return warn(`${offending} file(s) need formatting (run with write to fix)`);
70
+ }
71
+ // write mode: rewrite the offending files in place so CI can auto-commit them.
72
+ const fix = await execa(process.execPath, [cfBin, '-i', styleArg, ...targets], {
73
+ cwd: ctx.cwd,
74
+ reject: false,
75
+ });
76
+ if (fix.exitCode !== 0) {
77
+ logger.warn(`[C++ Format]: ⚠️ clang-format -i failed\n${fix.stderr}`);
78
+ // A WASM runtime error is the formatter giving up on a file, not a verdict
79
+ // about the code — and `-i` means whatever it managed before the crash is
80
+ // already written, so the tree is half-formatted. Saying which it was
81
+ // matters: "failed to rewrite files" sent people looking for a style
82
+ // problem that does not exist.
83
+ const crashed = /RuntimeError|memory access out of bounds|abort\(/.test(fix.stderr);
84
+ return warn(crashed
85
+ ? 'clang-format crashed on one of these files — some may already have been rewritten'
86
+ : `clang-format could not rewrite the files (exit ${fix.exitCode ?? 'killed'})`);
87
+ }
88
+ logger.info(`[C++ Format]: ✅ Reformatted ${offending} C/C++ file(s)`);
89
+ return pass(`reformatted ${offending} file(s)`);
90
+ },
91
+ };
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Every check that runs a linter or formatter we do not ship, as a table.
3
+ *
4
+ * The engine is in `external-runner.ts`; this file is only the data. What is
5
+ * genuinely per-language turns out to be four things — the binary, its
6
+ * arguments, the files it looks at, and how to read its output — and everything
7
+ * else was the same in all eleven of the modules this replaces.
8
+ *
9
+ * Keeping the entries together rather than one per file is the point: it is now
10
+ * possible to read what nine checks do at once, and a divergence between two of
11
+ * them is visible instead of two directories apart. Adding a tenth is an entry,
12
+ * not a file.
13
+ *
14
+ * The user-facing documentation stays per check, in
15
+ * `documentation/checks/languages/`, because that is organised around the reader's
16
+ * question ("how do I configure ktlint") rather than around ours.
17
+ */
18
+ /**
19
+ * Lints changed Kotlin files with ktlint (style and formatting both, so it
20
+ * doubles as the Kotlin format signal). Uses the repo's own `.editorconfig`
21
+ * when present.
22
+ */
23
+ export declare const kotlinLintCheck: import("../../types.js").Check;
24
+ /**
25
+ * Lints Swift with SwiftLint, which needs SourceKit and therefore a macOS
26
+ * runner. Runs over the directory rather than a file list — SwiftLint resolves
27
+ * its own `.swiftlint.yml` scope, and a file list would bypass the excludes a
28
+ * repo wrote there — so the resolved targets only decide whether it runs at all.
29
+ */
30
+ export declare const swiftLintCheck: import("../../types.js").Check;
31
+ /**
32
+ * Lints changed Ruby files with RuboCop, which covers layout as well as style,
33
+ * so it doubles as the Ruby format signal. Uses the repo's own `.rubocop.yml`
34
+ * when present.
35
+ */
36
+ export declare const rubyLintCheck: import("../../types.js").Check;
37
+ /**
38
+ * Lints changed shell scripts with ShellCheck. `-f gcc` gives one line per
39
+ * finding ending in an `[SC…]` code, which both a human and the count below can
40
+ * read directly.
41
+ *
42
+ * No language gate: shell is not something detection reports, and a `deploy.sh`
43
+ * in a Python repository is exactly the file this check exists for.
44
+ */
45
+ export declare const shellcheckCheck: import("../../types.js").Check;
46
+ /**
47
+ * Vets changed Go code with `go vet ./...`, which needs the Go toolchain (the
48
+ * formatter next door no longer does — see `go-format.ts`). `go vet` operates
49
+ * per package, so it runs over the module rather than a file list; the delta
50
+ * only decides whether it runs.
51
+ */
52
+ export declare const goLintCheck: import("../../types.js").Check;
53
+ /**
54
+ * Lints changed Rust with Clippy. It compiles the crate, so it runs over the
55
+ * crate rather than a file list; the delta only decides whether it runs.
56
+ */
57
+ export declare const rustLintCheck: import("../../types.js").Check;
58
+ /**
59
+ * Formats changed Rust with `cargo fmt`, not a bare `rustfmt`: cargo reads the
60
+ * crate's edition from `Cargo.toml`, and rustfmt invoked directly does not —
61
+ * which silently formats 2015-edition code by 2024 rules.
62
+ */
63
+ export declare const rustFormatCheck: import("../../types.js").Check;
64
+ /**
65
+ * Verifies C# formatting with `dotnet format`, which also runs the project's
66
+ * configured analyzers and style rules. It operates on the project or solution
67
+ * (and expects a prior `dotnet restore`), so it runs over the whole project; the
68
+ * delta only decides whether it runs.
69
+ */
70
+ export declare const csharpFormatCheck: import("../../types.js").Check;
71
+ /**
72
+ * Formats changed PHP with PHP-CS-Fixer, using the repo's own
73
+ * `.php-cs-fixer.php` when present. `--using-cache=no` because the cache keys on
74
+ * absolute paths, and a CI checkout directory that changes between runs makes a
75
+ * stale cache report files as clean that were never examined.
76
+ */
77
+ export declare const phpFormatCheck: import("../../types.js").Check;
@@ -0,0 +1,197 @@
1
+ import { defineExternalFormat, defineExternalLint } from './external-runner.js';
2
+ /**
3
+ * Every check that runs a linter or formatter we do not ship, as a table.
4
+ *
5
+ * The engine is in `external-runner.ts`; this file is only the data. What is
6
+ * genuinely per-language turns out to be four things — the binary, its
7
+ * arguments, the files it looks at, and how to read its output — and everything
8
+ * else was the same in all eleven of the modules this replaces.
9
+ *
10
+ * Keeping the entries together rather than one per file is the point: it is now
11
+ * possible to read what nine checks do at once, and a divergence between two of
12
+ * them is visible instead of two directories apart. Adding a tenth is an entry,
13
+ * not a file.
14
+ *
15
+ * The user-facing documentation stays per check, in
16
+ * `documentation/checks/languages/`, because that is organised around the reader's
17
+ * question ("how do I configure ktlint") rather than around ours.
18
+ */
19
+ // ── lint ────────────────────────────────────────────────────────────────────
20
+ /**
21
+ * Lints changed Kotlin files with ktlint (style and formatting both, so it
22
+ * doubles as the Kotlin format signal). Uses the repo's own `.editorconfig`
23
+ * when present.
24
+ */
25
+ export const kotlinLintCheck = defineExternalLint({
26
+ name: 'ktlint',
27
+ bin: 'ktlint',
28
+ tool: 'ktlint',
29
+ globs: ['*.kt', '*.kts'],
30
+ language: 'kotlin',
31
+ configKey: 'kotlin',
32
+ subject: 'Kotlin files',
33
+ args: (_ctx, targets) => ['--reporter=plain', ...targets],
34
+ });
35
+ /**
36
+ * Lints Swift with SwiftLint, which needs SourceKit and therefore a macOS
37
+ * runner. Runs over the directory rather than a file list — SwiftLint resolves
38
+ * its own `.swiftlint.yml` scope, and a file list would bypass the excludes a
39
+ * repo wrote there — so the resolved targets only decide whether it runs at all.
40
+ */
41
+ export const swiftLintCheck = defineExternalLint({
42
+ name: 'SwiftLint',
43
+ bin: 'swiftlint',
44
+ tool: 'swiftlint',
45
+ globs: ['*.swift'],
46
+ language: 'swift',
47
+ configKey: 'swift',
48
+ subject: 'Swift files',
49
+ args: ctx => ['lint', '--quiet', '--path', ctx.cwd],
50
+ // SwiftLint's plain output carries progress and summary lines too; only the
51
+ // diagnostics are findings, and the two levels are worth reporting apart.
52
+ keep: line => line.includes(': warning:') || line.includes(': error:'),
53
+ summary: lines => {
54
+ const errors = lines.filter(line => line.includes(': error:')).length;
55
+ return `${errors} error(s), ${lines.length - errors} warning(s)`;
56
+ },
57
+ });
58
+ /**
59
+ * Lints changed Ruby files with RuboCop, which covers layout as well as style,
60
+ * so it doubles as the Ruby format signal. Uses the repo's own `.rubocop.yml`
61
+ * when present.
62
+ */
63
+ export const rubyLintCheck = defineExternalLint({
64
+ name: 'RuboCop',
65
+ bin: 'rubocop',
66
+ tool: 'rubocop',
67
+ globs: ['*.rb', '*.rake'],
68
+ language: 'ruby',
69
+ configKey: 'ruby',
70
+ subject: 'Ruby files',
71
+ args: (_ctx, targets) => ['--format', 'simple', ...targets],
72
+ // RuboCop ends with its own count — "12 offenses detected" — which says more
73
+ // than a line tally of an output format that mixes offences and file headers.
74
+ summary: lines => lines.find(line => /offense/i.test(line))?.trim() ?? `${lines.length} line(s) of output`,
75
+ });
76
+ /**
77
+ * Lints changed shell scripts with ShellCheck. `-f gcc` gives one line per
78
+ * finding ending in an `[SC…]` code, which both a human and the count below can
79
+ * read directly.
80
+ *
81
+ * No language gate: shell is not something detection reports, and a `deploy.sh`
82
+ * in a Python repository is exactly the file this check exists for.
83
+ */
84
+ export const shellcheckCheck = defineExternalLint({
85
+ name: 'ShellCheck',
86
+ bin: 'shellcheck',
87
+ tool: 'shellcheck',
88
+ globs: ['*.sh', '*.bash', '*.ksh'],
89
+ configKey: 'shellcheck',
90
+ subject: 'shell scripts',
91
+ args: (ctx, targets) => {
92
+ const args = ['-f', 'gcc'];
93
+ const { minSeverity, ignore = [] } = ctx.config.shellcheck ?? {};
94
+ if (minSeverity)
95
+ args.push('-S', minSeverity);
96
+ if (ignore.length > 0)
97
+ args.push('-e', ignore.join(','));
98
+ return [...args, ...targets];
99
+ },
100
+ summary: (lines, targets) => `${lines.length} issue(s) in ${targets.length} file(s)`,
101
+ });
102
+ /**
103
+ * Vets changed Go code with `go vet ./...`, which needs the Go toolchain (the
104
+ * formatter next door no longer does — see `go-format.ts`). `go vet` operates
105
+ * per package, so it runs over the module rather than a file list; the delta
106
+ * only decides whether it runs.
107
+ */
108
+ export const goLintCheck = defineExternalLint({
109
+ name: 'Go Vet',
110
+ bin: 'go',
111
+ tool: 'go',
112
+ toolLabel: 'go',
113
+ globs: ['*.go'],
114
+ language: 'go',
115
+ configKey: 'go',
116
+ subject: 'Go files',
117
+ args: () => ['vet', './...'],
118
+ // Diagnostics and build errors both land on stderr.
119
+ stderrFirst: true,
120
+ summary: lines => `${lines.length} diagnostic line(s)`,
121
+ });
122
+ /**
123
+ * Lints changed Rust with Clippy. It compiles the crate, so it runs over the
124
+ * crate rather than a file list; the delta only decides whether it runs.
125
+ */
126
+ export const rustLintCheck = defineExternalLint({
127
+ name: 'Clippy',
128
+ bin: 'cargo',
129
+ tool: 'clippy',
130
+ toolLabel: 'cargo/clippy',
131
+ globs: ['*.rs'],
132
+ language: 'rust',
133
+ configKey: 'rust',
134
+ subject: 'Rust files',
135
+ args: () => ['clippy', '--quiet', '--', '-D', 'warnings'],
136
+ stderrFirst: true,
137
+ // Clippy interleaves diagnostics with compilation progress; only the lines
138
+ // that carry a level are findings.
139
+ keep: line => /\b(warning|error)\b/.test(line),
140
+ summary: lines => `${lines.length} clippy diagnostic(s)`,
141
+ });
142
+ // ── format ──────────────────────────────────────────────────────────────────
143
+ /**
144
+ * Formats changed Rust with `cargo fmt`, not a bare `rustfmt`: cargo reads the
145
+ * crate's edition from `Cargo.toml`, and rustfmt invoked directly does not —
146
+ * which silently formats 2015-edition code by 2024 rules.
147
+ */
148
+ export const rustFormatCheck = defineExternalFormat({
149
+ name: 'Rustfmt',
150
+ bin: 'cargo',
151
+ tool: 'rustfmt',
152
+ toolLabel: 'cargo',
153
+ globs: ['*.rs'],
154
+ language: 'rust',
155
+ configKey: 'rust',
156
+ subject: 'Rust files',
157
+ code: 'Rust code',
158
+ checkArgs: () => ['fmt', '--check'],
159
+ writeArgs: () => ['fmt'],
160
+ });
161
+ /**
162
+ * Verifies C# formatting with `dotnet format`, which also runs the project's
163
+ * configured analyzers and style rules. It operates on the project or solution
164
+ * (and expects a prior `dotnet restore`), so it runs over the whole project; the
165
+ * delta only decides whether it runs.
166
+ */
167
+ export const csharpFormatCheck = defineExternalFormat({
168
+ name: 'C# Format',
169
+ bin: 'dotnet',
170
+ tool: 'dotnet',
171
+ toolLabel: 'dotnet SDK',
172
+ globs: ['*.cs'],
173
+ language: 'csharp',
174
+ configKey: 'csharp',
175
+ subject: 'C# files',
176
+ code: 'C# code',
177
+ checkArgs: () => ['format', '--verify-no-changes'],
178
+ writeArgs: () => ['format'],
179
+ });
180
+ /**
181
+ * Formats changed PHP with PHP-CS-Fixer, using the repo's own
182
+ * `.php-cs-fixer.php` when present. `--using-cache=no` because the cache keys on
183
+ * absolute paths, and a CI checkout directory that changes between runs makes a
184
+ * stale cache report files as clean that were never examined.
185
+ */
186
+ export const phpFormatCheck = defineExternalFormat({
187
+ name: 'PHP CS Fixer',
188
+ bin: 'php-cs-fixer',
189
+ tool: 'php-cs-fixer',
190
+ globs: ['*.php'],
191
+ language: 'php',
192
+ configKey: 'php',
193
+ subject: 'PHP files',
194
+ code: 'PHP code',
195
+ checkArgs: targets => ['fix', '--using-cache=no', ...targets, '--dry-run'],
196
+ writeArgs: targets => ['fix', '--using-cache=no', ...targets],
197
+ });