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.
Files changed (38) hide show
  1. package/.eslintrc.js +28 -1
  2. package/README.md +235 -314
  3. package/dist/config/config.js +1 -1
  4. package/dist/config/loader.js +6 -0
  5. package/dist/config/pr-checkmate-workflow.yml +16 -16
  6. package/dist/core/checks/circular-deps.js +2 -2
  7. package/dist/core/checks/commitlint.js +3 -3
  8. package/dist/core/checks/cpp-format.js +1 -1
  9. package/dist/core/checks/dead-code.js +51 -0
  10. package/dist/core/checks/dependency-check.js +2 -2
  11. package/dist/core/checks/duplicate-check.js +2 -2
  12. package/dist/core/checks/kotlin-lint.js +46 -0
  13. package/dist/core/checks/license-check.js +2 -2
  14. package/dist/core/checks/lint.js +1 -1
  15. package/dist/core/checks/markdown-lint.js +21 -18
  16. package/dist/core/checks/npm-audit.js +2 -2
  17. package/dist/core/checks/outdated-deps.js +2 -2
  18. package/dist/core/checks/prettier.js +2 -2
  19. package/dist/core/checks/security.js +1 -1
  20. package/dist/core/checks/spellcheck.js +2 -2
  21. package/dist/core/checks/swift-lint.js +50 -0
  22. package/dist/core/checks/typecheck.js +1 -1
  23. package/dist/core/context.js +1 -1
  24. package/dist/core/registry.js +17 -11
  25. package/dist/core/run-checks.js +1 -1
  26. package/dist/init.js +3 -0
  27. package/dist/scripts/copy-configs.js +3 -0
  28. package/dist/scripts/publish-github.js +2 -2
  29. package/dist/utils/delta.js +2 -2
  30. package/dist/utils/detect-language.js +14 -2
  31. package/dist/utils/index.js +3 -0
  32. package/dist/utils/resolve-bin.js +1 -1
  33. package/dist/utils/result-collector.js +15 -0
  34. package/eslint.config.mjs +35 -0
  35. package/package.json +6 -3
  36. package/src/config/.eslintrc.js +28 -1
  37. package/src/config/eslint.config.mjs +35 -0
  38. 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
  ![Build](https://img.shields.io/github/actions/workflow/status/Mybono/sdk_automation/publish.yml?branch=main&label=CI&color=blue)
4
- ![ESLint](https://img.shields.io/npm/v/eslint?color=yellow&label=ESLint)
5
- ![Prettier](https://img.shields.io/npm/v/prettier?color=orange&label=Prettier)
6
-
7
- > **PR CheckMate** is an npm package for automating Pull Request checks.
8
- > It helps teams maintain code quality by automatically validating linting, formatting, dependencies, security, and spelling before merging to `main`.
9
-
10
- ## 🔍 Why PR CheckMate?
11
-
12
- * ✅ Automatic checks on every PR without extra setup.
13
- * ✅ No need to install ESLint, Prettier, or cspell in your project — all included.
14
- * ✅ Enforces a unified code style across repositories.
15
- * ✅ Detects unused and missing dependencies via `depcheck`.
16
- * ✅ Finds circular dependencies before they reach production.
17
- * ✅ Blocks GPL/AGPL/LGPL licensed packages from slipping in.
18
- * ✅ Validates PR title against Conventional Commits.
19
- * ✅ Warns about oversized PRs and major-behind packages.
20
- * ✅ Spellcheck for code, docs, and JSON with multilingual support (EN, RU, UK, HE, FR).
21
- * ✅ Package vulnerability check via `npm audit`.
22
- * ✅ Secret scanning via `gitleaks`.
23
- * ✅ **Delta mode** — in GitHub PR context only changed files are checked, not the entire project.
24
- * ✅ **Parallel execution** — all independent checks run concurrently, cutting CI time ~4×.
25
- * ✅ TypeScript type check — runs `tsc --noEmit`, catches type errors before merge. Skips if no `tsconfig.json` is found.
26
- * ✅ Diff code smells — scans PR diff for `console.*()` calls, `debugger` statements, and `TODO/FIXME/HACK/XXX` comments left in added lines.
27
- * ✅ PR description check — validates the PR body has at least 20 characters and includes a ticket reference (`Closes #123` or `PROJ-456` style).
28
- * ✅ Duplicate code detection — uses `jscpd` in delta mode (changed files in PR, or `src/` otherwise) with a 5-line / 50-token minimum threshold.
29
- * ✅ Diff security scan — detects XSS vectors, `eval()`/`new Function()`, prototype pollution, weak crypto, CORS wildcards, insecure HTTP calls, command injection, and SQL injection patterns in added PR lines (warning-only, delta mode).
30
- * ✅ Sensitive file guard — warns when the PR touches `.env` files, private keys/certificates, CI/CD pipeline configs, auth middleware, infrastructure files, or lockfiles (warning-only, PR context only).
31
- * ✅ PR summary comment — after `npx pr-checkmate all`, posts a summary table to the CI log and upserts a comment on the PR. No spam on repeated pushes.
32
-
33
- <br>
34
- > ⚠️ **Note:** Currently, PR CheckMate only supports **Node.js projects**.
35
-
36
- * [PR CheckMate](https://www.npmjs.com/package/pr-checkmate) – 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
+ ![npm](https://img.shields.io/npm/v/pr-checkmate?color=blue&label=npm)
5
+ ![License](https://img.shields.io/badge/license-Proprietary-lightgrey)
65
6
 
66
- <br>
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
- ### ⚙️ Example: pr-checkmate.json
9
+ ---
69
10
 
70
- ```json
71
- {
72
- "sourcePath": "src",
73
- "eslint": {
74
- "rules": {},
75
- "ignorePatterns": []
76
- },
77
- "prettier": {
78
- "rules": {}
79
- },
80
- "cspell": {
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
- <br>
23
+ ## Language Support
95
24
 
96
- ## 🛠 How It Works
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
- > This creates:
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 Checks
54
+ ### 3. Run
116
55
 
117
56
  ```bash
118
- npx pr-checkmate <job>
57
+ npx pr-checkmate all
119
58
  ```
120
59
 
121
- #### ⚡ Jobs
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
- <br>
62
+ ## GitHub Actions — Examples by Language
146
63
 
147
- ### ⚡ Delta Mode
64
+ All examples follow the same structure: checkout → setup runtime (if needed) → `npm install pr-checkmate` → `npx pr-checkmate all`.
148
65
 
149
- In a GitHub Actions PR context, `lint`, `prettier`, `spellcheck`, `markdown`, `diff-smell`, `duplicate`, and `diff-security` automatically switch to **delta mode** — only the files changed in the PR are checked instead of the entire project. This is transparent and requires no configuration.
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 Checkmate Quality Checks
161
-
69
+ name: PR CheckMate
162
70
  on:
163
71
  pull_request:
164
- branches: [main, master, develop]
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
- lint:
173
- name: ESLint
79
+ quality:
174
80
  runs-on: ubuntu-latest
175
81
  steps:
176
82
  - uses: actions/checkout@v4
177
- with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
83
+ with: { fetch-depth: 0 }
178
84
  - uses: actions/setup-node@v4
179
- with: { node-version: 20 }
85
+ with: { node-version: 24 }
180
86
  - run: npm ci
181
- - run: npx pr-checkmate lint
182
- continue-on-error: true
87
+ - run: npx pr-checkmate all
88
+ ```
183
89
 
184
- deps:
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
- circular-deps:
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
- license-check:
209
- name: License Check
210
- runs-on: ubuntu-latest
211
- steps:
212
- - uses: actions/checkout@v4
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
- pr-size:
221
- name: PR Size
222
- runs-on: ubuntu-latest
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
- pr-title:
233
- name: PR Title Lint
104
+ jobs:
105
+ quality:
234
106
  runs-on: ubuntu-latest
235
107
  steps:
236
108
  - uses: actions/checkout@v4
237
- with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
109
+ with: { fetch-depth: 0 }
238
110
  - uses: actions/setup-node@v4
239
- with: { node-version: 20 }
240
- - run: npm ci
241
- - run: npx pr-checkmate pr-title
242
- continue-on-error: true
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
- outdated-deps:
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
- markdown-lint:
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
- spellcheck:
269
- name: Spellcheck
270
- runs-on: ubuntu-latest
271
- steps:
272
- - uses: actions/checkout@v4
273
- with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
274
- - uses: actions/setup-node@v4
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
- security:
281
- name: Security Scan
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: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
138
+ with: { fetch-depth: 0 }
286
139
  - uses: actions/setup-node@v4
287
- with: { node-version: 20 }
288
- - run: npm ci
289
- - run: npx pr-checkmate security
290
- continue-on-error: true
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
- npm-audit:
293
- name: NPM Audit
294
- runs-on: ubuntu-latest
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: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
167
+ with: { fetch-depth: 0 }
298
168
  - uses: actions/setup-node@v4
299
- with: { node-version: 20 }
300
- - run: npm ci
301
- - run: npx pr-checkmate audit
302
- continue-on-error: true
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
- prettier:
305
- name: Prettier
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: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
195
+ with: { fetch-depth: 0 }
310
196
  - uses: actions/setup-node@v4
311
- with: { node-version: 20 }
312
- - run: npm ci
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
- git config user.name "github-actions[bot]"
318
- git config user.email "github-actions[bot]@users.noreply.github.com"
319
- git add -A
320
- if ! git diff --cached --quiet; then
321
- git commit -m "style: auto-format code with Prettier"
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
- ### ⚙️ GitHub Actions Permissions
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
- For the auto-commit feature to work, ensure your repository has the correct permissions:
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
- 1. Go to **Settings** → **Actions** → **General** → **Workflow permissions**
333
- 2. Select **"Read and write permissions"**
334
- 3. Save changes
271
+ ---
335
272
 
336
- > The workflow will automatically commit Prettier formatting fixes directly to your PR branch.
273
+ ## Delta Mode
337
274
 
338
- <br>
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
- ### PR summary comment
277
+ ---
341
278
 
342
- After `npx pr-checkmate all` finishes, it prints a summary table to the CI log and posts a comment on the PR. On repeated pushes the comment is updated in place — no duplicate comments accumulate.
279
+ ## PR Summary Comment
343
280
 
344
- The comment looks like this:
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
- ```text
283
+ ```
347
284
  ## PR CheckMate Summary
348
285
 
349
- **11 passed** · **3 warnings** · **0 failed** · **0 skipped**
286
+ 11 passed · 3 warnings · 0 failed · 0 skipped
350
287
 
351
- | Check | Result |
352
- |---|---|
353
- | ESLint | pass |
354
- | TypeScript | pass |
355
- | Diff Smells | warn — 2x console.*(), 1x TODO comment |
356
- | PR Body | warn — no ticket reference |
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
- This requires `GITHUB_TOKEN` with `pull-requests: write` permission. The auto-generated workflow already includes both — no extra setup is needed.
361
-
362
- <br>
363
-
364
- ## 🌍 Multilingual Spellcheck Support
298
+ Requires `pull-requests: write` permission — the generated workflow includes this automatically.
365
299
 
366
- PR CheckMate includes built-in dictionaries for:
300
+ ---
367
301
 
368
- * 🇬🇧 English (en)
369
- * 🇪🇸 Spanish (es)
370
- * 🇫🇷 French (fr)
371
- * 🇷🇺 Russian (ru)
372
- * 🇺🇦 Ukrainian (uk)
373
- * 🇮🇱 Hebrew (he)
302
+ ## Tech Stack
374
303
 
375
- No additional configuration needed — just use `npx pr-checkmate spellcheck` and it will check spelling in all supported languages.
376
-
377
- <br>
378
-
379
- ## 📌 Benefits
380
-
381
- * ✅ Self-contained — the package handles all checks internally
382
- * ✅ Works locally and in CI/CD (GitHub Actions, GitLab CI, etc.)
383
- * ✅ Enforces a unified code style across repositories
384
- * ✅ Automatic formatting and commits when needed
385
- * ✅ Multilingual spellcheck support out of the box
386
- * ✅ Minimal setup — just `init` and `npx pr-checkmate all`
387
- * ✅ Delta mode keeps CI fast — only changed files are scanned
388
- * ✅ License guard prevents copyleft packages from entering your project
389
-
390
- ## 🧰 Tech Stack
391
-
392
- * **Node.js 20** — executes CLI scripts
393
- * **TypeScript** — fully typed code
394
- * **ESLint + @typescript-eslint** — code linting
395
- * **Prettier** — auto-formatting
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