pr-checkmate 1.23.5 → 1.23.6
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/README.md +3 -3
- package/dist/cli.js +1 -0
- package/dist/config/constants.js +1 -0
- package/dist/core/checks/quality/yaml-lint.d.ts +13 -0
- package/dist/core/checks/quality/yaml-lint.js +83 -0
- package/dist/core/registry.js +2 -0
- package/dist/init.js +8 -0
- package/dist/interfaces/index.d.ts +5 -0
- package/package.json +3 -2
- package/pr-checkmate.schema.json +8 -0
- package/src/config/pr-checkmate.schema.json +8 -0
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|

|
|
10
10
|
[](https://pr-checkmate-docs.pages.dev)
|
|
11
11
|
|
|
12
|
-
> PR CheckMate is a universal PR quality checker: one `npm install`,
|
|
12
|
+
> PR CheckMate is a universal PR quality checker: one `npm install`, 50 checks across
|
|
13
13
|
> 11 languages, running in CI on every pull request. The bundled languages need no
|
|
14
14
|
> per-language toolchain setup.
|
|
15
15
|
|
|
@@ -108,7 +108,7 @@ skipped, not failed.
|
|
|
108
108
|
|
|
109
109
|
## Checks
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
50 checks, grouped by category and run in parallel within each phase:
|
|
112
112
|
|
|
113
113
|
- Universal git-diff (18) — language-agnostic and bundled: merge-conflict markers,
|
|
114
114
|
secret scan, diff security (JS/TS/Python/Go/Kotlin), GitHub Actions and Dockerfile
|
|
@@ -118,7 +118,7 @@ skipped, not failed.
|
|
|
118
118
|
- Dependencies (7) — unused/missing, circular, outdated, license compliance, npm audit,
|
|
119
119
|
a cross-language vuln scan (osv-scanner, opt-in), and a direct-dependency vuln scan
|
|
120
120
|
(grype, on by default).
|
|
121
|
-
- Quality (
|
|
121
|
+
- Quality (5) — duplicate code, dead code, multi-language spellcheck, markdown lint, YAML lint.
|
|
122
122
|
- PR hygiene (4) — size, title, body, and commit-message convention.
|
|
123
123
|
- Per-language (16) — lint, format, and type-check for the languages listed above.
|
|
124
124
|
|
package/dist/cli.js
CHANGED
package/dist/config/constants.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Check } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Bundled YAML linter (the `yaml` package — no runner dependency, always
|
|
4
|
+
* available like Markdown/Spellcheck). Parses every changed `.yml`/`.yaml` file
|
|
5
|
+
* and reports the parser's own errors and warnings: syntax errors, duplicate map
|
|
6
|
+
* keys, tabs used as indentation, and other structural problems. Multi-document
|
|
7
|
+
* files (`---`-separated) are each parsed. ON by default — runs unless
|
|
8
|
+
* `yamlLint.enabled` is explicitly `false`. Findings are a hard error by default
|
|
9
|
+
* (a YAML problem fails the run); downgrade to advisory with
|
|
10
|
+
* `yamlLint.severity: "warn"`. Clients can exclude paths with `yamlLint.ignore`
|
|
11
|
+
* (glob patterns) in pr-checkmate.json.
|
|
12
|
+
*/
|
|
13
|
+
export declare const yamlLintCheck: Check;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.yamlLintCheck = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const yaml_1 = require("yaml");
|
|
10
|
+
const utils_1 = require("../../../utils");
|
|
11
|
+
const targets_1 = require("../../targets");
|
|
12
|
+
const types_1 = require("../../types");
|
|
13
|
+
const findings_1 = require("../findings");
|
|
14
|
+
/** First line of a `yaml` error/warning message, stripped of its source excerpt. */
|
|
15
|
+
function shortMessage(message) {
|
|
16
|
+
return message.split('\n')[0].trim();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bundled YAML linter (the `yaml` package — no runner dependency, always
|
|
20
|
+
* available like Markdown/Spellcheck). Parses every changed `.yml`/`.yaml` file
|
|
21
|
+
* and reports the parser's own errors and warnings: syntax errors, duplicate map
|
|
22
|
+
* keys, tabs used as indentation, and other structural problems. Multi-document
|
|
23
|
+
* files (`---`-separated) are each parsed. ON by default — runs unless
|
|
24
|
+
* `yamlLint.enabled` is explicitly `false`. Findings are a hard error by default
|
|
25
|
+
* (a YAML problem fails the run); downgrade to advisory with
|
|
26
|
+
* `yamlLint.severity: "warn"`. Clients can exclude paths with `yamlLint.ignore`
|
|
27
|
+
* (glob patterns) in pr-checkmate.json.
|
|
28
|
+
*/
|
|
29
|
+
exports.yamlLintCheck = {
|
|
30
|
+
name: 'YAML Lint',
|
|
31
|
+
phase: 'blocking',
|
|
32
|
+
applies(ctx) {
|
|
33
|
+
return ctx.config.yamlLint?.enabled !== false;
|
|
34
|
+
},
|
|
35
|
+
async run(ctx) {
|
|
36
|
+
const allTargets = await (0, targets_1.resolveTargetFiles)(ctx, ['*.yml', '*.yaml']);
|
|
37
|
+
if (allTargets === null)
|
|
38
|
+
return (0, types_1.skip)('git unavailable');
|
|
39
|
+
if (allTargets.length === 0)
|
|
40
|
+
return (0, types_1.skip)('no YAML files');
|
|
41
|
+
const ignore = ctx.config.yamlLint?.ignore ?? [];
|
|
42
|
+
const targets = ignore.length > 0 ? allTargets.filter(f => !(0, utils_1.matchesAnyGlob)(f, ignore)) : allTargets;
|
|
43
|
+
if (targets.length === 0)
|
|
44
|
+
return (0, types_1.skip)('all YAML files ignored');
|
|
45
|
+
const issues = [];
|
|
46
|
+
for (const file of targets) {
|
|
47
|
+
let source;
|
|
48
|
+
try {
|
|
49
|
+
source = node_fs_1.default.readFileSync(node_path_1.default.join(ctx.cwd, file), 'utf-8');
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
utils_1.logger.warn(`[YAML Lint]: ⚠️ Could not read ${file}: ${err}`);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// parseAllDocuments never throws — it collects problems on each document,
|
|
56
|
+
// so a single malformed file cannot abort the whole check.
|
|
57
|
+
const docs = (0, yaml_1.parseAllDocuments)(source, { prettyErrors: true });
|
|
58
|
+
for (const doc of docs) {
|
|
59
|
+
for (const problem of [...doc.errors, ...doc.warnings]) {
|
|
60
|
+
const pos = problem.linePos?.[0];
|
|
61
|
+
issues.push({
|
|
62
|
+
file,
|
|
63
|
+
line: pos?.line,
|
|
64
|
+
col: pos?.col,
|
|
65
|
+
message: shortMessage(problem.message),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (issues.length === 0)
|
|
71
|
+
return (0, types_1.pass)();
|
|
72
|
+
// YAML problems are a hard error by default; a repo may downgrade to `warn`
|
|
73
|
+
// via `yamlLint.severity`.
|
|
74
|
+
const sev = (0, findings_1.severityEmitter)(ctx.config.yamlLint?.severity, 'error');
|
|
75
|
+
issues.slice(0, 10).forEach(i => {
|
|
76
|
+
const where = i.line ? `:${i.line}${i.col ? `:${i.col}` : ''}` : '';
|
|
77
|
+
sev.log(`[YAML Lint]: ${sev.icon} ${i.file}${where} — ${i.message}`);
|
|
78
|
+
});
|
|
79
|
+
if (issues.length > 10)
|
|
80
|
+
sev.log(`[YAML Lint]: ... and ${issues.length - 10} more`);
|
|
81
|
+
return sev.emit(`${issues.length} YAML issue(s) found`);
|
|
82
|
+
},
|
|
83
|
+
};
|
package/dist/core/registry.js
CHANGED
|
@@ -45,6 +45,7 @@ const duplicate_check_1 = require("./checks/quality/duplicate-check");
|
|
|
45
45
|
const license_header_1 = require("./checks/quality/license-header");
|
|
46
46
|
const markdown_lint_1 = require("./checks/quality/markdown-lint");
|
|
47
47
|
const spellcheck_1 = require("./checks/quality/spellcheck");
|
|
48
|
+
const yaml_lint_1 = require("./checks/quality/yaml-lint");
|
|
48
49
|
const diff_security_1 = require("./checks/security/diff-security");
|
|
49
50
|
const dockerfile_security_1 = require("./checks/security/dockerfile-security");
|
|
50
51
|
const migration_safety_1 = require("./checks/security/migration-safety");
|
|
@@ -93,6 +94,7 @@ exports.REGISTRY = [
|
|
|
93
94
|
outdated_deps_1.outdatedDepsCheck,
|
|
94
95
|
markdown_lint_1.markdownLintCheck,
|
|
95
96
|
spellcheck_1.spellcheckCheck,
|
|
97
|
+
yaml_lint_1.yamlLintCheck,
|
|
96
98
|
python_lint_1.pythonLintCheck,
|
|
97
99
|
python_typecheck_1.pythonTypecheckCheck,
|
|
98
100
|
dead_code_1.deadCodeCheck,
|
package/dist/init.js
CHANGED
|
@@ -68,6 +68,14 @@ const DEFAULT_CONFIG = {
|
|
|
68
68
|
rules: {},
|
|
69
69
|
ignores: [],
|
|
70
70
|
},
|
|
71
|
+
// YAML lint (bundled `yaml` parser). Reports syntax errors, duplicate keys,
|
|
72
|
+
// and tab/indentation problems in .yml/.yaml files. Blocking by default
|
|
73
|
+
// (severity "error"); set severity "warn" to make it advisory, or enabled
|
|
74
|
+
// false to disable. `ignore` takes glob patterns to skip (e.g. "charts/**").
|
|
75
|
+
yamlLint: {
|
|
76
|
+
enabled: true,
|
|
77
|
+
ignore: [],
|
|
78
|
+
},
|
|
71
79
|
// TypeScript type check
|
|
72
80
|
typecheck: {
|
|
73
81
|
enabled: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pr-checkmate",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.6",
|
|
4
4
|
"description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github-actions",
|
|
@@ -99,7 +99,8 @@
|
|
|
99
99
|
"prettier": ">=3.0.0",
|
|
100
100
|
"ts-node": "^10.9.1",
|
|
101
101
|
"ts-unused-exports": "^11.0.1",
|
|
102
|
-
"typescript": "^6.0.3"
|
|
102
|
+
"typescript": "^6.0.3",
|
|
103
|
+
"yaml": "^2.9.0"
|
|
103
104
|
},
|
|
104
105
|
"devDependencies": {
|
|
105
106
|
"standard-version": "^9.5.0",
|
package/pr-checkmate.schema.json
CHANGED
|
@@ -148,6 +148,14 @@
|
|
|
148
148
|
"caseCollision": { "$ref": "#/$defs/toggle" },
|
|
149
149
|
"sensitiveFileGuard": { "$ref": "#/$defs/toggle" },
|
|
150
150
|
"configValidation": { "$ref": "#/$defs/toggle" },
|
|
151
|
+
"yamlLint": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"properties": {
|
|
154
|
+
"enabled": { "type": "boolean" },
|
|
155
|
+
"severity": { "enum": ["error", "warn"] },
|
|
156
|
+
"ignore": { "type": "array", "items": { "type": "string" } }
|
|
157
|
+
}
|
|
158
|
+
},
|
|
151
159
|
"typecheck": { "$ref": "#/$defs/toggle" },
|
|
152
160
|
"prBody": {
|
|
153
161
|
"type": "object",
|
|
@@ -148,6 +148,14 @@
|
|
|
148
148
|
"caseCollision": { "$ref": "#/$defs/toggle" },
|
|
149
149
|
"sensitiveFileGuard": { "$ref": "#/$defs/toggle" },
|
|
150
150
|
"configValidation": { "$ref": "#/$defs/toggle" },
|
|
151
|
+
"yamlLint": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"properties": {
|
|
154
|
+
"enabled": { "type": "boolean" },
|
|
155
|
+
"severity": { "enum": ["error", "warn"] },
|
|
156
|
+
"ignore": { "type": "array", "items": { "type": "string" } }
|
|
157
|
+
}
|
|
158
|
+
},
|
|
151
159
|
"typecheck": { "$ref": "#/$defs/toggle" },
|
|
152
160
|
"prBody": {
|
|
153
161
|
"type": "object",
|