pr-checkmate 1.21.14 → 1.21.15
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/.eslintrc.js +28 -1
- package/README.md +235 -314
- package/dist/config/config.js +1 -1
- package/dist/config/loader.js +6 -0
- package/dist/config/pr-checkmate-workflow.yml +16 -16
- package/dist/core/checks/circular-deps.js +2 -2
- package/dist/core/checks/commitlint.js +3 -3
- package/dist/core/checks/cpp-format.js +1 -1
- package/dist/core/checks/dead-code.js +51 -0
- package/dist/core/checks/dependency-check.js +2 -2
- package/dist/core/checks/duplicate-check.js +2 -2
- package/dist/core/checks/kotlin-lint.js +46 -0
- package/dist/core/checks/license-check.js +2 -2
- package/dist/core/checks/lint.js +1 -1
- package/dist/core/checks/markdown-lint.js +21 -18
- package/dist/core/checks/npm-audit.js +2 -2
- package/dist/core/checks/outdated-deps.js +2 -2
- package/dist/core/checks/prettier.js +2 -2
- package/dist/core/checks/security.js +1 -1
- package/dist/core/checks/spellcheck.js +2 -2
- package/dist/core/checks/swift-lint.js +50 -0
- package/dist/core/checks/typecheck.js +1 -1
- package/dist/core/context.js +1 -1
- package/dist/core/registry.js +17 -11
- package/dist/core/run-checks.js +1 -1
- package/dist/init.js +3 -0
- package/dist/scripts/copy-configs.js +3 -0
- package/dist/scripts/publish-github.js +2 -2
- package/dist/utils/delta.js +2 -2
- package/dist/utils/detect-language.js +14 -2
- package/dist/utils/index.js +3 -0
- package/dist/utils/resolve-bin.js +1 -1
- package/dist/utils/result-collector.js +15 -0
- package/eslint.config.mjs +35 -0
- package/package.json +6 -3
- package/src/config/.eslintrc.js +28 -1
- package/src/config/eslint.config.mjs +35 -0
- package/src/config/pr-checkmate-workflow.yml +16 -16
package/.eslintrc.js
CHANGED
|
@@ -41,7 +41,7 @@ module.exports = {
|
|
|
41
41
|
sourceType: 'module',
|
|
42
42
|
project: './tsconfig.json',
|
|
43
43
|
},
|
|
44
|
-
plugins: ['@typescript-eslint', 'prettier', 'import'],
|
|
44
|
+
plugins: ['@typescript-eslint', 'prettier', 'import', 'jsdoc'],
|
|
45
45
|
extends: [
|
|
46
46
|
'eslint:recommended',
|
|
47
47
|
'plugin:@typescript-eslint/recommended',
|
|
@@ -80,6 +80,33 @@ module.exports = {
|
|
|
80
80
|
{ blankLine: 'always', prev: 'block', next: '*' },
|
|
81
81
|
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
82
82
|
],
|
|
83
|
+
// Complexity analysis (#61)
|
|
84
|
+
complexity: ['warn', 15],
|
|
85
|
+
// Import ordering (#65)
|
|
86
|
+
'import/order': [
|
|
87
|
+
'warn',
|
|
88
|
+
{
|
|
89
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
90
|
+
alphabetize: { order: 'asc', caseInsensitive: true },
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
'import/no-duplicates': 'error',
|
|
94
|
+
// Documentation (#62)
|
|
95
|
+
'jsdoc/require-jsdoc': [
|
|
96
|
+
'warn',
|
|
97
|
+
{
|
|
98
|
+
publicOnly: true,
|
|
99
|
+
require: {
|
|
100
|
+
FunctionDeclaration: true,
|
|
101
|
+
MethodDefinition: true,
|
|
102
|
+
ClassDeclaration: true,
|
|
103
|
+
ArrowFunctionExpression: false,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
'jsdoc/check-param-names': 'warn',
|
|
108
|
+
'jsdoc/check-tag-names': 'warn',
|
|
109
|
+
'jsdoc/check-types': 'warn',
|
|
83
110
|
'prettier/prettier': [
|
|
84
111
|
'error',
|
|
85
112
|
{
|
package/README.md
CHANGED
|
@@ -1,99 +1,41 @@
|
|
|
1
1
|
# ♟️ PR CheckMate
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-
 – Zero-config CLI that automates ESLint, Prettier, spellcheck, dependency checks, and npm audit for pull requests.
|
|
37
|
-
|
|
38
|
-
## 🚀 Zero-Config by Default
|
|
39
|
-
|
|
40
|
-
You don't need to install or configure:
|
|
41
|
-
|
|
42
|
-
* ESLint
|
|
43
|
-
* Prettier
|
|
44
|
-
* cspell (with multilingual dictionaries)
|
|
45
|
-
* Security scanning tools
|
|
46
|
-
|
|
47
|
-
> Everything works out of the box.
|
|
48
|
-
<br>
|
|
49
|
-
|
|
50
|
-
### 🧩 Fully Customizable
|
|
51
|
-
|
|
52
|
-
Users can override:
|
|
53
|
-
|
|
54
|
-
* ESLint rules and ignore patterns
|
|
55
|
-
* Prettier rules
|
|
56
|
-
* CSpell dictionary and ignore lists
|
|
57
|
-
* Which checks run (skip flags)
|
|
58
|
-
* Source code path
|
|
59
|
-
|
|
60
|
-
User configuration is stored in:
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
<project-root>/pr-checkmate.json
|
|
64
|
-
```
|
|
4
|
+

|
|
5
|
+

|
|
65
6
|
|
|
66
|
-
|
|
7
|
+
> **PR CheckMate** is a universal PR quality checker that runs as a single `npm install` and works across **TypeScript, JavaScript, Python, C++, Swift, and Android/Kotlin** repositories — no per-language toolchain setup required.
|
|
67
8
|
|
|
68
|
-
|
|
9
|
+
---
|
|
69
10
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"words": [],
|
|
82
|
-
"ignorePaths": [],
|
|
83
|
-
"ignoreRegExpList": []
|
|
84
|
-
},
|
|
85
|
-
"documentation": {
|
|
86
|
-
"eslint": "https://eslint.org/docs/latest/rules/",
|
|
87
|
-
"typescriptEslint": "https://typescript-eslint.io/rules/",
|
|
88
|
-
"prettier": "https://prettier.io/docs/en/options.html",
|
|
89
|
-
"cspell": "https://cspell.org/configuration/"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
11
|
+
## Why PR CheckMate?
|
|
12
|
+
|
|
13
|
+
Most teams wire up linters and formatters separately for each repository. PR CheckMate ships everything pre-bundled: you add one step to your GitHub Actions workflow and every check runs automatically, in parallel, on every PR.
|
|
14
|
+
|
|
15
|
+
- **One package, any stack** — TypeScript, Python, C++, Swift, Android (Kotlin/Java). Language is auto-detected from your repo.
|
|
16
|
+
- **Zero client tooling** — ESLint, Prettier, cspell, jscpd, gitleaks, clang-format (WASM), and Ruff (WASM) are bundled. Clients install nothing extra.
|
|
17
|
+
- **Delta mode** — only changed files are checked in PR context. Full-project fallback for local runs.
|
|
18
|
+
- **Parallel execution** — independent checks run concurrently (~4× faster than sequential CI).
|
|
19
|
+
- **Non-intrusive** — every check can be disabled per-repo via `pr-checkmate.json`.
|
|
20
|
+
|
|
21
|
+
---
|
|
93
22
|
|
|
94
|
-
|
|
23
|
+
## Language Support
|
|
95
24
|
|
|
96
|
-
|
|
25
|
+
| Language | Detection | Lint | Format | Type Check | Notes |
|
|
26
|
+
|---|---|---|---|---|---|
|
|
27
|
+
| **TypeScript** | `tsconfig.json` | ESLint + SonarJS | Prettier | `tsc --noEmit` | Fully bundled |
|
|
28
|
+
| **JavaScript** | `package.json` | ESLint | Prettier | — | Fully bundled |
|
|
29
|
+
| **Python** | `pyproject.toml`, `requirements.txt` | Ruff (WASM) | Ruff (WASM) | — | Fully bundled, no Python install needed |
|
|
30
|
+
| **C++** | `CMakeLists.txt` | — | clang-format (WASM) | — | Fully bundled, no clang install needed |
|
|
31
|
+
| **Swift** | `Package.swift` | SwiftLint | — | — | Requires `swiftlint` on runner |
|
|
32
|
+
| **Android/Kotlin** | `build.gradle`, `AndroidManifest.xml` | ktlint | — | — | Requires `ktlint` on runner |
|
|
33
|
+
|
|
34
|
+
Universal checks (all languages): secret scanning, PR size, PR title, PR body, duplicate code, dead code, license compliance, markdown lint, spellcheck, sensitive file guard, diff security scan.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Quickstart
|
|
97
39
|
|
|
98
40
|
### 1. Install
|
|
99
41
|
|
|
@@ -107,299 +49,278 @@ npm install --save-dev pr-checkmate
|
|
|
107
49
|
npx pr-checkmate init
|
|
108
50
|
```
|
|
109
51
|
|
|
110
|
-
|
|
111
|
-
>
|
|
112
|
-
> * `pr-checkmate.json` — configuration file for source path and custom rules
|
|
113
|
-
> * `.github/workflows/pr-checkmate.yml` — GitHub Actions workflow with per-job checks and auto-commit support
|
|
52
|
+
Creates `pr-checkmate.json` and `.github/workflows/pr-checkmate.yml` tailored to the detected languages in your repo.
|
|
114
53
|
|
|
115
|
-
### 3. Run
|
|
54
|
+
### 3. Run
|
|
116
55
|
|
|
117
56
|
```bash
|
|
118
|
-
npx pr-checkmate
|
|
57
|
+
npx pr-checkmate all
|
|
119
58
|
```
|
|
120
59
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
| Job | Description |
|
|
124
|
-
|----------------|-------------|
|
|
125
|
-
| `all` | Run all checks in parallel (lint, deps, audit, security, circular, license, then spellcheck, pr-size, pr-title, outdated, markdown, typecheck, diff-smell, pr-body, duplicate, diff-security, sensitive-files, then prettier). Posts a PR summary comment when run in a GitHub Actions PR context. |
|
|
126
|
-
| `lint` | Lint code using ESLint |
|
|
127
|
-
| `prettier` | Format code using Prettier |
|
|
128
|
-
| `deps` | Check unused / missing dependencies via depcheck |
|
|
129
|
-
| `security` | Scan for secrets using gitleaks |
|
|
130
|
-
| `spellcheck` | Spellcheck via cspell (EN, RU, UK, HE, FR) |
|
|
131
|
-
| `audit` | Run `npm audit --audit-level=moderate` |
|
|
132
|
-
| `circular` | Detect circular dependencies via dpdm |
|
|
133
|
-
| `license` | Block GPL / AGPL / LGPL licensed packages |
|
|
134
|
-
| `pr-size` | Warn if PR exceeds 50 files or 1 000 changed lines |
|
|
135
|
-
| `pr-title` | Validate PR title against Conventional Commits format |
|
|
136
|
-
| `outdated` | Report packages that are major versions behind |
|
|
137
|
-
| `markdown` | Lint `.md`/`.mdx` files via markdownlint (warning-only, delta mode) |
|
|
138
|
-
| `typecheck` | Run `tsc --noEmit` to catch type errors (blocking). Skips automatically if no `tsconfig.json` is found. |
|
|
139
|
-
| `diff-smell` | Scan PR diff for `console.*()`, `debugger`, and `TODO/FIXME/HACK/XXX` in added lines (warning-only, delta mode) |
|
|
140
|
-
| `pr-body` | Check PR description for minimum length (20 chars) and a ticket reference (warning-only) |
|
|
141
|
-
| `duplicate` | Detect duplicate code with `jscpd` — min 5 lines / 50 tokens (warning-only, delta mode in PR context) |
|
|
142
|
-
| `diff-security` | Scan PR diff for XSS vectors, `eval()`/`new Function()`, prototype pollution, weak crypto (MD5/SHA-1), CORS wildcards, insecure HTTP, command injection, and SQL injection in added lines (warning-only, delta mode, PR context only) |
|
|
143
|
-
| `sensitive-files` | Detect PR changes to `.env` files, private keys/certificates, CI/CD configs, auth middleware, infrastructure files, and lockfiles (warning-only, PR context only) |
|
|
60
|
+
---
|
|
144
61
|
|
|
145
|
-
|
|
62
|
+
## GitHub Actions — Examples by Language
|
|
146
63
|
|
|
147
|
-
|
|
64
|
+
All examples follow the same structure: checkout → setup runtime (if needed) → `npm install pr-checkmate` → `npx pr-checkmate all`.
|
|
148
65
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Outside of a PR context (local runs, push workflows) the checks fall back to the full project scan.
|
|
152
|
-
|
|
153
|
-
<br>
|
|
154
|
-
|
|
155
|
-
## 🤖 GitHub Actions Workflow (Auto-Generated)
|
|
156
|
-
|
|
157
|
-
When you run `npx pr-checkmate init`, it automatically creates `.github/workflows/pr-checkmate.yml`:
|
|
66
|
+
### TypeScript / JavaScript
|
|
158
67
|
|
|
159
68
|
```yaml
|
|
160
|
-
name: PR
|
|
161
|
-
|
|
69
|
+
name: PR CheckMate
|
|
162
70
|
on:
|
|
163
71
|
pull_request:
|
|
164
|
-
branches: [main
|
|
165
|
-
types: [opened, synchronize, reopened]
|
|
72
|
+
branches: [main]
|
|
166
73
|
|
|
167
74
|
permissions:
|
|
168
75
|
contents: write
|
|
169
76
|
pull-requests: write
|
|
170
77
|
|
|
171
78
|
jobs:
|
|
172
|
-
|
|
173
|
-
name: ESLint
|
|
79
|
+
quality:
|
|
174
80
|
runs-on: ubuntu-latest
|
|
175
81
|
steps:
|
|
176
82
|
- uses: actions/checkout@v4
|
|
177
|
-
with: {
|
|
83
|
+
with: { fetch-depth: 0 }
|
|
178
84
|
- uses: actions/setup-node@v4
|
|
179
|
-
with: { node-version:
|
|
85
|
+
with: { node-version: 24 }
|
|
180
86
|
- run: npm ci
|
|
181
|
-
- run: npx pr-checkmate
|
|
182
|
-
|
|
87
|
+
- run: npx pr-checkmate all
|
|
88
|
+
```
|
|
183
89
|
|
|
184
|
-
|
|
185
|
-
name: Dependency Check
|
|
186
|
-
runs-on: ubuntu-latest
|
|
187
|
-
steps:
|
|
188
|
-
- uses: actions/checkout@v4
|
|
189
|
-
with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
|
|
190
|
-
- uses: actions/setup-node@v4
|
|
191
|
-
with: { node-version: 20 }
|
|
192
|
-
- run: npm ci
|
|
193
|
-
- run: npx pr-checkmate deps
|
|
194
|
-
continue-on-error: true
|
|
90
|
+
---
|
|
195
91
|
|
|
196
|
-
|
|
197
|
-
name: Circular Dependencies
|
|
198
|
-
runs-on: ubuntu-latest
|
|
199
|
-
steps:
|
|
200
|
-
- uses: actions/checkout@v4
|
|
201
|
-
with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
|
|
202
|
-
- uses: actions/setup-node@v4
|
|
203
|
-
with: { node-version: 20 }
|
|
204
|
-
- run: npm ci
|
|
205
|
-
- run: npx pr-checkmate circular
|
|
206
|
-
continue-on-error: true
|
|
92
|
+
### Python
|
|
207
93
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
|
|
214
|
-
- uses: actions/setup-node@v4
|
|
215
|
-
with: { node-version: 20 }
|
|
216
|
-
- run: npm ci
|
|
217
|
-
- run: npx pr-checkmate license
|
|
218
|
-
continue-on-error: true
|
|
94
|
+
```yaml
|
|
95
|
+
name: PR CheckMate
|
|
96
|
+
on:
|
|
97
|
+
pull_request:
|
|
98
|
+
branches: [main]
|
|
219
99
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
steps:
|
|
224
|
-
- uses: actions/checkout@v4
|
|
225
|
-
with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
|
|
226
|
-
- uses: actions/setup-node@v4
|
|
227
|
-
with: { node-version: 20 }
|
|
228
|
-
- run: npm ci
|
|
229
|
-
- run: npx pr-checkmate pr-size
|
|
230
|
-
continue-on-error: true
|
|
100
|
+
permissions:
|
|
101
|
+
contents: read
|
|
102
|
+
pull-requests: write
|
|
231
103
|
|
|
232
|
-
|
|
233
|
-
|
|
104
|
+
jobs:
|
|
105
|
+
quality:
|
|
234
106
|
runs-on: ubuntu-latest
|
|
235
107
|
steps:
|
|
236
108
|
- uses: actions/checkout@v4
|
|
237
|
-
with: {
|
|
109
|
+
with: { fetch-depth: 0 }
|
|
238
110
|
- uses: actions/setup-node@v4
|
|
239
|
-
with: { node-version:
|
|
240
|
-
|
|
241
|
-
- run:
|
|
242
|
-
|
|
111
|
+
with: { node-version: 24 }
|
|
112
|
+
# No pip install needed — Ruff runs via bundled WASM
|
|
113
|
+
- run: npm install pr-checkmate
|
|
114
|
+
- run: npx pr-checkmate all
|
|
115
|
+
```
|
|
243
116
|
|
|
244
|
-
|
|
245
|
-
name: Outdated Dependencies
|
|
246
|
-
runs-on: ubuntu-latest
|
|
247
|
-
steps:
|
|
248
|
-
- uses: actions/checkout@v4
|
|
249
|
-
with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
|
|
250
|
-
- uses: actions/setup-node@v4
|
|
251
|
-
with: { node-version: 20 }
|
|
252
|
-
- run: npm ci
|
|
253
|
-
- run: npx pr-checkmate outdated
|
|
254
|
-
continue-on-error: true
|
|
117
|
+
> Ruff (lint + format) runs via WASM — no Python or pip required on the runner.
|
|
255
118
|
|
|
256
|
-
|
|
257
|
-
name: Markdown Lint
|
|
258
|
-
runs-on: ubuntu-latest
|
|
259
|
-
steps:
|
|
260
|
-
- uses: actions/checkout@v4
|
|
261
|
-
with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
|
|
262
|
-
- uses: actions/setup-node@v4
|
|
263
|
-
with: { node-version: 20 }
|
|
264
|
-
- run: npm ci
|
|
265
|
-
- run: npx pr-checkmate markdown
|
|
266
|
-
continue-on-error: true
|
|
119
|
+
---
|
|
267
120
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
with: { node-version: 20 }
|
|
276
|
-
- run: npm ci
|
|
277
|
-
- run: npx pr-checkmate spellcheck
|
|
278
|
-
continue-on-error: true
|
|
121
|
+
### C++
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
name: PR CheckMate
|
|
125
|
+
on:
|
|
126
|
+
pull_request:
|
|
127
|
+
branches: [main]
|
|
279
128
|
|
|
280
|
-
|
|
281
|
-
|
|
129
|
+
permissions:
|
|
130
|
+
contents: write
|
|
131
|
+
pull-requests: write
|
|
132
|
+
|
|
133
|
+
jobs:
|
|
134
|
+
quality:
|
|
282
135
|
runs-on: ubuntu-latest
|
|
283
136
|
steps:
|
|
284
137
|
- uses: actions/checkout@v4
|
|
285
|
-
with: {
|
|
138
|
+
with: { fetch-depth: 0 }
|
|
286
139
|
- uses: actions/setup-node@v4
|
|
287
|
-
with: { node-version:
|
|
288
|
-
-
|
|
289
|
-
- run:
|
|
290
|
-
|
|
140
|
+
with: { node-version: 24 }
|
|
141
|
+
# No clang install needed — clang-format runs via bundled WASM
|
|
142
|
+
- run: npm install pr-checkmate
|
|
143
|
+
- run: npx pr-checkmate all
|
|
144
|
+
```
|
|
291
145
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
146
|
+
> clang-format runs via WASM — no system clang or LLVM install required.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### Swift
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
name: PR CheckMate
|
|
154
|
+
on:
|
|
155
|
+
pull_request:
|
|
156
|
+
branches: [main]
|
|
157
|
+
|
|
158
|
+
permissions:
|
|
159
|
+
contents: read
|
|
160
|
+
pull-requests: write
|
|
161
|
+
|
|
162
|
+
jobs:
|
|
163
|
+
quality:
|
|
164
|
+
runs-on: macos-latest # SwiftLint is pre-installed on macOS runners
|
|
295
165
|
steps:
|
|
296
166
|
- uses: actions/checkout@v4
|
|
297
|
-
with: {
|
|
167
|
+
with: { fetch-depth: 0 }
|
|
298
168
|
- uses: actions/setup-node@v4
|
|
299
|
-
with: { node-version:
|
|
300
|
-
- run: npm
|
|
301
|
-
- run: npx pr-checkmate
|
|
302
|
-
|
|
169
|
+
with: { node-version: 24 }
|
|
170
|
+
- run: npm install pr-checkmate
|
|
171
|
+
- run: npx pr-checkmate all
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
> `swiftlint` is pre-installed on GitHub's `macos-latest` runner. If not available, the check is skipped automatically.
|
|
303
175
|
|
|
304
|
-
|
|
305
|
-
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Android / Kotlin
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
name: PR CheckMate
|
|
182
|
+
on:
|
|
183
|
+
pull_request:
|
|
184
|
+
branches: [main]
|
|
185
|
+
|
|
186
|
+
permissions:
|
|
187
|
+
contents: read
|
|
188
|
+
pull-requests: write
|
|
189
|
+
|
|
190
|
+
jobs:
|
|
191
|
+
quality:
|
|
306
192
|
runs-on: ubuntu-latest
|
|
307
193
|
steps:
|
|
308
194
|
- uses: actions/checkout@v4
|
|
309
|
-
with: {
|
|
195
|
+
with: { fetch-depth: 0 }
|
|
310
196
|
- uses: actions/setup-node@v4
|
|
311
|
-
with: { node-version:
|
|
312
|
-
-
|
|
313
|
-
- run: npx pr-checkmate prettier
|
|
314
|
-
continue-on-error: true
|
|
315
|
-
- name: Auto-commit formatting changes
|
|
197
|
+
with: { node-version: 24 }
|
|
198
|
+
- name: Install ktlint
|
|
316
199
|
run: |
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
git push origin HEAD:${{ github.head_ref }}
|
|
323
|
-
fi
|
|
324
|
-
env:
|
|
325
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
200
|
+
curl -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint
|
|
201
|
+
chmod +x ktlint
|
|
202
|
+
sudo mv ktlint /usr/local/bin/
|
|
203
|
+
- run: npm install pr-checkmate
|
|
204
|
+
- run: npx pr-checkmate all
|
|
326
205
|
```
|
|
327
206
|
|
|
328
|
-
|
|
207
|
+
> `ktlint` is not pre-installed on Ubuntu runners — the snippet above fetches the latest release binary. If ktlint is unavailable, the check is skipped automatically.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## All Checks
|
|
212
|
+
|
|
213
|
+
| Check | Phase | Description |
|
|
214
|
+
|---|---|---|
|
|
215
|
+
| ESLint + SonarJS + JSDoc | blocking | Lint with complexity, import order, and doc coverage rules |
|
|
216
|
+
| TypeScript | blocking | `tsc --noEmit` type check |
|
|
217
|
+
| Dependency Check | blocking | Unused / missing deps via depcheck |
|
|
218
|
+
| NPM Audit | blocking | Vulnerability scan (`moderate`+) |
|
|
219
|
+
| Circular Deps | blocking | Circular dependency detection |
|
|
220
|
+
| License Check | blocking | Blocks GPL / AGPL / LGPL packages |
|
|
221
|
+
| Ruff Lint | informational | Python linting via WASM |
|
|
222
|
+
| SwiftLint | informational | Swift linting |
|
|
223
|
+
| ktlint | informational | Kotlin linting |
|
|
224
|
+
| Dead Code | informational | Unused exports (`ts-unused-exports`) |
|
|
225
|
+
| Duplicate Code | informational | `jscpd` — 5 lines / 50 tokens threshold |
|
|
226
|
+
| Diff Smell | informational | `console.*`, `debugger`, `TODO/FIXME` in added lines |
|
|
227
|
+
| Diff Security | informational | XSS, `eval`, SQLi, weak crypto in added lines |
|
|
228
|
+
| Sensitive Files | informational | `.env`, private keys, CI configs touched in PR |
|
|
229
|
+
| PR Size | informational | Warns if PR > 50 files or 1 000 lines |
|
|
230
|
+
| PR Title | informational | Conventional Commits format |
|
|
231
|
+
| PR Body | informational | Min 20 chars + ticket reference |
|
|
232
|
+
| Commitlint | informational | Commit message convention |
|
|
233
|
+
| Outdated Deps | informational | Major-behind packages |
|
|
234
|
+
| Markdown Lint | informational | `.md` / `.mdx` via markdownlint |
|
|
235
|
+
| Spellcheck | informational | EN, ES, FR, RU, UK, HE dictionaries |
|
|
236
|
+
| Prettier | format | Auto-format; commits fixes back to branch |
|
|
237
|
+
| C++ Format | format | clang-format via WASM |
|
|
238
|
+
| Python Format | format | Ruff formatter via WASM |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Configuration
|
|
243
|
+
|
|
244
|
+
All checks can be tuned or disabled per-repo via `pr-checkmate.json`:
|
|
329
245
|
|
|
330
|
-
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"sourcePath": "src",
|
|
249
|
+
"lint": {
|
|
250
|
+
"rules": { "no-console": "error" },
|
|
251
|
+
"ignorePatterns": ["**/*.generated.ts"]
|
|
252
|
+
},
|
|
253
|
+
"python": { "enabled": true, "ruff": { "lint": true, "format": true } },
|
|
254
|
+
"swift": { "enabled": true },
|
|
255
|
+
"kotlin": { "enabled": true },
|
|
256
|
+
"cpp": { "enabled": true, "clangFormat": { "style": "Google" } },
|
|
257
|
+
"duplicate": { "enabled": true, "minLines": 10 },
|
|
258
|
+
"deadCode": { "enabled": false },
|
|
259
|
+
"commitlint": {
|
|
260
|
+
"enabled": true,
|
|
261
|
+
"types": ["feat", "fix", "docs", "chore", "ci", "refactor", "test"]
|
|
262
|
+
},
|
|
263
|
+
"licenseCheck": {
|
|
264
|
+
"allowPackages": [],
|
|
265
|
+
"allowLicenses": ["LGPL-3.0"]
|
|
266
|
+
},
|
|
267
|
+
"prBody": { "enabled": true, "minLength": 20, "requireTicket": true }
|
|
268
|
+
}
|
|
269
|
+
```
|
|
331
270
|
|
|
332
|
-
|
|
333
|
-
2. Select **"Read and write permissions"**
|
|
334
|
-
3. Save changes
|
|
271
|
+
---
|
|
335
272
|
|
|
336
|
-
|
|
273
|
+
## Delta Mode
|
|
337
274
|
|
|
338
|
-
|
|
275
|
+
In GitHub Actions PR context, language checks automatically switch to **delta mode** — only files changed in the PR are checked. Outside PR context (local, push workflows) the checks fall back to a full project scan.
|
|
339
276
|
|
|
340
|
-
|
|
277
|
+
---
|
|
341
278
|
|
|
342
|
-
|
|
279
|
+
## PR Summary Comment
|
|
343
280
|
|
|
344
|
-
|
|
281
|
+
After `npx pr-checkmate all`, a summary table is posted to the PR. On repeated pushes the comment is updated in place — no duplicate comments.
|
|
345
282
|
|
|
346
|
-
```
|
|
283
|
+
```
|
|
347
284
|
## PR CheckMate Summary
|
|
348
285
|
|
|
349
|
-
|
|
286
|
+
11 passed · 3 warnings · 0 failed · 0 skipped
|
|
350
287
|
|
|
351
|
-
| Check
|
|
352
|
-
|
|
353
|
-
| ESLint
|
|
354
|
-
| TypeScript
|
|
355
|
-
|
|
|
356
|
-
|
|
|
357
|
-
|
|
288
|
+
| Check | Result |
|
|
289
|
+
|----------------|-----------------------------------------|
|
|
290
|
+
| ESLint | ✅ pass |
|
|
291
|
+
| TypeScript | ✅ pass |
|
|
292
|
+
| Ruff Lint | ⚠️ warn — 3 issues in 2 files |
|
|
293
|
+
| Diff Smell | ⚠️ warn — 2x console.*(), 1x TODO |
|
|
294
|
+
| PR Body | ⚠️ warn — no ticket reference |
|
|
295
|
+
| ... | ... |
|
|
358
296
|
```
|
|
359
297
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
<br>
|
|
363
|
-
|
|
364
|
-
## 🌍 Multilingual Spellcheck Support
|
|
298
|
+
Requires `pull-requests: write` permission — the generated workflow includes this automatically.
|
|
365
299
|
|
|
366
|
-
|
|
300
|
+
---
|
|
367
301
|
|
|
368
|
-
|
|
369
|
-
* 🇪🇸 Spanish (es)
|
|
370
|
-
* 🇫🇷 French (fr)
|
|
371
|
-
* 🇷🇺 Russian (ru)
|
|
372
|
-
* 🇺🇦 Ukrainian (uk)
|
|
373
|
-
* 🇮🇱 Hebrew (he)
|
|
302
|
+
## Tech Stack
|
|
374
303
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
* **cspell** — spellchecking with multilingual dictionaries
|
|
397
|
-
* **execa** — running CLI commands from Node.js
|
|
398
|
-
* **gitleaks** — secret scanning
|
|
399
|
-
* **depcheck** — unused and missing dependency analysis
|
|
400
|
-
* **dpdm** — circular dependency detection
|
|
401
|
-
* **license-checker** — license compliance validation
|
|
402
|
-
|
|
403
|
-
## 📜 License
|
|
304
|
+
| Tool | Role |
|
|
305
|
+
|---|---|
|
|
306
|
+
| ESLint + @typescript-eslint | TypeScript / JS linting |
|
|
307
|
+
| eslint-plugin-sonarjs | Complexity analysis |
|
|
308
|
+
| eslint-plugin-import | Import ordering |
|
|
309
|
+
| eslint-plugin-jsdoc | Documentation coverage |
|
|
310
|
+
| Prettier | Code formatting |
|
|
311
|
+
| @astral-sh/ruff-wasm-nodejs | Python lint + format (WASM) |
|
|
312
|
+
| @wasm-fmt/clang-format | C++ formatting (WASM) |
|
|
313
|
+
| SwiftLint | Swift linting (system binary) |
|
|
314
|
+
| ktlint | Kotlin linting (system binary) |
|
|
315
|
+
| cspell | Multilingual spellcheck |
|
|
316
|
+
| gitleaks | Secret scanning |
|
|
317
|
+
| depcheck | Dependency analysis |
|
|
318
|
+
| ts-unused-exports | Dead code detection |
|
|
319
|
+
| jscpd | Duplicate code detection |
|
|
320
|
+
| license-checker | License compliance |
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## License
|
|
404
325
|
|
|
405
326
|
LicenseRef Proprietary © 2025
|