@webpieces/code-rules 0.4.819 → 0.4.821

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 (90) hide show
  1. package/package.json +2 -2
  2. package/src/api-lib-source-rule.d.ts +5 -2
  3. package/src/api-lib-source-rule.js +8 -4
  4. package/src/api-lib-source-rule.js.map +1 -1
  5. package/src/cli.js +13 -14
  6. package/src/cli.js.map +1 -1
  7. package/src/code-rules-bootstrap.d.ts +31 -8
  8. package/src/code-rules-bootstrap.js +136 -18
  9. package/src/code-rules-bootstrap.js.map +1 -1
  10. package/src/code-rules-config-table.d.ts +3 -1
  11. package/src/code-rules-config-table.js +0 -6
  12. package/src/code-rules-config-table.js.map +1 -1
  13. package/src/code-rules-engine.d.ts +4 -13
  14. package/src/code-rules-engine.js +9 -31
  15. package/src/code-rules-engine.js.map +1 -1
  16. package/src/code-rules-run-request.d.ts +30 -34
  17. package/src/code-rules-run-request.js +43 -80
  18. package/src/code-rules-run-request.js.map +1 -1
  19. package/src/index.d.ts +3 -1
  20. package/src/index.js +13 -2
  21. package/src/index.js.map +1 -1
  22. package/src/resolve-mode.d.ts +1 -1
  23. package/src/resolve-mode.js +2 -3
  24. package/src/resolve-mode.js.map +1 -1
  25. package/src/scan-scope.d.ts +82 -0
  26. package/src/scan-scope.js +200 -0
  27. package/src/scan-scope.js.map +1 -0
  28. package/src/validate-catch-error-pattern.d.ts +3 -1
  29. package/src/validate-catch-error-pattern.js +11 -6
  30. package/src/validate-catch-error-pattern.js.map +1 -1
  31. package/src/validate-code.d.ts +4 -5
  32. package/src/validate-code.js +6 -17
  33. package/src/validate-code.js.map +1 -1
  34. package/src/validate-inject-annotation-not-needed-for-concrete-class.d.ts +3 -1
  35. package/src/validate-inject-annotation-not-needed-for-concrete-class.js +11 -6
  36. package/src/validate-inject-annotation-not-needed-for-concrete-class.js.map +1 -1
  37. package/src/validate-match-rules.d.ts +3 -0
  38. package/src/validate-match-rules.js +10 -3
  39. package/src/validate-match-rules.js.map +1 -1
  40. package/src/validate-no-any-unknown.d.ts +3 -1
  41. package/src/validate-no-any-unknown.js +11 -6
  42. package/src/validate-no-any-unknown.js.map +1 -1
  43. package/src/validate-no-client-creation-outside-server-or-client.d.ts +4 -2
  44. package/src/validate-no-client-creation-outside-server-or-client.js +10 -5
  45. package/src/validate-no-client-creation-outside-server-or-client.js.map +1 -1
  46. package/src/validate-no-custom-css.d.ts +4 -2
  47. package/src/validate-no-custom-css.js +9 -5
  48. package/src/validate-no-custom-css.js.map +1 -1
  49. package/src/validate-no-destructure.d.ts +3 -1
  50. package/src/validate-no-destructure.js +11 -6
  51. package/src/validate-no-destructure.js.map +1 -1
  52. package/src/validate-no-function-outside-class.d.ts +3 -1
  53. package/src/validate-no-function-outside-class.js +12 -6
  54. package/src/validate-no-function-outside-class.js.map +1 -1
  55. package/src/validate-no-implicit-any.d.ts +3 -1
  56. package/src/validate-no-implicit-any.js +13 -8
  57. package/src/validate-no-implicit-any.js.map +1 -1
  58. package/src/validate-no-inline-import-in-api-lib.d.ts +2 -1
  59. package/src/validate-no-inline-import-in-api-lib.js +4 -3
  60. package/src/validate-no-inline-import-in-api-lib.js.map +1 -1
  61. package/src/validate-no-process-exit-outside-main.d.ts +3 -1
  62. package/src/validate-no-process-exit-outside-main.js +12 -6
  63. package/src/validate-no-process-exit-outside-main.js.map +1 -1
  64. package/src/validate-no-state-paths-in-templates.d.ts +4 -2
  65. package/src/validate-no-state-paths-in-templates.js +9 -5
  66. package/src/validate-no-state-paths-in-templates.js.map +1 -1
  67. package/src/validate-no-symbol-di-tokens.d.ts +3 -1
  68. package/src/validate-no-symbol-di-tokens.js +11 -6
  69. package/src/validate-no-symbol-di-tokens.js.map +1 -1
  70. package/src/validate-no-unmanaged-exceptions.d.ts +3 -1
  71. package/src/validate-no-unmanaged-exceptions.js +11 -6
  72. package/src/validate-no-unmanaged-exceptions.js.map +1 -1
  73. package/src/validate-no-utility-types-in-api-lib.d.ts +2 -1
  74. package/src/validate-no-utility-types-in-api-lib.js +4 -3
  75. package/src/validate-no-utility-types-in-api-lib.js.map +1 -1
  76. package/src/validate-one-enum-spelling-in-api-lib.d.ts +2 -1
  77. package/src/validate-one-enum-spelling-in-api-lib.js +4 -3
  78. package/src/validate-one-enum-spelling-in-api-lib.js.map +1 -1
  79. package/src/validate-required-type-suffix.d.ts +2 -1
  80. package/src/validate-required-type-suffix.js +7 -3
  81. package/src/validate-required-type-suffix.js.map +1 -1
  82. package/src/wp-ci.d.ts +2 -2
  83. package/src/wp-ci.js +11 -5
  84. package/src/wp-ci.js.map +1 -1
  85. package/src/debug-run-report.d.ts +0 -22
  86. package/src/debug-run-report.js +0 -127
  87. package/src/debug-run-report.js.map +0 -1
  88. package/src/rule-scope-plan.d.ts +0 -72
  89. package/src/rule-scope-plan.js +0 -132
  90. package/src/rule-scope-plan.js.map +0 -1
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Which FILES a diff-scoped code rule judges, for every mode it offers — and the one place the per-run
3
+ * `--projects` restriction of the debug run (#1027) is applied.
4
+ *
5
+ * NEW_AND_MODIFIED_CODE — the changed files (the rule then keeps only sites on changed lines)
6
+ * NEW_AND_MODIFIED_FILES — the changed files, whole
7
+ * MODIFIED_PROJECTS — every in-scope file of every project the diff touches, whole, plus the
8
+ * changed files themselves (so it is never narrower than NEW_AND_MODIFIED_FILES)
9
+ * RUN_EVERY_TIME — every in-scope file in the repo, whole, every run
10
+ *
11
+ * The two whole-scope modes are NEW_AND_MODIFIED_FILES over a bigger file set — the rule's own detection,
12
+ * disable handling and failure text are untouched, which is what lets a debug run print exactly what the
13
+ * gate would print. A rule asks {@link ScanScope.files} instead of `getChangedFiles`, and asks
14
+ * {@link ScanScope.isLineScoped} instead of comparing its mode to NEW_AND_MODIFIED_CODE.
15
+ *
16
+ * Every rule that reads its files here also reports its sites through {@link ScanScope.recordSites}, so
17
+ * the debug run can print a count per project without parsing any rule's output.
18
+ */
19
+ import { ChangedFilesOptions, DiffScope, ModifiedCodeMode } from '@webpieces/rules-config';
20
+ /** One nx project: its name and its directory (repo-relative, '/'-separated, no trailing slash). */
21
+ export declare class ProjectEntry {
22
+ readonly name: string;
23
+ readonly dir: string;
24
+ constructor(name: string, dir: string);
25
+ }
26
+ /**
27
+ * The repo's nx projects, found from the `project.json` files git knows about (tracked or untracked,
28
+ * never ignored), and the owner lookup every whole-scope mode and `--projects` filter uses: a file
29
+ * belongs to the DEEPEST project directory containing it.
30
+ */
31
+ export declare class ProjectCatalog {
32
+ private readonly diffScope;
33
+ private cachedRoot;
34
+ private cached;
35
+ constructor(diffScope: DiffScope);
36
+ all(workspaceRoot: string): ProjectEntry[];
37
+ /** The project owning `relFile`, or undefined when no project directory contains it. */
38
+ ownerOf(workspaceRoot: string, relFile: string): ProjectEntry | undefined;
39
+ private load;
40
+ private readName;
41
+ }
42
+ /**
43
+ * The per-run project restriction. Bound at the composition root: `undefined` for every normal run (the
44
+ * gate), the `--projects` names for a debug run. Data-only.
45
+ */
46
+ export declare class ScanRestriction {
47
+ readonly projectNames: readonly string[] | undefined;
48
+ constructor(projectNames: readonly string[] | undefined);
49
+ }
50
+ /** One recorded violating site: which rule, which file. Data-only. */
51
+ export declare class RecordedSite {
52
+ readonly ruleName: string;
53
+ readonly relFile: string;
54
+ constructor(ruleName: string, relFile: string);
55
+ }
56
+ export declare class ScanScope {
57
+ private readonly diffScope;
58
+ private readonly catalog;
59
+ private readonly restriction;
60
+ private readonly sites;
61
+ constructor(diffScope: DiffScope, catalog: ProjectCatalog, restriction: ScanRestriction);
62
+ /** True when the rule keeps only sites on changed lines; every other active mode judges whole files. */
63
+ isLineScoped(mode: ModifiedCodeMode): boolean;
64
+ /**
65
+ * The files a rule in `mode` judges, restricted to the debug run's `--projects` when there is one.
66
+ * `opts` is passed through to the git listing (`tsOnly: false` for a rule that reads templates/CSS).
67
+ */
68
+ files(workspaceRoot: string, mode: ModifiedCodeMode, base: string, head: string | undefined, opts?: ChangedFilesOptions): string[];
69
+ /** Record every violating site a rule found, for the debug run's per-project count. */
70
+ recordSites(ruleName: string, relFiles: readonly string[]): void;
71
+ /** Sites recorded so far, counted per owning project name (`(no project)` for a file outside one). */
72
+ countsByProject(workspaceRoot: string): Map<string, number>;
73
+ private unrestricted;
74
+ private restrict;
75
+ }
76
+ /**
77
+ * The gate's {@link ScanScope} — the diff, no project restriction — for a caller that builds a validator
78
+ * outside the DI container: the single-rule nx executors (`validate-no-any-unknown` and friends) and specs.
79
+ */
80
+ export declare class GateScanScope extends ScanScope {
81
+ constructor();
82
+ }
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ /**
3
+ * Which FILES a diff-scoped code rule judges, for every mode it offers — and the one place the per-run
4
+ * `--projects` restriction of the debug run (#1027) is applied.
5
+ *
6
+ * NEW_AND_MODIFIED_CODE — the changed files (the rule then keeps only sites on changed lines)
7
+ * NEW_AND_MODIFIED_FILES — the changed files, whole
8
+ * MODIFIED_PROJECTS — every in-scope file of every project the diff touches, whole, plus the
9
+ * changed files themselves (so it is never narrower than NEW_AND_MODIFIED_FILES)
10
+ * RUN_EVERY_TIME — every in-scope file in the repo, whole, every run
11
+ *
12
+ * The two whole-scope modes are NEW_AND_MODIFIED_FILES over a bigger file set — the rule's own detection,
13
+ * disable handling and failure text are untouched, which is what lets a debug run print exactly what the
14
+ * gate would print. A rule asks {@link ScanScope.files} instead of `getChangedFiles`, and asks
15
+ * {@link ScanScope.isLineScoped} instead of comparing its mode to NEW_AND_MODIFIED_CODE.
16
+ *
17
+ * Every rule that reads its files here also reports its sites through {@link ScanScope.recordSites}, so
18
+ * the debug run can print a count per project without parsing any rule's output.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.GateScanScope = exports.ScanScope = exports.RecordedSite = exports.ScanRestriction = exports.ProjectCatalog = exports.ProjectEntry = void 0;
22
+ const tslib_1 = require("tslib");
23
+ const fs = tslib_1.__importStar(require("fs"));
24
+ const path = tslib_1.__importStar(require("path"));
25
+ const rules_config_1 = require("@webpieces/rules-config");
26
+ const inversify_1 = require("inversify");
27
+ /** One nx project: its name and its directory (repo-relative, '/'-separated, no trailing slash). */
28
+ class ProjectEntry {
29
+ name;
30
+ dir;
31
+ constructor(name, dir) {
32
+ this.name = name;
33
+ this.dir = dir;
34
+ }
35
+ }
36
+ exports.ProjectEntry = ProjectEntry;
37
+ /**
38
+ * The repo's nx projects, found from the `project.json` files git knows about (tracked or untracked,
39
+ * never ignored), and the owner lookup every whole-scope mode and `--projects` filter uses: a file
40
+ * belongs to the DEEPEST project directory containing it.
41
+ */
42
+ let ProjectCatalog = class ProjectCatalog {
43
+ diffScope;
44
+ cachedRoot;
45
+ cached = [];
46
+ constructor(diffScope) {
47
+ this.diffScope = diffScope;
48
+ }
49
+ all(workspaceRoot) {
50
+ if (this.cachedRoot !== workspaceRoot) {
51
+ this.cached = this.load(workspaceRoot);
52
+ this.cachedRoot = workspaceRoot;
53
+ }
54
+ return this.cached;
55
+ }
56
+ /** The project owning `relFile`, or undefined when no project directory contains it. */
57
+ ownerOf(workspaceRoot, relFile) {
58
+ const file = relFile.split(path.sep).join('/');
59
+ let best;
60
+ for (const project of this.all(workspaceRoot)) {
61
+ const inside = project.dir === '' || file.startsWith(`${project.dir}/`);
62
+ if (inside && (best === undefined || project.dir.length > best.dir.length))
63
+ best = project;
64
+ }
65
+ return best;
66
+ }
67
+ load(workspaceRoot) {
68
+ const jsons = this.diffScope.getAllFiles(workspaceRoot, { tsOnly: false })
69
+ .filter((f) => f === 'project.json' || f.endsWith('/project.json'));
70
+ return jsons.map((rel) => {
71
+ const dir = path.posix.dirname(rel) === '.' ? '' : path.posix.dirname(rel);
72
+ return new ProjectEntry(this.readName(path.join(workspaceRoot, rel)) ?? path.posix.basename(dir), dir);
73
+ });
74
+ }
75
+ readName(fullPath) {
76
+ // webpieces-disable no-unmanaged-exceptions -- add the exact project.json path while preserving the parse/read failure as cause
77
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
78
+ try {
79
+ const parsed = JSON.parse(fs.readFileSync(fullPath, 'utf-8'));
80
+ return typeof parsed.name === 'string' && parsed.name.length > 0 ? parsed.name : undefined;
81
+ }
82
+ catch (err) {
83
+ const error = (0, rules_config_1.toError)(err);
84
+ throw new rules_config_1.InformAiError(`Cannot read nx project identity from ${fullPath} — fix project.json and retry.`, {
85
+ cause: error,
86
+ });
87
+ }
88
+ }
89
+ };
90
+ exports.ProjectCatalog = ProjectCatalog;
91
+ exports.ProjectCatalog = ProjectCatalog = tslib_1.__decorate([
92
+ (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
93
+ tslib_1.__metadata("design:paramtypes", [rules_config_1.DiffScope])
94
+ ], ProjectCatalog);
95
+ /**
96
+ * The per-run project restriction. Bound at the composition root: `undefined` for every normal run (the
97
+ * gate), the `--projects` names for a debug run. Data-only.
98
+ */
99
+ class ScanRestriction {
100
+ projectNames;
101
+ constructor(projectNames) {
102
+ this.projectNames = projectNames;
103
+ }
104
+ }
105
+ exports.ScanRestriction = ScanRestriction;
106
+ /** One recorded violating site: which rule, which file. Data-only. */
107
+ class RecordedSite {
108
+ ruleName;
109
+ relFile;
110
+ constructor(ruleName, relFile) {
111
+ this.ruleName = ruleName;
112
+ this.relFile = relFile;
113
+ }
114
+ }
115
+ exports.RecordedSite = RecordedSite;
116
+ let ScanScope = class ScanScope {
117
+ diffScope;
118
+ catalog;
119
+ restriction;
120
+ sites = [];
121
+ constructor(diffScope, catalog, restriction) {
122
+ this.diffScope = diffScope;
123
+ this.catalog = catalog;
124
+ this.restriction = restriction;
125
+ }
126
+ /** True when the rule keeps only sites on changed lines; every other active mode judges whole files. */
127
+ isLineScoped(mode) {
128
+ return mode === 'NEW_AND_MODIFIED_CODE';
129
+ }
130
+ /**
131
+ * The files a rule in `mode` judges, restricted to the debug run's `--projects` when there is one.
132
+ * `opts` is passed through to the git listing (`tsOnly: false` for a rule that reads templates/CSS).
133
+ */
134
+ files(workspaceRoot, mode, base, head, opts) {
135
+ return this.restrict(workspaceRoot, this.unrestricted(workspaceRoot, mode, base, head, opts));
136
+ }
137
+ /** Record every violating site a rule found, for the debug run's per-project count. */
138
+ recordSites(ruleName, relFiles) {
139
+ for (const relFile of relFiles)
140
+ this.sites.push(new RecordedSite(ruleName, relFile));
141
+ }
142
+ /** Sites recorded so far, counted per owning project name (`(no project)` for a file outside one). */
143
+ countsByProject(workspaceRoot) {
144
+ const counts = new Map();
145
+ for (const site of this.sites) {
146
+ const name = this.catalog.ownerOf(workspaceRoot, site.relFile)?.name ?? '(no project)';
147
+ counts.set(name, (counts.get(name) ?? 0) + 1);
148
+ }
149
+ return counts;
150
+ }
151
+ unrestricted(workspaceRoot, mode, base, head, opts) {
152
+ if (mode === 'RUN_EVERY_TIME')
153
+ return this.diffScope.getAllFiles(workspaceRoot, opts);
154
+ const changed = this.diffScope.getChangedFiles(workspaceRoot, base, head, opts);
155
+ if (mode !== 'MODIFIED_PROJECTS')
156
+ return changed;
157
+ // A project is TOUCHED by any changed file it owns — not only the files this rule reads — so a
158
+ // project.json or README edit counts, exactly as nx affected would see it.
159
+ const touched = new Set();
160
+ for (const f of this.diffScope.getChangedFiles(workspaceRoot, base, head, { tsOnly: false })) {
161
+ const owner = this.catalog.ownerOf(workspaceRoot, f);
162
+ if (owner !== undefined)
163
+ touched.add(owner.dir);
164
+ }
165
+ const inTouched = this.diffScope.getAllFiles(workspaceRoot, opts).filter((f) => {
166
+ const owner = this.catalog.ownerOf(workspaceRoot, f);
167
+ return owner !== undefined && touched.has(owner.dir);
168
+ });
169
+ return Array.from(new Set([...changed, ...inTouched]));
170
+ }
171
+ restrict(workspaceRoot, files) {
172
+ const names = this.restriction.projectNames;
173
+ if (names === undefined)
174
+ return files;
175
+ const wanted = new Set(names);
176
+ return files.filter((f) => {
177
+ const owner = this.catalog.ownerOf(workspaceRoot, f);
178
+ return owner !== undefined && wanted.has(owner.name);
179
+ });
180
+ }
181
+ };
182
+ exports.ScanScope = ScanScope;
183
+ exports.ScanScope = ScanScope = tslib_1.__decorate([
184
+ (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
185
+ tslib_1.__metadata("design:paramtypes", [rules_config_1.DiffScope,
186
+ ProjectCatalog,
187
+ ScanRestriction])
188
+ ], ScanScope);
189
+ /**
190
+ * The gate's {@link ScanScope} — the diff, no project restriction — for a caller that builds a validator
191
+ * outside the DI container: the single-rule nx executors (`validate-no-any-unknown` and friends) and specs.
192
+ */
193
+ class GateScanScope extends ScanScope {
194
+ constructor() {
195
+ const diffScope = new rules_config_1.DiffScope();
196
+ super(diffScope, new ProjectCatalog(diffScope), new ScanRestriction(undefined));
197
+ }
198
+ }
199
+ exports.GateScanScope = GateScanScope;
200
+ //# sourceMappingURL=scan-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-scope.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/scan-scope.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAmH;AACnH,yCAA2D;AAE3D,oGAAoG;AACpG,MAAa,YAAY;IAER;IACA;IAFb,YACa,IAAY,EACZ,GAAW;QADX,SAAI,GAAJ,IAAI,CAAQ;QACZ,QAAG,GAAH,GAAG,CAAQ;IACrB,CAAC;CACP;AALD,oCAKC;AAKD;;;;GAIG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAc;IAIM;IAHrB,UAAU,CAAqB;IAC/B,MAAM,GAAmB,EAAE,CAAC;IAEpC,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAErD,GAAG,CAAC,aAAqB;QACrB,IAAI,IAAI,CAAC,UAAU,KAAK,aAAa,EAAE,CAAC;YACpC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACvC,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC,MAAM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S;YAAE,OAAO,KAAK,CAAC;QACtC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;YACrD,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAhEY,8BAAS;oBAAT,SAAS;IADrB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAKL,wBAAS;QACX,cAAc;QACV,eAAe;GANxC,SAAS,CAgErB;AAED;;;GAGG;AACH,MAAa,aAAc,SAAQ,SAAS;IACxC;QACI,MAAM,SAAS,GAAG,IAAI,wBAAS,EAAE,CAAC;QAClC,KAAK,CAAC,SAAS,EAAE,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;IACpF,CAAC;CACJ;AALD,sCAKC","sourcesContent":["/**\n * Which FILES a diff-scoped code rule judges, for every mode it offers — and the one place the per-run\n * `--projects` restriction of the debug run (#1027) is applied.\n *\n * NEW_AND_MODIFIED_CODE — the changed files (the rule then keeps only sites on changed lines)\n * NEW_AND_MODIFIED_FILES — the changed files, whole\n * MODIFIED_PROJECTS — every in-scope file of every project the diff touches, whole, plus the\n * changed files themselves (so it is never narrower than NEW_AND_MODIFIED_FILES)\n * RUN_EVERY_TIME — every in-scope file in the repo, whole, every run\n *\n * The two whole-scope modes are NEW_AND_MODIFIED_FILES over a bigger file set — the rule's own detection,\n * disable handling and failure text are untouched, which is what lets a debug run print exactly what the\n * gate would print. A rule asks {@link ScanScope.files} instead of `getChangedFiles`, and asks\n * {@link ScanScope.isLineScoped} instead of comparing its mode to NEW_AND_MODIFIED_CODE.\n *\n * Every rule that reads its files here also reports its sites through {@link ScanScope.recordSites}, so\n * the debug run can print a count per project without parsing any rule's output.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { ChangedFilesOptions, DiffScope, InformAiError, ModifiedCodeMode, toError } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\n/** One nx project: its name and its directory (repo-relative, '/'-separated, no trailing slash). */\nexport class ProjectEntry {\n constructor(\n readonly name: string,\n readonly dir: string,\n ) {}\n}\n\n/** The only field of a project.json this catalog reads. */\ntype RawProjectName = { name?: string };\n\n/**\n * The repo's nx projects, found from the `project.json` files git knows about (tracked or untracked,\n * never ignored), and the owner lookup every whole-scope mode and `--projects` filter uses: a file\n * belongs to the DEEPEST project directory containing it.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ProjectCatalog {\n private cachedRoot: string | undefined;\n private cached: ProjectEntry[] = [];\n\n constructor(private readonly diffScope: DiffScope) {}\n\n all(workspaceRoot: string): ProjectEntry[] {\n if (this.cachedRoot !== workspaceRoot) {\n this.cached = this.load(workspaceRoot);\n this.cachedRoot = workspaceRoot;\n }\n return this.cached;\n }\n\n /** The project owning `relFile`, or undefined when no project directory contains it. */\n ownerOf(workspaceRoot: string, relFile: string): ProjectEntry | undefined {\n const file = relFile.split(path.sep).join('/');\n let best: ProjectEntry | undefined;\n for (const project of this.all(workspaceRoot)) {\n const inside = project.dir === '' || file.startsWith(`${project.dir}/`);\n if (inside && (best === undefined || project.dir.length > best.dir.length)) best = project;\n }\n return best;\n }\n\n private load(workspaceRoot: string): ProjectEntry[] {\n const jsons = this.diffScope.getAllFiles(workspaceRoot, { tsOnly: false })\n .filter((f: string) => f === 'project.json' || f.endsWith('/project.json'));\n return jsons.map((rel: string) => {\n const dir = path.posix.dirname(rel) === '.' ? '' : path.posix.dirname(rel);\n return new ProjectEntry(this.readName(path.join(workspaceRoot, rel)) ?? path.posix.basename(dir), dir);\n });\n }\n\n private readName(fullPath: string): string | undefined {\n // webpieces-disable no-unmanaged-exceptions -- add the exact project.json path while preserving the parse/read failure as cause\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const parsed = JSON.parse(fs.readFileSync(fullPath, 'utf-8')) as RawProjectName;\n return typeof parsed.name === 'string' && parsed.name.length > 0 ? parsed.name : undefined;\n } catch (err: unknown) {\n const error = toError(err);\n throw new InformAiError(`Cannot read nx project identity from ${fullPath} — fix project.json and retry.`, {\n cause: error,\n });\n }\n }\n}\n\n/**\n * The per-run project restriction. Bound at the composition root: `undefined` for every normal run (the\n * gate), the `--projects` names for a debug run. Data-only.\n */\nexport class ScanRestriction {\n constructor(readonly projectNames: readonly string[] | undefined) {}\n}\n\n/** One recorded violating site: which rule, which file. Data-only. */\nexport class RecordedSite {\n constructor(\n readonly ruleName: string,\n readonly relFile: string,\n ) {}\n}\n\n@injectable(bindingScopeValues.Singleton)\nexport class ScanScope {\n private readonly sites: RecordedSite[] = [];\n\n constructor(\n private readonly diffScope: DiffScope,\n private readonly catalog: ProjectCatalog,\n private readonly restriction: ScanRestriction,\n ) {}\n\n /** True when the rule keeps only sites on changed lines; every other active mode judges whole files. */\n isLineScoped(mode: ModifiedCodeMode): boolean {\n return mode === 'NEW_AND_MODIFIED_CODE';\n }\n\n /**\n * The files a rule in `mode` judges, restricted to the debug run's `--projects` when there is one.\n * `opts` is passed through to the git listing (`tsOnly: false` for a rule that reads templates/CSS).\n */\n files(workspaceRoot: string, mode: ModifiedCodeMode, base: string, head: string | undefined, opts?: ChangedFilesOptions): string[] {\n return this.restrict(workspaceRoot, this.unrestricted(workspaceRoot, mode, base, head, opts));\n }\n\n /** Record every violating site a rule found, for the debug run's per-project count. */\n recordSites(ruleName: string, relFiles: readonly string[]): void {\n for (const relFile of relFiles) this.sites.push(new RecordedSite(ruleName, relFile));\n }\n\n /** Sites recorded so far, counted per owning project name (`(no project)` for a file outside one). */\n countsByProject(workspaceRoot: string): Map<string, number> {\n const counts = new Map<string, number>();\n for (const site of this.sites) {\n const name = this.catalog.ownerOf(workspaceRoot, site.relFile)?.name ?? '(no project)';\n counts.set(name, (counts.get(name) ?? 0) + 1);\n }\n return counts;\n }\n\n private unrestricted(workspaceRoot: string, mode: ModifiedCodeMode, base: string, head: string | undefined, opts?: ChangedFilesOptions): string[] {\n if (mode === 'RUN_EVERY_TIME') return this.diffScope.getAllFiles(workspaceRoot, opts);\n const changed = this.diffScope.getChangedFiles(workspaceRoot, base, head, opts);\n if (mode !== 'MODIFIED_PROJECTS') return changed;\n // A project is TOUCHED by any changed file it owns — not only the files this rule reads — so a\n // project.json or README edit counts, exactly as nx affected would see it.\n const touched = new Set<string>();\n for (const f of this.diffScope.getChangedFiles(workspaceRoot, base, head, { tsOnly: false })) {\n const owner = this.catalog.ownerOf(workspaceRoot, f);\n if (owner !== undefined) touched.add(owner.dir);\n }\n const inTouched = this.diffScope.getAllFiles(workspaceRoot, opts).filter((f: string) => {\n const owner = this.catalog.ownerOf(workspaceRoot, f);\n return owner !== undefined && touched.has(owner.dir);\n });\n return Array.from(new Set([...changed, ...inTouched]));\n }\n\n private restrict(workspaceRoot: string, files: string[]): string[] {\n const names = this.restriction.projectNames;\n if (names === undefined) return files;\n const wanted = new Set(names);\n return files.filter((f: string) => {\n const owner = this.catalog.ownerOf(workspaceRoot, f);\n return owner !== undefined && wanted.has(owner.name);\n });\n }\n}\n\n/**\n * The gate's {@link ScanScope} — the diff, no project restriction — for a caller that builds a validator\n * outside the DI container: the single-rule nx executors (`validate-no-any-unknown` and friends) and specs.\n */\nexport class GateScanScope extends ScanScope {\n constructor() {\n const diffScope = new DiffScope();\n super(diffScope, new ProjectCatalog(diffScope), new ScanRestriction(undefined));\n }\n}\n"]}
@@ -37,7 +37,9 @@
37
37
  */
38
38
  import { CatchErrorPatternConfig } from '@webpieces/rules-config';
39
39
  import { CodeValidator, ExecutorResult } from './code-validator';
40
+ import { ScanScope } from './scan-scope';
40
41
  export declare class CatchErrorPatternValidator extends CodeValidator<CatchErrorPatternConfig> {
41
- constructor(config: CatchErrorPatternConfig);
42
+ private readonly scanScope;
43
+ constructor(config: CatchErrorPatternConfig, scanScope: ScanScope);
42
44
  run(workspaceRoot: string): Promise<ExecutorResult>;
43
45
  }
@@ -46,6 +46,7 @@ const rules_config_1 = require("@webpieces/rules-config");
46
46
  const code_validator_1 = require("./code-validator");
47
47
  const inversify_1 = require("inversify");
48
48
  const resolve_mode_1 = require("./resolve-mode");
49
+ const scan_scope_1 = require("./scan-scope");
49
50
  /**
50
51
  * Check if a line contains a disable comment for catch-error-pattern.
51
52
  * Recognizes both webpieces-disable and eslint-disable-next-line @webpieces/ formats.
@@ -330,7 +331,7 @@ function resolveMode(normalMode, epoch, branchPattern) {
330
331
  }
331
332
  return normalMode;
332
333
  }
333
- async function runValidatorImpl(options, workspaceRoot) {
334
+ async function runValidatorImpl(scan, options, workspaceRoot) {
334
335
  const mode = resolveMode(options.mode ?? 'OFF', options.turnOffRuleUntilEpoch, (options.turnOffRuleWhileOnBranch ?? undefined));
335
336
  const disableAllowed = options.disableAllowed ?? true;
336
337
  if (mode === 'OFF') {
@@ -353,7 +354,7 @@ async function runValidatorImpl(options, workspaceRoot) {
353
354
  console.log(` Base: ${base}`);
354
355
  console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);
355
356
  console.log('');
356
- const changedFiles = (0, rules_config_1.getChangedFiles)(workspaceRoot, base, head);
357
+ const changedFiles = scan.files(workspaceRoot, mode, base, head);
357
358
  if (changedFiles.length === 0) {
358
359
  console.log('\u2705 No TypeScript files changed');
359
360
  return { success: true };
@@ -363,27 +364,31 @@ async function runValidatorImpl(options, workspaceRoot) {
363
364
  if (mode === 'NEW_AND_MODIFIED_CODE') {
364
365
  violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);
365
366
  }
366
- else if (mode === 'NEW_AND_MODIFIED_FILES') {
367
+ else {
368
+ // NEW_AND_MODIFIED_FILES and the whole-scope modes (#1027) all judge every site of every file.
367
369
  violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);
368
370
  }
369
371
  if (violations.length === 0) {
370
372
  console.log('\u2705 No catch error pattern violations found');
371
373
  return { success: true };
372
374
  }
375
+ scan.recordSites('catch-error-pattern', violations.map((v) => v.file));
373
376
  reportViolations(violations, mode, disableAllowed);
374
377
  return { success: false };
375
378
  }
376
379
  let CatchErrorPatternValidator = class CatchErrorPatternValidator extends code_validator_1.CodeValidator {
377
- constructor(config) {
380
+ scanScope;
381
+ constructor(config, scanScope) {
378
382
  super(config, 'catch-error-pattern', 'catch-error-pattern');
383
+ this.scanScope = scanScope;
379
384
  }
380
385
  async run(workspaceRoot) {
381
- return runValidatorImpl(this.config, workspaceRoot);
386
+ return runValidatorImpl(this.scanScope, this.config, workspaceRoot);
382
387
  }
383
388
  };
384
389
  exports.CatchErrorPatternValidator = CatchErrorPatternValidator;
385
390
  exports.CatchErrorPatternValidator = CatchErrorPatternValidator = tslib_1.__decorate([
386
391
  (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
387
- tslib_1.__metadata("design:paramtypes", [rules_config_1.CatchErrorPatternConfig])
392
+ tslib_1.__metadata("design:paramtypes", [rules_config_1.CatchErrorPatternConfig, scan_scope_1.ScanScope])
388
393
  ], CatchErrorPatternValidator);
389
394
  //# sourceMappingURL=validate-catch-error-pattern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-catch-error-pattern.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-catch-error-pattern.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AACjC,0DAA6K;AAC7K,qDAAiE;AACjE,yCAA2D;AAC3D,iDAAgD;AAgBhD;;;GAGG;AACH,SAAS,iBAAiB,CAAC,KAAe,EAAE,UAAkB;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,GAA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,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;QAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,UAAU,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC;AAGM,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,8BAAsC;IAClF,YAAY,MAA+B;QACvC,KAAK,CAAC,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,aAAqB;QAC3B,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxD,CAAC;CACJ,CAAA;AARY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEjB,sCAAuB;GADlC,0BAA0B,CAQtC","sourcesContent":["/**\n * Validate Catch Error Pattern Executor\n *\n * Validates that catch blocks follow the standardized error handling pattern.\n * Uses TypeScript AST for detection and LINE-BASED git diff filtering.\n *\n * ============================================================================\n * REQUIRED PATTERN\n * ============================================================================\n *\n * Standard: catch (err: unknown) { const error = toError(err); ... }\n * Ignored: catch (err: unknown) { //const error = toError(err); ... }\n * Nested: catch (err2: unknown) { const error2 = toError(err2); ... }\n *\n * ============================================================================\n * VIOLATIONS (BAD) - These patterns are flagged:\n * ============================================================================\n *\n * - catch (e) { ... } — wrong parameter name\n * - catch (err) { ... } — missing : unknown type annotation\n * - catch (err: unknown) { ... } — missing toError() as first statement\n * - catch (err: unknown) { const x = toError(err); } — wrong variable name\n *\n * ============================================================================\n * MODES (LINE-BASED)\n * ============================================================================\n * - OFF: Skip validation entirely\n * - NEW_AND_MODIFIED_CODE: Flag catch violations on changed lines (lines in diff hunks)\n * - NEW_AND_MODIFIED_FILES: Flag ALL catch violations in files that were modified\n *\n * ============================================================================\n * ESCAPE HATCH\n * ============================================================================\n * Add comment above the violation:\n * // webpieces-disable catch-error-pattern -- [your justification]\n * } catch (err: unknown) {\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { hasDisable, RULE_NAMES, CatchErrorPatternConfig, ModifiedCodeMode, detectBase, getChangedFiles, getFileDiff, getChangedLineNumbers } from '@webpieces/rules-config';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { shouldSkipRule } from './resolve-mode';\n\ninterface CatchViolation {\n file: string;\n line: number;\n message: string;\n context: string;\n}\n\ninterface CatchViolationInfo {\n line: number;\n message: string;\n context: string;\n hasDisableComment: boolean;\n}\n\n/**\n * Check if a line contains a disable comment for catch-error-pattern.\n * Recognizes both webpieces-disable and eslint-disable-next-line @webpieces/ formats.\n */\nfunction hasDisableComment(lines: string[], lineNumber: number): boolean {\n const startCheck = Math.max(0, lineNumber - 5);\n for (let i = lineNumber - 2; i >= startCheck; i--) {\n const line = lines[i]?.trim() ?? '';\n if (line.startsWith('function ') || line.startsWith('class ') || line.endsWith('}')) {\n break;\n }\n if (hasDisable(line, RULE_NAMES.CATCH_ERROR_PATTERN)) {\n return true;\n }\n if (line.includes('@webpieces/catch-error-pattern')) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if the catch block contains a disable comment for catch-error-pattern.\n */\nfunction hasBlockLevelDisable(sourceText: string, blockStart: number, blockEnd: number): boolean {\n const blockText = sourceText.substring(blockStart, blockEnd);\n return hasDisable(blockText, RULE_NAMES.CATCH_ERROR_PATTERN) ||\n blockText.includes('@webpieces/catch-error-pattern');\n}\n\n/**\n * Check if the catch block body text contains the commented-out ignore pattern.\n */\nfunction hasIgnoreComment(\n sourceText: string,\n blockStart: number,\n blockEnd: number,\n expectedVarName: string,\n actualParamName: string,\n): boolean {\n const blockText = sourceText.substring(blockStart, blockEnd);\n const ignorePattern = new RegExp(\n `//\\\\s*const\\\\s+${expectedVarName}\\\\s*=\\\\s*toError\\\\(${actualParamName}\\\\)`,\n );\n return ignorePattern.test(blockText);\n}\n\n/**\n * Validate a single CatchClause node.\n */\n// webpieces-disable max-lines-new-methods -- AST validation with multiple check paths for param name, type, and toError\nfunction validateCatchClause(\n node: ts.CatchClause,\n sourceFile: ts.SourceFile,\n fileLines: string[],\n depth: number,\n disableAllowed: boolean,\n): CatchViolationInfo[] {\n const violations: CatchViolationInfo[] = [];\n const suffix = depth === 1 ? '' : String(depth);\n const expectedParam = 'err' + suffix;\n const expectedVar = 'error' + suffix;\n\n const catchLine = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;\n const catchContext = fileLines[catchLine - 1]?.trim() ?? '';\n const blockStart = node.block.getStart(sourceFile);\n const blockEnd = node.block.getEnd();\n const disabled = hasDisableComment(fileLines, catchLine) ||\n hasBlockLevelDisable(sourceFile.text, blockStart, blockEnd);\n\n const varDecl = node.variableDeclaration;\n if (!varDecl) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch clause must declare a parameter: catch (${expectedParam}: unknown)`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n return violations;\n }\n\n const actualParam = ts.isIdentifier(varDecl.name) ? varDecl.name.text : expectedParam;\n\n // Check parameter name\n if (ts.isIdentifier(varDecl.name) && varDecl.name.text !== expectedParam) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch parameter must be named \"${expectedParam}\" (or \"err2\", \"err3\" for nested), got \"${varDecl.name.text}\"`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n }\n\n // Check type annotation is : unknown\n if (!varDecl.type || varDecl.type.kind !== ts.SyntaxKind.UnknownKeyword) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch parameter must be typed as \"unknown\": catch (${actualParam}: unknown)`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n }\n\n // Check for commented-out ignore pattern\n if (hasIgnoreComment(sourceFile.text, blockStart, blockEnd, expectedVar, actualParam)) {\n return violations;\n }\n\n // Check first statement is const error = toError(err)\n if (node.block.statements.length === 0) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch block must call toError(${actualParam}) as first statement: const ${expectedVar} = toError(${actualParam});`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n return violations;\n }\n\n const firstStmt = node.block.statements[0];\n const toErrorViolation = validateToErrorStatement(firstStmt, sourceFile, fileLines, expectedParam, expectedVar, actualParam, disabled, disableAllowed);\n if (toErrorViolation) {\n violations.push(toErrorViolation);\n }\n\n return violations;\n}\n\nfunction resolveDisable(disabled: boolean, disableAllowed: boolean): boolean {\n if (!disableAllowed && disabled) {\n return false;\n }\n return disabled;\n}\n\n/**\n * Validate that the first statement is `const error = toError(err);`\n */\n// webpieces-disable max-lines-new-methods -- Deep AST check for variable declaration with toError call expression\nfunction validateToErrorStatement(\n stmt: ts.Statement,\n sourceFile: ts.SourceFile,\n fileLines: string[],\n expectedParam: string,\n expectedVar: string,\n actualParam: string,\n disabled: boolean,\n disableAllowed: boolean,\n): CatchViolationInfo | null {\n const stmtLine = sourceFile.getLineAndCharacterOfPosition(stmt.getStart(sourceFile)).line + 1;\n const stmtContext = fileLines[stmtLine - 1]?.trim() ?? '';\n\n if (!ts.isVariableStatement(stmt)) {\n return {\n line: stmtLine,\n message: `First statement in catch must be: const ${expectedVar} = toError(${actualParam});`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n const declarations = stmt.declarationList.declarations;\n if (declarations.length === 0) {\n return {\n line: stmtLine,\n message: `First statement in catch must be: const ${expectedVar} = toError(${actualParam});`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n const decl = declarations[0];\n\n // Check variable name\n if (ts.isIdentifier(decl.name) && decl.name.text !== expectedVar) {\n return {\n line: stmtLine,\n message: `Error variable must be named \"${expectedVar}\", got \"${decl.name.text}\"`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n // Check initializer is toError(actualParam)\n const init = decl.initializer;\n if (!init || !ts.isCallExpression(init)) {\n return {\n line: stmtLine,\n message: `First statement in catch must be: const ${expectedVar} = toError(${actualParam});`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n if (!ts.isIdentifier(init.expression) || init.expression.text !== 'toError') {\n return {\n line: stmtLine,\n message: `First statement in catch must call toError(), not \"${init.expression.getText(sourceFile)}\"`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n // Check argument\n const args = init.arguments;\n if (args.length !== 1 || !ts.isIdentifier(args[0]) || args[0].text !== actualParam) {\n return {\n line: stmtLine,\n message: `toError() must be called with \"${actualParam}\"`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n return null;\n}\n\n/**\n * Find all catch pattern violations in a file using AST.\n */\nfunction findCatchViolationsInFile(\n filePath: string,\n workspaceRoot: string,\n disableAllowed: boolean,\n): CatchViolationInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const violations: CatchViolationInfo[] = [];\n let catchDepth = 0;\n\n function visit(node: ts.Node): void {\n if (ts.isCatchClause(node)) {\n catchDepth++;\n const clauseViolations = validateCatchClause(node, sourceFile, fileLines, catchDepth, disableAllowed);\n violations.push(...clauseViolations);\n ts.forEachChild(node, visit);\n catchDepth--;\n return;\n }\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\n/**\n * NEW_AND_MODIFIED_CODE mode: Flag violations on changed lines.\n */\nfunction findViolationsForModifiedCode(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean,\n): CatchViolation[] {\n const violations: CatchViolation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n\n if (changedLines.size === 0) continue;\n\n const allViolations = findCatchViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n if (!changedLines.has(v.line)) continue;\n\n violations.push({ file, line: v.line, message: v.message, context: v.context });\n }\n }\n\n return violations;\n}\n\n/**\n * NEW_AND_MODIFIED_FILES mode: Flag ALL violations in modified files.\n */\nfunction findViolationsForModifiedFiles(\n workspaceRoot: string,\n changedFiles: string[],\n disableAllowed: boolean,\n): CatchViolation[] {\n const violations: CatchViolation[] = [];\n\n for (const file of changedFiles) {\n const allViolations = findCatchViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n violations.push({ file, line: v.line, message: v.message, context: v.context });\n }\n }\n\n return violations;\n}\n\n/**\n * Report violations to console.\n */\n// webpieces-disable max-lines-new-methods -- Console output with pattern examples and escape hatch\nfunction reportViolations(violations: CatchViolation[], mode: ModifiedCodeMode, disableAllowed: boolean): void {\n console.error('');\n console.error('\\u274c Catch blocks must follow the standardized error handling pattern!');\n console.error('');\n console.error('\\ud83d\\udcda Required pattern:');\n console.error('');\n console.error(' catch (err: unknown) {');\n console.error(' const error = toError(err);');\n console.error(' // ... use error ...');\n console.error(' }');\n console.error('');\n console.error(' Or to explicitly ignore:');\n console.error(' catch (err: unknown) {');\n console.error(' //const error = toError(err);');\n console.error(' }');\n console.error('');\n console.error(' For nested catches: err2/error2, err3/error3, etc.');\n console.error('');\n\n for (const v of violations) {\n console.error(` \\u274c ${v.file}:${v.line}`);\n console.error(` ${v.message}`);\n console.error(` ${v.context}`);\n }\n console.error('');\n\n if (disableAllowed) {\n console.error(' Escape hatch (use sparingly):');\n console.error(' // webpieces-disable catch-error-pattern -- [your reason]');\n } else {\n console.error(' Escape hatch: DISABLED (disableAllowed: false)');\n console.error(' Disable comments are ignored. Fix the catch block directly.');\n }\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\n/**\n * Resolve mode considering turnOffRuleUntilEpoch override.\n */\nfunction resolveMode(normalMode: ModifiedCodeMode, epoch: number | undefined, branchPattern: string | undefined): ModifiedCodeMode {\n if (normalMode === 'OFF') {\n return normalMode;\n }\n const skip = shouldSkipRule(epoch, branchPattern);\n if (skip.skip) {\n console.log(`\\n\\u23ed\\ufe0f Skipping catch-error-pattern validation (${skip.reason})`);\n console.log('');\n return 'OFF';\n }\n return normalMode;\n}\n\nasync function runValidatorImpl(\n options: CatchErrorPatternConfig,\n workspaceRoot: string\n): Promise<ExecutorResult> {\n const mode: ModifiedCodeMode = resolveMode(options.mode ?? 'OFF', options.turnOffRuleUntilEpoch, (options.turnOffRuleWhileOnBranch ?? undefined));\n const disableAllowed = options.disableAllowed ?? true;\n\n if (mode === 'OFF') {\n console.log('\\n\\u23ed\\ufe0f Skipping catch-error-pattern validation (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n console.log('\\n\\ud83d\\udccf Validating Catch Error Pattern\\n');\n console.log(` Mode: ${mode}`);\n\n let base = process.env['NX_BASE'];\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n base = detectBase(workspaceRoot) ?? undefined;\n\n if (!base) {\n console.log('\\n\\u23ed\\ufe0f Skipping catch-error-pattern validation (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const changedFiles = getChangedFiles(workspaceRoot, base, head);\n\n if (changedFiles.length === 0) {\n console.log('\\u2705 No TypeScript files changed');\n return { success: true };\n }\n\n console.log(`\\ud83d\\udcc2 Checking ${changedFiles.length} changed file(s)...`);\n\n let violations: CatchViolation[] = [];\n\n if (mode === 'NEW_AND_MODIFIED_CODE') {\n violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);\n } else if (mode === 'NEW_AND_MODIFIED_FILES') {\n violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);\n }\n\n if (violations.length === 0) {\n console.log('\\u2705 No catch error pattern violations found');\n return { success: true };\n }\n\n reportViolations(violations, mode, disableAllowed);\n\n return { success: false };\n}\n\n@injectable(bindingScopeValues.Singleton)\nexport class CatchErrorPatternValidator extends CodeValidator<CatchErrorPatternConfig> {\n constructor(config: CatchErrorPatternConfig) {\n super(config, 'catch-error-pattern', 'catch-error-pattern');\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n return runValidatorImpl(this.config, workspaceRoot);\n }\n}\n"]}
1
+ {"version":3,"file":"validate-catch-error-pattern.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-catch-error-pattern.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;;;;AAEH,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AACjC,0DAA4J;AAC5J,qDAAiE;AACjE,yCAA2D;AAC3D,iDAAgD;AAChD,6CAAyC;AAgBzC;;;GAGG;AACH,SAAS,iBAAiB,CAAC,KAAe,EAAE,UAAkB;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClF,MAAM;QAC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AAhC,MAAM,0BAA2B,SAAQ,8BAAsC;IACpB;IAA9D,YAAY,MAA+B,EAAmB,SAAoB;QAC9E,KAAK,CAAC,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;QADF,cAAS,GAAT,SAAS,CAAW;IAElF,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,aAAqB;QAC3B,OAAO,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AARY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEjB,sCAAuB,EAA8B,sBAAS;GADzE,0BAA0B,CAQtC","sourcesContent":["/**\n * Validate Catch Error Pattern Executor\n *\n * Validates that catch blocks follow the standardized error handling pattern.\n * Uses TypeScript AST for detection and LINE-BASED git diff filtering.\n *\n * ============================================================================\n * REQUIRED PATTERN\n * ============================================================================\n *\n * Standard: catch (err: unknown) { const error = toError(err); ... }\n * Ignored: catch (err: unknown) { //const error = toError(err); ... }\n * Nested: catch (err2: unknown) { const error2 = toError(err2); ... }\n *\n * ============================================================================\n * VIOLATIONS (BAD) - These patterns are flagged:\n * ============================================================================\n *\n * - catch (e) { ... } — wrong parameter name\n * - catch (err) { ... } — missing : unknown type annotation\n * - catch (err: unknown) { ... } — missing toError() as first statement\n * - catch (err: unknown) { const x = toError(err); } — wrong variable name\n *\n * ============================================================================\n * MODES (LINE-BASED)\n * ============================================================================\n * - OFF: Skip validation entirely\n * - NEW_AND_MODIFIED_CODE: Flag catch violations on changed lines (lines in diff hunks)\n * - NEW_AND_MODIFIED_FILES: Flag ALL catch violations in files that were modified\n *\n * ============================================================================\n * ESCAPE HATCH\n * ============================================================================\n * Add comment above the violation:\n * // webpieces-disable catch-error-pattern -- [your justification]\n * } catch (err: unknown) {\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { hasDisable, RULE_NAMES, CatchErrorPatternConfig, ModifiedCodeMode, detectBase, getFileDiff, getChangedLineNumbers } from '@webpieces/rules-config';\nimport { CodeValidator, ExecutorResult } from './code-validator';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { shouldSkipRule } from './resolve-mode';\nimport { ScanScope } from './scan-scope';\n\ninterface CatchViolation {\n file: string;\n line: number;\n message: string;\n context: string;\n}\n\ninterface CatchViolationInfo {\n line: number;\n message: string;\n context: string;\n hasDisableComment: boolean;\n}\n\n/**\n * Check if a line contains a disable comment for catch-error-pattern.\n * Recognizes both webpieces-disable and eslint-disable-next-line @webpieces/ formats.\n */\nfunction hasDisableComment(lines: string[], lineNumber: number): boolean {\n const startCheck = Math.max(0, lineNumber - 5);\n for (let i = lineNumber - 2; i >= startCheck; i--) {\n const line = lines[i]?.trim() ?? '';\n if (line.startsWith('function ') || line.startsWith('class ') || line.endsWith('}')) {\n break;\n }\n if (hasDisable(line, RULE_NAMES.CATCH_ERROR_PATTERN)) {\n return true;\n }\n if (line.includes('@webpieces/catch-error-pattern')) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if the catch block contains a disable comment for catch-error-pattern.\n */\nfunction hasBlockLevelDisable(sourceText: string, blockStart: number, blockEnd: number): boolean {\n const blockText = sourceText.substring(blockStart, blockEnd);\n return hasDisable(blockText, RULE_NAMES.CATCH_ERROR_PATTERN) ||\n blockText.includes('@webpieces/catch-error-pattern');\n}\n\n/**\n * Check if the catch block body text contains the commented-out ignore pattern.\n */\nfunction hasIgnoreComment(\n sourceText: string,\n blockStart: number,\n blockEnd: number,\n expectedVarName: string,\n actualParamName: string,\n): boolean {\n const blockText = sourceText.substring(blockStart, blockEnd);\n const ignorePattern = new RegExp(\n `//\\\\s*const\\\\s+${expectedVarName}\\\\s*=\\\\s*toError\\\\(${actualParamName}\\\\)`,\n );\n return ignorePattern.test(blockText);\n}\n\n/**\n * Validate a single CatchClause node.\n */\n// webpieces-disable max-lines-new-methods -- AST validation with multiple check paths for param name, type, and toError\nfunction validateCatchClause(\n node: ts.CatchClause,\n sourceFile: ts.SourceFile,\n fileLines: string[],\n depth: number,\n disableAllowed: boolean,\n): CatchViolationInfo[] {\n const violations: CatchViolationInfo[] = [];\n const suffix = depth === 1 ? '' : String(depth);\n const expectedParam = 'err' + suffix;\n const expectedVar = 'error' + suffix;\n\n const catchLine = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;\n const catchContext = fileLines[catchLine - 1]?.trim() ?? '';\n const blockStart = node.block.getStart(sourceFile);\n const blockEnd = node.block.getEnd();\n const disabled = hasDisableComment(fileLines, catchLine) ||\n hasBlockLevelDisable(sourceFile.text, blockStart, blockEnd);\n\n const varDecl = node.variableDeclaration;\n if (!varDecl) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch clause must declare a parameter: catch (${expectedParam}: unknown)`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n return violations;\n }\n\n const actualParam = ts.isIdentifier(varDecl.name) ? varDecl.name.text : expectedParam;\n\n // Check parameter name\n if (ts.isIdentifier(varDecl.name) && varDecl.name.text !== expectedParam) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch parameter must be named \"${expectedParam}\" (or \"err2\", \"err3\" for nested), got \"${varDecl.name.text}\"`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n }\n\n // Check type annotation is : unknown\n if (!varDecl.type || varDecl.type.kind !== ts.SyntaxKind.UnknownKeyword) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch parameter must be typed as \"unknown\": catch (${actualParam}: unknown)`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n }\n\n // Check for commented-out ignore pattern\n if (hasIgnoreComment(sourceFile.text, blockStart, blockEnd, expectedVar, actualParam)) {\n return violations;\n }\n\n // Check first statement is const error = toError(err)\n if (node.block.statements.length === 0) {\n violations.push({\n line: catchLine, context: catchContext,\n message: `Catch block must call toError(${actualParam}) as first statement: const ${expectedVar} = toError(${actualParam});`,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n });\n return violations;\n }\n\n const firstStmt = node.block.statements[0];\n const toErrorViolation = validateToErrorStatement(firstStmt, sourceFile, fileLines, expectedParam, expectedVar, actualParam, disabled, disableAllowed);\n if (toErrorViolation) {\n violations.push(toErrorViolation);\n }\n\n return violations;\n}\n\nfunction resolveDisable(disabled: boolean, disableAllowed: boolean): boolean {\n if (!disableAllowed && disabled) {\n return false;\n }\n return disabled;\n}\n\n/**\n * Validate that the first statement is `const error = toError(err);`\n */\n// webpieces-disable max-lines-new-methods -- Deep AST check for variable declaration with toError call expression\nfunction validateToErrorStatement(\n stmt: ts.Statement,\n sourceFile: ts.SourceFile,\n fileLines: string[],\n expectedParam: string,\n expectedVar: string,\n actualParam: string,\n disabled: boolean,\n disableAllowed: boolean,\n): CatchViolationInfo | null {\n const stmtLine = sourceFile.getLineAndCharacterOfPosition(stmt.getStart(sourceFile)).line + 1;\n const stmtContext = fileLines[stmtLine - 1]?.trim() ?? '';\n\n if (!ts.isVariableStatement(stmt)) {\n return {\n line: stmtLine,\n message: `First statement in catch must be: const ${expectedVar} = toError(${actualParam});`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n const declarations = stmt.declarationList.declarations;\n if (declarations.length === 0) {\n return {\n line: stmtLine,\n message: `First statement in catch must be: const ${expectedVar} = toError(${actualParam});`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n const decl = declarations[0];\n\n // Check variable name\n if (ts.isIdentifier(decl.name) && decl.name.text !== expectedVar) {\n return {\n line: stmtLine,\n message: `Error variable must be named \"${expectedVar}\", got \"${decl.name.text}\"`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n // Check initializer is toError(actualParam)\n const init = decl.initializer;\n if (!init || !ts.isCallExpression(init)) {\n return {\n line: stmtLine,\n message: `First statement in catch must be: const ${expectedVar} = toError(${actualParam});`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n if (!ts.isIdentifier(init.expression) || init.expression.text !== 'toError') {\n return {\n line: stmtLine,\n message: `First statement in catch must call toError(), not \"${init.expression.getText(sourceFile)}\"`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n // Check argument\n const args = init.arguments;\n if (args.length !== 1 || !ts.isIdentifier(args[0]) || args[0].text !== actualParam) {\n return {\n line: stmtLine,\n message: `toError() must be called with \"${actualParam}\"`,\n context: stmtContext,\n hasDisableComment: resolveDisable(disabled, disableAllowed),\n };\n }\n\n return null;\n}\n\n/**\n * Find all catch pattern violations in a file using AST.\n */\nfunction findCatchViolationsInFile(\n filePath: string,\n workspaceRoot: string,\n disableAllowed: boolean,\n): CatchViolationInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const violations: CatchViolationInfo[] = [];\n let catchDepth = 0;\n\n function visit(node: ts.Node): void {\n if (ts.isCatchClause(node)) {\n catchDepth++;\n const clauseViolations = validateCatchClause(node, sourceFile, fileLines, catchDepth, disableAllowed);\n violations.push(...clauseViolations);\n ts.forEachChild(node, visit);\n catchDepth--;\n return;\n }\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\n/**\n * NEW_AND_MODIFIED_CODE mode: Flag violations on changed lines.\n */\nfunction findViolationsForModifiedCode(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean,\n): CatchViolation[] {\n const violations: CatchViolation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n\n if (changedLines.size === 0) continue;\n\n const allViolations = findCatchViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n if (!changedLines.has(v.line)) continue;\n\n violations.push({ file, line: v.line, message: v.message, context: v.context });\n }\n }\n\n return violations;\n}\n\n/**\n * NEW_AND_MODIFIED_FILES mode: Flag ALL violations in modified files.\n */\nfunction findViolationsForModifiedFiles(\n workspaceRoot: string,\n changedFiles: string[],\n disableAllowed: boolean,\n): CatchViolation[] {\n const violations: CatchViolation[] = [];\n\n for (const file of changedFiles) {\n const allViolations = findCatchViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n violations.push({ file, line: v.line, message: v.message, context: v.context });\n }\n }\n\n return violations;\n}\n\n/**\n * Report violations to console.\n */\n// webpieces-disable max-lines-new-methods -- Console output with pattern examples and escape hatch\nfunction reportViolations(violations: CatchViolation[], mode: ModifiedCodeMode, disableAllowed: boolean): void {\n console.error('');\n console.error('\\u274c Catch blocks must follow the standardized error handling pattern!');\n console.error('');\n console.error('\\ud83d\\udcda Required pattern:');\n console.error('');\n console.error(' catch (err: unknown) {');\n console.error(' const error = toError(err);');\n console.error(' // ... use error ...');\n console.error(' }');\n console.error('');\n console.error(' Or to explicitly ignore:');\n console.error(' catch (err: unknown) {');\n console.error(' //const error = toError(err);');\n console.error(' }');\n console.error('');\n console.error(' For nested catches: err2/error2, err3/error3, etc.');\n console.error('');\n\n for (const v of violations) {\n console.error(` \\u274c ${v.file}:${v.line}`);\n console.error(` ${v.message}`);\n console.error(` ${v.context}`);\n }\n console.error('');\n\n if (disableAllowed) {\n console.error(' Escape hatch (use sparingly):');\n console.error(' // webpieces-disable catch-error-pattern -- [your reason]');\n } else {\n console.error(' Escape hatch: DISABLED (disableAllowed: false)');\n console.error(' Disable comments are ignored. Fix the catch block directly.');\n }\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\n/**\n * Resolve mode considering turnOffRuleUntilEpoch override.\n */\nfunction resolveMode(normalMode: ModifiedCodeMode, epoch: number | undefined, branchPattern: string | undefined): ModifiedCodeMode {\n if (normalMode === 'OFF') {\n return normalMode;\n }\n const skip = shouldSkipRule(epoch, branchPattern);\n if (skip.skip) {\n console.log(`\\n\\u23ed\\ufe0f Skipping catch-error-pattern validation (${skip.reason})`);\n console.log('');\n return 'OFF';\n }\n return normalMode;\n}\n\nasync function runValidatorImpl(\n scan: ScanScope,\n options: CatchErrorPatternConfig,\n workspaceRoot: string\n): Promise<ExecutorResult> {\n const mode: ModifiedCodeMode = resolveMode(options.mode ?? 'OFF', options.turnOffRuleUntilEpoch, (options.turnOffRuleWhileOnBranch ?? undefined));\n const disableAllowed = options.disableAllowed ?? true;\n\n if (mode === 'OFF') {\n console.log('\\n\\u23ed\\ufe0f Skipping catch-error-pattern validation (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n console.log('\\n\\ud83d\\udccf Validating Catch Error Pattern\\n');\n console.log(` Mode: ${mode}`);\n\n let base = process.env['NX_BASE'];\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n base = detectBase(workspaceRoot) ?? undefined;\n\n if (!base) {\n console.log('\\n\\u23ed\\ufe0f Skipping catch-error-pattern validation (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const changedFiles = scan.files(workspaceRoot, mode, base, head);\n\n if (changedFiles.length === 0) {\n console.log('\\u2705 No TypeScript files changed');\n return { success: true };\n }\n\n console.log(`\\ud83d\\udcc2 Checking ${changedFiles.length} changed file(s)...`);\n\n let violations: CatchViolation[] = [];\n\n if (mode === 'NEW_AND_MODIFIED_CODE') {\n violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);\n } else {\n // NEW_AND_MODIFIED_FILES and the whole-scope modes (#1027) all judge every site of every file.\n violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);\n }\n\n if (violations.length === 0) {\n console.log('\\u2705 No catch error pattern violations found');\n return { success: true };\n }\n\n scan.recordSites('catch-error-pattern', violations.map((v: CatchViolation) => v.file));\n reportViolations(violations, mode, disableAllowed);\n\n return { success: false };\n}\n\n@injectable(bindingScopeValues.Singleton)\nexport class CatchErrorPatternValidator extends CodeValidator<CatchErrorPatternConfig> {\n constructor(config: CatchErrorPatternConfig, private readonly scanScope: ScanScope) {\n super(config, 'catch-error-pattern', 'catch-error-pattern');\n }\n\n async run(workspaceRoot: string): Promise<ExecutorResult> {\n return runValidatorImpl(this.scanScope, this.config, workspaceRoot);\n }\n}\n"]}
@@ -4,11 +4,10 @@ import { CodeRulesRunRequest } from './code-rules-run-request';
4
4
  export { ExecutorResult } from './code-validator';
5
5
  /**
6
6
  * Run the configured code validators against the workspace root (the nx `validate-code` executor's
7
- * entry, via `@webpieces/code-rules`'s `validateCode` export).
7
+ * entry, via `@webpieces/code-rules`'s `validateCode` export). Config comes from webpieces.config.json
8
+ * (loaded via @webpieces/rules-config so ai-hooks and this executor agree on every rule's mode/options).
8
9
  *
9
- * `request` is {@link CodeRulesRunRequest.GATE} for the build: every rule at its committed mode. A debug
10
- * request (`--rule` / `--mode` / `--projects` on the nx target) judges one rule without a config edit.
11
- * Config comes from webpieces.config.json, loaded via @webpieces/rules-config so ai-hooks and this
12
- * executor agree on every rule's mode/options; the DAG is built by {@link CodeRulesBootstrap}.
10
+ * `request` is the gate (every field undefined) or a DEBUG run of one rule (#1027) — see
11
+ * {@link CodeRulesBootstrap}, the one composition root shared with the `wp-validate-code` bin.
13
12
  */
14
13
  export default function runValidator(workspaceRoot: string, request: CodeRulesRunRequest): Promise<ExecutorResult>;
@@ -2,28 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = runValidator;
4
4
  require("reflect-metadata");
5
- const rules_config_1 = require("@webpieces/rules-config");
6
- const code_rules_app_1 = require("./code-rules-app");
7
5
  const code_rules_bootstrap_1 = require("./code-rules-bootstrap");
8
6
  /**
9
7
  * Run the configured code validators against the workspace root (the nx `validate-code` executor's
10
- * entry, via `@webpieces/code-rules`'s `validateCode` export).
8
+ * entry, via `@webpieces/code-rules`'s `validateCode` export). Config comes from webpieces.config.json
9
+ * (loaded via @webpieces/rules-config so ai-hooks and this executor agree on every rule's mode/options).
11
10
  *
12
- * `request` is {@link CodeRulesRunRequest.GATE} for the build: every rule at its committed mode. A debug
13
- * request (`--rule` / `--mode` / `--projects` on the nx target) judges one rule without a config edit.
14
- * Config comes from webpieces.config.json, loaded via @webpieces/rules-config so ai-hooks and this
15
- * executor agree on every rule's mode/options; the DAG is built by {@link CodeRulesBootstrap}.
11
+ * `request` is the gate (every field undefined) or a DEBUG run of one rule (#1027) — see
12
+ * {@link CodeRulesBootstrap}, the one composition root shared with the `wp-validate-code` bin.
16
13
  */
17
- // webpieces-disable no-function-outside-class -- the nx validate-code executor's entry point (exported as validateCode), the executor-side twin of cli.ts main()
14
+ // webpieces-disable no-function-outside-class -- the nx executor imports this default export; a published entry point, not a DI member
18
15
  async function runValidator(workspaceRoot, request) {
19
- const loaded = (0, rules_config_1.loadAndValidate)(workspaceRoot);
20
- if (loaded.configPath === null) {
21
- console.error('\n❌ No webpieces.config.json found at workspace root (or any ancestor).\n');
22
- return { success: false };
23
- }
24
- console.log(`\n📄 Loaded config: ${loaded.configPath}`);
25
- const container = new code_rules_bootstrap_1.CodeRulesBootstrap().container(workspaceRoot, loaded, request);
26
- const app = container.get(code_rules_app_1.CodeRulesApp);
27
- return app.run();
16
+ return new code_rules_bootstrap_1.CodeRulesBootstrap().run(workspaceRoot, request);
28
17
  }
29
18
  //# sourceMappingURL=validate-code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-code.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-code.ts"],"names":[],"mappings":";;AAoBA,+BAaC;AAjCD,4BAA0B;AAC1B,0DAA0D;AAG1D,qDAAgD;AAChD,iEAA4D;AAK5D;;;;;;;;GAQG;AACH,iKAAiK;AAClJ,KAAK,UAAU,YAAY,CACtC,aAAqB,EACrB,OAA4B;IAE5B,MAAM,MAAM,GAAG,IAAA,8BAAe,EAAC,aAAa,CAAC,CAAC;IAC9C,IAAI,MAAM,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC3F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,yCAAkB,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACrF,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,6BAAY,CAAC,CAAC;IACxC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC","sourcesContent":["import 'reflect-metadata';\nimport { loadAndValidate } from '@webpieces/rules-config';\n\nimport { ExecutorResult } from './code-validator';\nimport { CodeRulesApp } from './code-rules-app';\nimport { CodeRulesBootstrap } from './code-rules-bootstrap';\nimport { CodeRulesRunRequest } from './code-rules-run-request';\n\nexport { ExecutorResult } from './code-validator';\n\n/**\n * Run the configured code validators against the workspace root (the nx `validate-code` executor's\n * entry, via `@webpieces/code-rules`'s `validateCode` export).\n *\n * `request` is {@link CodeRulesRunRequest.GATE} for the build: every rule at its committed mode. A debug\n * request (`--rule` / `--mode` / `--projects` on the nx target) judges one rule without a config edit.\n * Config comes from webpieces.config.json, loaded via @webpieces/rules-config so ai-hooks and this\n * executor agree on every rule's mode/options; the DAG is built by {@link CodeRulesBootstrap}.\n */\n// webpieces-disable no-function-outside-class -- the nx validate-code executor's entry point (exported as validateCode), the executor-side twin of cli.ts main()\nexport default async function runValidator(\n workspaceRoot: string,\n request: CodeRulesRunRequest,\n): Promise<ExecutorResult> {\n const loaded = loadAndValidate(workspaceRoot);\n if (loaded.configPath === null) {\n console.error('\\n❌ No webpieces.config.json found at workspace root (or any ancestor).\\n');\n return { success: false };\n }\n console.log(`\\n📄 Loaded config: ${loaded.configPath}`);\n const container = new CodeRulesBootstrap().container(workspaceRoot, loaded, request);\n const app = container.get(CodeRulesApp);\n return app.run();\n}\n"]}
1
+ {"version":3,"file":"validate-code.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-code.ts"],"names":[],"mappings":";;AAiBA,+BAEC;AAnBD,4BAA0B;AAG1B,iEAA4D;AAK5D;;;;;;;GAOG;AACH,uIAAuI;AACxH,KAAK,UAAU,YAAY,CAAC,aAAqB,EAAE,OAA4B;IAC1F,OAAO,IAAI,yCAAkB,EAAE,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import 'reflect-metadata';\n\nimport { ExecutorResult } from './code-validator';\nimport { CodeRulesBootstrap } from './code-rules-bootstrap';\nimport { CodeRulesRunRequest } from './code-rules-run-request';\n\nexport { ExecutorResult } from './code-validator';\n\n/**\n * Run the configured code validators against the workspace root (the nx `validate-code` executor's\n * entry, via `@webpieces/code-rules`'s `validateCode` export). Config comes from webpieces.config.json\n * (loaded via @webpieces/rules-config so ai-hooks and this executor agree on every rule's mode/options).\n *\n * `request` is the gate (every field undefined) or a DEBUG run of one rule (#1027) — see\n * {@link CodeRulesBootstrap}, the one composition root shared with the `wp-validate-code` bin.\n */\n// webpieces-disable no-function-outside-class -- the nx executor imports this default export; a published entry point, not a DI member\nexport default async function runValidator(workspaceRoot: string, request: CodeRulesRunRequest): Promise<ExecutorResult> {\n return new CodeRulesBootstrap().run(workspaceRoot, request);\n}\n"]}
@@ -41,6 +41,7 @@
41
41
  */
42
42
  import { InjectAnnotationNotNeededForConcreteClassConfig } from '@webpieces/rules-config';
43
43
  import { CodeValidator, ExecutorResult } from './code-validator';
44
+ import { ScanScope } from './scan-scope';
44
45
  interface InjectViolationInfo {
45
46
  line: number;
46
47
  column: number;
@@ -49,7 +50,8 @@ interface InjectViolationInfo {
49
50
  }
50
51
  export declare function findRedundantInjectInSource(content: string, filePath: string, disableAllowed: boolean): InjectViolationInfo[];
51
52
  export declare class InjectAnnotationNotNeededForConcreteClassValidator extends CodeValidator<InjectAnnotationNotNeededForConcreteClassConfig> {
52
- constructor(config: InjectAnnotationNotNeededForConcreteClassConfig);
53
+ private readonly scanScope;
54
+ constructor(config: InjectAnnotationNotNeededForConcreteClassConfig, scanScope: ScanScope);
53
55
  run(workspaceRoot: string): Promise<ExecutorResult>;
54
56
  }
55
57
  export {};