@nielspeter/eess 0.2.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -4
- package/dist/assertion-advice.d.ts +26 -0
- package/dist/assertion-advice.d.ts.map +1 -0
- package/dist/assertion-advice.js +29 -0
- package/dist/assertion-advice.js.map +1 -0
- package/dist/baseline-generator.d.ts +9 -0
- package/dist/baseline-generator.d.ts.map +1 -1
- package/dist/baseline-generator.js +9 -0
- package/dist/baseline-generator.js.map +1 -1
- package/dist/baseline.d.ts +69 -4
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +119 -13
- package/dist/baseline.js.map +1 -1
- package/dist/cache-registry.d.ts +14 -0
- package/dist/cache-registry.d.ts.map +1 -0
- package/dist/cache-registry.js +37 -0
- package/dist/cache-registry.js.map +1 -0
- package/dist/cardinality.d.ts +35 -0
- package/dist/cardinality.d.ts.map +1 -0
- package/dist/cardinality.js +80 -0
- package/dist/cardinality.js.map +1 -0
- package/dist/check-options.d.ts +14 -0
- package/dist/check-options.d.ts.map +1 -1
- package/dist/cli-config.d.ts +59 -0
- package/dist/cli-config.d.ts.map +1 -0
- package/dist/cli-config.js +84 -0
- package/dist/cli-config.js.map +1 -0
- package/dist/collect-result.d.ts +94 -0
- package/dist/collect-result.d.ts.map +1 -0
- package/dist/collect-result.js +142 -0
- package/dist/collect-result.js.map +1 -0
- package/dist/combinators.d.ts +14 -0
- package/dist/combinators.d.ts.map +1 -1
- package/dist/combinators.js +53 -16
- package/dist/combinators.js.map +1 -1
- package/dist/comment-suppression.d.ts +60 -0
- package/dist/comment-suppression.d.ts.map +1 -0
- package/dist/comment-suppression.js +89 -0
- package/dist/comment-suppression.js.map +1 -0
- package/dist/condition.d.ts +43 -0
- package/dist/condition.d.ts.map +1 -1
- package/dist/condition.js +48 -1
- package/dist/condition.js.map +1 -1
- package/dist/correspondence-core.d.ts +35 -0
- package/dist/correspondence-core.d.ts.map +1 -0
- package/dist/correspondence-core.js +38 -0
- package/dist/correspondence-core.js.map +1 -0
- package/dist/correspondence.d.ts +57 -5
- package/dist/correspondence.d.ts.map +1 -1
- package/dist/correspondence.js +74 -5
- package/dist/correspondence.js.map +1 -1
- package/dist/dedupe-config-findings.d.ts +56 -0
- package/dist/dedupe-config-findings.d.ts.map +1 -0
- package/dist/dedupe-config-findings.js +101 -0
- package/dist/dedupe-config-findings.js.map +1 -0
- package/dist/define.d.ts +44 -2
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +45 -4
- package/dist/define.js.map +1 -1
- package/dist/diff-aware.d.ts +8 -1
- package/dist/diff-aware.d.ts.map +1 -1
- package/dist/diff-aware.js +39 -9
- package/dist/diff-aware.js.map +1 -1
- package/dist/diff-disclosure.d.ts +72 -0
- package/dist/diff-disclosure.d.ts.map +1 -0
- package/dist/diff-disclosure.js +110 -0
- package/dist/diff-disclosure.js.map +1 -0
- package/dist/disk-set.d.ts +27 -0
- package/dist/disk-set.d.ts.map +1 -0
- package/dist/disk-set.js +12 -0
- package/dist/disk-set.js.map +1 -0
- package/dist/edge-coverage.d.ts +96 -0
- package/dist/edge-coverage.d.ts.map +1 -0
- package/dist/edge-coverage.js +108 -0
- package/dist/edge-coverage.js.map +1 -0
- package/dist/emitter-findings.d.ts +167 -0
- package/dist/emitter-findings.d.ts.map +1 -0
- package/dist/emitter-findings.js +237 -0
- package/dist/emitter-findings.js.map +1 -0
- package/dist/errors.d.ts +73 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +93 -0
- package/dist/errors.js.map +1 -1
- package/dist/exclusion-comments.d.ts +36 -1
- package/dist/exclusion-comments.d.ts.map +1 -1
- package/dist/exclusion-comments.js +185 -37
- package/dist/exclusion-comments.js.map +1 -1
- package/dist/execute-rule.d.ts +11 -1
- package/dist/execute-rule.d.ts.map +1 -1
- package/dist/execute-rule.js +220 -11
- package/dist/execute-rule.js.map +1 -1
- package/dist/file-walk.d.ts +22 -0
- package/dist/file-walk.d.ts.map +1 -0
- package/dist/file-walk.js +51 -0
- package/dist/file-walk.js.map +1 -0
- package/dist/format-github.d.ts.map +1 -1
- package/dist/format-github.js +37 -5
- package/dist/format-github.js.map +1 -1
- package/dist/format-json.d.ts +96 -1
- package/dist/format-json.d.ts.map +1 -1
- package/dist/format-json.js +94 -9
- package/dist/format-json.js.map +1 -1
- package/dist/format.d.ts +4 -2
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +41 -19
- package/dist/format.js.map +1 -1
- package/dist/glob-site.d.ts +232 -0
- package/dist/glob-site.d.ts.map +1 -0
- package/dist/glob-site.js +156 -0
- package/dist/glob-site.js.map +1 -0
- package/dist/identity-root.d.ts +55 -0
- package/dist/identity-root.d.ts.map +1 -0
- package/dist/identity-root.js +170 -0
- package/dist/identity-root.js.map +1 -0
- package/dist/index.d.ts +18 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +55 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +92 -0
- package/dist/internal.js.map +1 -0
- package/dist/mask-non-comment.d.ts +49 -0
- package/dist/mask-non-comment.d.ts.map +1 -0
- package/dist/mask-non-comment.js +261 -0
- package/dist/mask-non-comment.js.map +1 -0
- package/dist/owns-empty-discovery.d.ts +5 -0
- package/dist/owns-empty-discovery.d.ts.map +1 -0
- package/dist/owns-empty-discovery.js +85 -0
- package/dist/owns-empty-discovery.js.map +1 -0
- package/dist/path-suffix.d.ts +57 -0
- package/dist/path-suffix.d.ts.map +1 -0
- package/dist/path-suffix.js +73 -0
- package/dist/path-suffix.js.map +1 -0
- package/dist/path-universe.d.ts +44 -0
- package/dist/path-universe.d.ts.map +1 -0
- package/dist/path-universe.js +21 -0
- package/dist/path-universe.js.map +1 -0
- package/dist/predicate.d.ts +45 -0
- package/dist/predicate.d.ts.map +1 -1
- package/dist/predicate.js +20 -1
- package/dist/predicate.js.map +1 -1
- package/dist/preset-dispatch.d.ts +6 -15
- package/dist/preset-dispatch.d.ts.map +1 -1
- package/dist/preset-dispatch.js +35 -17
- package/dist/preset-dispatch.js.map +1 -1
- package/dist/project-relative.d.ts +25 -0
- package/dist/project-relative.d.ts.map +1 -0
- package/dist/project-relative.js +54 -0
- package/dist/project-relative.js.map +1 -0
- package/dist/report.d.ts +42 -12
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +190 -14
- package/dist/report.js.map +1 -1
- package/dist/rule-builder-like.d.ts +17 -0
- package/dist/rule-builder-like.d.ts.map +1 -0
- package/dist/rule-builder-like.js +2 -0
- package/dist/rule-builder-like.js.map +1 -0
- package/dist/rule-builder.d.ts +124 -84
- package/dist/rule-builder.d.ts.map +1 -1
- package/dist/rule-builder.js +230 -181
- package/dist/rule-builder.js.map +1 -1
- package/dist/rule-description.d.ts +83 -1
- package/dist/rule-description.d.ts.map +1 -1
- package/dist/rule-description.js +75 -1
- package/dist/rule-description.js.map +1 -1
- package/dist/rule-metadata.d.ts +20 -3
- package/dist/rule-metadata.d.ts.map +1 -1
- package/dist/selection-memo.d.ts +45 -0
- package/dist/selection-memo.d.ts.map +1 -0
- package/dist/selection-memo.js +66 -0
- package/dist/selection-memo.js.map +1 -0
- package/dist/shallow-clone.d.ts +20 -0
- package/dist/shallow-clone.d.ts.map +1 -0
- package/dist/shallow-clone.js +27 -0
- package/dist/shallow-clone.js.map +1 -0
- package/dist/silent-exclusion.d.ts +12 -0
- package/dist/silent-exclusion.d.ts.map +1 -1
- package/dist/silent-exclusion.js +22 -0
- package/dist/silent-exclusion.js.map +1 -1
- package/dist/stderr.d.ts +16 -0
- package/dist/stderr.d.ts.map +1 -0
- package/dist/stderr.js +73 -0
- package/dist/stderr.js.map +1 -0
- package/dist/terminal-builder.d.ts +224 -10
- package/dist/terminal-builder.d.ts.map +1 -1
- package/dist/terminal-builder.js +336 -46
- package/dist/terminal-builder.js.map +1 -1
- package/dist/type-guards.d.ts +38 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +42 -0
- package/dist/type-guards.js.map +1 -0
- package/dist/unsuppressable.d.ts +54 -0
- package/dist/unsuppressable.d.ts.map +1 -0
- package/dist/unsuppressable.js +76 -0
- package/dist/unsuppressable.js.map +1 -0
- package/dist/vacuity-findings.d.ts +49 -0
- package/dist/vacuity-findings.d.ts.map +1 -0
- package/dist/vacuity-findings.js +94 -0
- package/dist/vacuity-findings.js.map +1 -0
- package/dist/violation.d.ts +173 -4
- package/dist/violation.d.ts.map +1 -1
- package/dist/violation.js +262 -1
- package/dist/violation.js.map +1 -1
- package/dist/watch.d.ts +71 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +129 -0
- package/dist/watch.js.map +1 -0
- package/package.json +6 -1
|
@@ -1,10 +1,55 @@
|
|
|
1
|
+
import { maskNonCommentSpans, maskMarkdownCodeSpans } from './mask-non-comment.js';
|
|
1
2
|
// Single-line: // eess-exclude <rule-id>[, <rule-id>]: <reason>
|
|
2
3
|
// Single-line without reason: // eess-exclude <rule-id>
|
|
3
|
-
|
|
4
|
+
// The directive must OPEN its comment (bug 0154). Masking alone took this file's
|
|
5
|
+
// own false-positive count from 12 to 7; the rest were genuine line comments that
|
|
6
|
+
// merely DESCRIBE the grammar — like the line above this one. No lexical rule can
|
|
7
|
+
// separate those, but anchoring to the start of the comment body separates all of
|
|
8
|
+
// them from every real directive, including the trailing `code // eess-exclude …`
|
|
9
|
+
// form.
|
|
10
|
+
//
|
|
11
|
+
// Rejected alternative: validating the rule-id's shape. It rejects `<rule-id>`
|
|
12
|
+
// and still accepts `// see eess-exclude a/b: why`, and it couples this parser to
|
|
13
|
+
// an id grammar nothing else enforces.
|
|
14
|
+
const SINGLE_LINE_RE = /^[ \t]*eess-exclude[ \t]+(.+)/;
|
|
15
|
+
/**
|
|
16
|
+
* The body of a line's FIRST `//` comment, or undefined if it has none.
|
|
17
|
+
*
|
|
18
|
+
* The directive must open the comment, and it must be the comment the line
|
|
19
|
+
* actually starts — not any `//` on the line. A grammar description carries two:
|
|
20
|
+
*
|
|
21
|
+
* // Single-line: // eess-exclude <rule-id>: <reason>
|
|
22
|
+
*
|
|
23
|
+
* Anchoring to `//` alone matches the second one and reads the file's own
|
|
24
|
+
* documentation as 8 live waivers. Taking the first `//` and requiring the
|
|
25
|
+
* directive at the start of its body separates every description from every real
|
|
26
|
+
* directive, including the trailing `code // eess-exclude …` form, whose first
|
|
27
|
+
* `//` is the directive's own.
|
|
28
|
+
*/
|
|
29
|
+
const CODE_LIKE = /\.(?:[cm]?[jt]sx?|vue|svelte)$/i;
|
|
30
|
+
const MARKDOWN_LIKE = /\.(?:md|markdown|mdx)$/i;
|
|
31
|
+
/**
|
|
32
|
+
* The HTML-comment forms exist for text dialects whose sources have no `//` —
|
|
33
|
+
* markdown corpora and the like. In a `.ts` file `// <!-- eess-exclude … -->` is
|
|
34
|
+
* prose describing the grammar, and reading it accounted for the last 2 of this
|
|
35
|
+
* very file's own false hits (bug 0154).
|
|
36
|
+
*/
|
|
37
|
+
function htmlFormsApply(filePath) {
|
|
38
|
+
return !CODE_LIKE.test(filePath);
|
|
39
|
+
}
|
|
40
|
+
function firstCommentBody(line) {
|
|
41
|
+
const at = line.indexOf('//');
|
|
42
|
+
return at === -1 ? undefined : line.slice(at + 2);
|
|
43
|
+
}
|
|
4
44
|
// Block start: // eess-exclude-start <rule-id>[, <rule-id>]: <reason>
|
|
5
|
-
|
|
45
|
+
// The trailing group is OPTIONAL. A bare `// eess-exclude-start` (no ids, no
|
|
46
|
+
// reason) used to match nothing at all — so it pushed no frame, said nothing,
|
|
47
|
+
// and the next `-end` closed the ENCLOSING block. Same two symptoms as the
|
|
48
|
+
// reason-free case, through a shape the reason-free fix did not reach: it is a
|
|
49
|
+
// bracket the reader can see, so it must consume the `-end` written for it.
|
|
50
|
+
const BLOCK_START_RE = /^[ \t]*eess-exclude-start(?:[ \t]+(.*))?[ \t]*$/;
|
|
6
51
|
// Block end: // eess-exclude-end
|
|
7
|
-
const BLOCK_END_RE =
|
|
52
|
+
const BLOCK_END_RE = /^[ \t]*eess-exclude-end\b/;
|
|
8
53
|
// HTML-comment forms — the same directives for text dialects whose sources
|
|
9
54
|
// aren't `//`-commented (markdown corpora, and any future text dialect).
|
|
10
55
|
// <!-- eess-exclude <rule-id>[, <rule-id>]: <reason> -->
|
|
@@ -37,19 +82,24 @@ function parseRuleIdsAndReason(content) {
|
|
|
37
82
|
}
|
|
38
83
|
/** Handle a block-end directive line. */
|
|
39
84
|
function handleBlockEnd(openBlocks, exclusions, warnings, filePath, lineNum) {
|
|
40
|
-
|
|
85
|
+
// Bug 0158: pop the INNERMOST frame. Closing every open block meant an inner
|
|
86
|
+
// `-end` silently ended the outer one, so the outer waiver stopped applying
|
|
87
|
+
// partway through the region it was written for — two wrong results from one
|
|
88
|
+
// input, and neither reported.
|
|
89
|
+
const frame = openBlocks.pop();
|
|
90
|
+
if (frame === undefined) {
|
|
41
91
|
warnings.push({
|
|
42
92
|
message: `eess-exclude-end without matching start`,
|
|
43
93
|
file: filePath,
|
|
44
94
|
line: lineNum,
|
|
95
|
+
kind: 'malformed',
|
|
45
96
|
});
|
|
46
97
|
return;
|
|
47
98
|
}
|
|
48
|
-
for (const
|
|
99
|
+
for (const comment of frame) {
|
|
49
100
|
comment.endLine = lineNum;
|
|
50
101
|
exclusions.push(comment);
|
|
51
102
|
}
|
|
52
|
-
openBlocks.clear();
|
|
53
103
|
}
|
|
54
104
|
/** Emit undocumented-exclusion warnings for each rule ID when no reason is given. */
|
|
55
105
|
function warnUndocumented(warnings, ruleIds, directive, filePath, lineNum) {
|
|
@@ -60,32 +110,85 @@ function warnUndocumented(warnings, ruleIds, directive, filePath, lineNum) {
|
|
|
60
110
|
` Fix: Add a reason — // ${directive} ${ruleId}: <why>`,
|
|
61
111
|
file: filePath,
|
|
62
112
|
line: lineNum,
|
|
113
|
+
kind: 'undocumented',
|
|
63
114
|
});
|
|
64
115
|
}
|
|
65
116
|
}
|
|
66
117
|
/** Handle a block-start directive line. */
|
|
67
118
|
function handleBlockStart(content, openBlocks, warnings, filePath, lineNum) {
|
|
68
|
-
|
|
119
|
+
const { ruleIds, reason } = parseRuleIdsAndReason(content);
|
|
120
|
+
if (ruleIds.length === 0) {
|
|
121
|
+
// A `-start` naming no rule at all. It still consumes its `-end` (see the
|
|
122
|
+
// regex comment), but it is malformed and saying nothing about it would be
|
|
123
|
+
// the silence this whole grammar is written to refuse.
|
|
69
124
|
warnings.push({
|
|
70
|
-
message: `
|
|
125
|
+
message: `eess-exclude-start names no rule id. ` +
|
|
126
|
+
`Fix: write // eess-exclude-start <rule-id>: <why>, or delete the directive ` +
|
|
127
|
+
`and its matching -end.`,
|
|
71
128
|
file: filePath,
|
|
72
129
|
line: lineNum,
|
|
130
|
+
kind: 'malformed',
|
|
73
131
|
});
|
|
132
|
+
openBlocks.push(ruleIds.map((ruleId) => ({
|
|
133
|
+
ruleId,
|
|
134
|
+
reason,
|
|
135
|
+
file: filePath,
|
|
136
|
+
line: lineNum,
|
|
137
|
+
isBlock: true,
|
|
138
|
+
})));
|
|
74
139
|
return;
|
|
75
140
|
}
|
|
76
|
-
const { ruleIds, reason } = parseRuleIdsAndReason(content);
|
|
77
141
|
if (reason === '') {
|
|
78
142
|
warnUndocumented(warnings, ruleIds, 'eess-exclude-start', filePath, lineNum);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
143
|
+
// Push an EMPTY frame rather than returning. Refusing the waiver and
|
|
144
|
+
// refusing the frame are different things: `-start`/`-end` is a bracket
|
|
145
|
+
// language, so a `-start` the reader can see must consume the `-end` the
|
|
146
|
+
// reader wrote for it, whatever we decide about its reason.
|
|
147
|
+
//
|
|
148
|
+
// Returning here — as this did when bug 0158's two halves shipped together —
|
|
149
|
+
// let the next `-end` pop the OUTER frame, so a valid enclosing waiver
|
|
150
|
+
// stopped early and a balanced file reported "end without matching start".
|
|
151
|
+
// That is precisely the frame-mangling 0158's nesting half removed,
|
|
152
|
+
// reintroduced by its reason-required half. Empty means it suppresses
|
|
153
|
+
// nothing, which is the refusal; present means the brackets still pair.
|
|
154
|
+
openBlocks.push(ruleIds.map((ruleId) => ({
|
|
82
155
|
ruleId,
|
|
83
156
|
reason,
|
|
84
157
|
file: filePath,
|
|
85
158
|
line: lineNum,
|
|
86
159
|
isBlock: true,
|
|
160
|
+
})));
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
// A rule re-opened while already open is warned but still applied. The likeliest
|
|
164
|
+
// cause is a missing `-end`, which the author wants to know; refusing it is what
|
|
165
|
+
// produced the early-close bug. Ported from `eess-ts` when the parsers were
|
|
166
|
+
// unified (ADR-012) — the kernel had no such warning, so `eess-md`,
|
|
167
|
+
// `eess-mermaid` and `eess-gherkin` never got it.
|
|
168
|
+
const alreadyOpen = new Set(openBlocks.flat().map((c) => c.ruleId));
|
|
169
|
+
for (const ruleId of ruleIds) {
|
|
170
|
+
if (!alreadyOpen.has(ruleId))
|
|
171
|
+
continue;
|
|
172
|
+
warnings.push({
|
|
173
|
+
message: `eess-exclude-start for '${ruleId}' is already open — ` +
|
|
174
|
+
`the enclosing block covers this region. Fix: remove this directive, ` +
|
|
175
|
+
`or close the enclosing block first if the nesting was unintended.`,
|
|
176
|
+
file: filePath,
|
|
177
|
+
line: lineNum,
|
|
178
|
+
kind: 'malformed',
|
|
87
179
|
});
|
|
88
180
|
}
|
|
181
|
+
// Bug 0158: nesting is supported rather than refused. Blocks are a STACK, not
|
|
182
|
+
// a map keyed by rule id — the map dropped an inner `-start` outright, and a
|
|
183
|
+
// second start for the same id overwrote the first. One `-start` pushes one
|
|
184
|
+
// frame, whatever number of ids it names.
|
|
185
|
+
openBlocks.push(ruleIds.map((ruleId) => ({
|
|
186
|
+
ruleId,
|
|
187
|
+
reason,
|
|
188
|
+
file: filePath,
|
|
189
|
+
line: lineNum,
|
|
190
|
+
isBlock: true,
|
|
191
|
+
})));
|
|
89
192
|
}
|
|
90
193
|
/** Handle a single-line exclude directive. */
|
|
91
194
|
function handleSingleLine(content, exclusions, warnings, filePath, lineNum) {
|
|
@@ -93,6 +196,21 @@ function handleSingleLine(content, exclusions, warnings, filePath, lineNum) {
|
|
|
93
196
|
if (content.startsWith('-start') || content.startsWith('-end'))
|
|
94
197
|
return;
|
|
95
198
|
const { ruleIds, reason } = parseRuleIdsAndReason(content);
|
|
199
|
+
// Bug 0158: the grammar documents `<rule-id>: <reason>`, and a reason-free
|
|
200
|
+
// directive must not silence a real finding while the build exits 0.
|
|
201
|
+
//
|
|
202
|
+
// **How that is enforced changed in ADR-012, and the change is the point.**
|
|
203
|
+
// This used to `return` — refusing the waiver — so the author saw the original
|
|
204
|
+
// violation and a line on stderr about their directive. `eess-ts` had always
|
|
205
|
+
// done the opposite (bug 0039): apply the waiver, and let `execute-rule`
|
|
206
|
+
// replace the suppressed finding with an UNSUPPRESSABLE one saying the waiver
|
|
207
|
+
// states no reason. Both end red; the second tells the author what to fix
|
|
208
|
+
// instead of showing them the thing they were waiving.
|
|
209
|
+
//
|
|
210
|
+
// Unifying the two parsers forced a choice, and `eess-ts`'s is the better
|
|
211
|
+
// design, so the kernel adopts it — which means the other four dialects gain
|
|
212
|
+
// it. It is safe here because the kernel's own `execute-rule` now does the
|
|
213
|
+
// promotion; applying without promoting would be the fail-open.
|
|
96
214
|
if (reason === '') {
|
|
97
215
|
warnUndocumented(warnings, ruleIds, 'eess-exclude', filePath, lineNum);
|
|
98
216
|
}
|
|
@@ -106,51 +224,81 @@ function handleSingleLine(content, exclusions, warnings, filePath, lineNum) {
|
|
|
106
224
|
});
|
|
107
225
|
}
|
|
108
226
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
227
|
+
export function parseExclusionComments(sourceText, filePath, options) {
|
|
228
|
+
// Bug 0154: read directives from MASKED text, never the raw source. Strings,
|
|
229
|
+
// templates, regex literals and block comments are blanked first — a directive
|
|
230
|
+
// written inside one is prose, and reading it silently waived a real finding on
|
|
231
|
+
// the next line. Masking is length- and line-preserving, so every position
|
|
232
|
+
// reported below is still the position in the original file.
|
|
233
|
+
// Mask with the lexer that matches the file. Running the JS/TS one over
|
|
234
|
+
// markdown made a stray backtick swallow every directive after it — the same
|
|
235
|
+
// question (is this text an example or an instance?) needs the host language's
|
|
236
|
+
// answer, not one language's answer everywhere.
|
|
237
|
+
//
|
|
238
|
+
// Routed on MARKDOWN specifically, not on "not code". The first version used
|
|
239
|
+
// `!CODE_LIKE`, which handed `.mmd`, `.feature`, `.yml` and everything else to
|
|
240
|
+
// the markdown lexer — and a `.mmd` node label is a quoted string, which the
|
|
241
|
+
// JS masker blanks and the markdown one does not. That is the very mistake this
|
|
242
|
+
// comment describes, committed by the fix for it. Anything neither code nor
|
|
243
|
+
// markdown keeps the conservative masker: over-masking hides a directive
|
|
244
|
+
// (loud), under-masking invents one (silent).
|
|
245
|
+
const defaultMask = CODE_LIKE.test(filePath)
|
|
246
|
+
? maskNonCommentSpans
|
|
247
|
+
: MARKDOWN_LIKE.test(filePath)
|
|
248
|
+
? maskMarkdownCodeSpans
|
|
249
|
+
: maskNonCommentSpans;
|
|
250
|
+
// The dialect's masker runs FIRST and the default runs over its output, so the
|
|
251
|
+
// default's protection cannot be opted out of (ADR-012). A dialect supplies
|
|
252
|
+
// accuracy; it cannot supply permission.
|
|
253
|
+
const injected = options?.mask;
|
|
254
|
+
const masked = injected ? defaultMask(injected(sourceText, filePath)) : defaultMask(sourceText);
|
|
255
|
+
const lines = masked.split('\n');
|
|
256
|
+
const htmlApply = htmlFormsApply(filePath);
|
|
122
257
|
const exclusions = [];
|
|
123
258
|
const warnings = [];
|
|
124
|
-
const openBlocks =
|
|
259
|
+
const openBlocks = [];
|
|
125
260
|
for (let i = 0; i < lines.length; i++) {
|
|
126
261
|
const line = lines[i];
|
|
127
262
|
if (line === undefined)
|
|
128
263
|
continue;
|
|
129
264
|
const lineNum = i + 1;
|
|
130
265
|
// Check block end first (before start/single so we don't match -start as single)
|
|
131
|
-
|
|
266
|
+
// The `//` forms read the FIRST comment's body; the HTML forms read the
|
|
267
|
+
// whole line, since they are for text dialects with no `//` at all.
|
|
268
|
+
const body = firstCommentBody(line);
|
|
269
|
+
if ((body !== undefined && BLOCK_END_RE.test(body)) ||
|
|
270
|
+
(htmlApply && HTML_BLOCK_END_RE.test(line))) {
|
|
132
271
|
handleBlockEnd(openBlocks, exclusions, warnings, filePath, lineNum);
|
|
133
272
|
continue;
|
|
134
273
|
}
|
|
135
274
|
// Check block start
|
|
136
|
-
const startMatch = BLOCK_START_RE.exec(
|
|
137
|
-
|
|
138
|
-
|
|
275
|
+
const startMatch = (body === undefined ? null : BLOCK_START_RE.exec(body)) ??
|
|
276
|
+
(htmlApply ? HTML_BLOCK_START_RE.exec(line) : null);
|
|
277
|
+
// `startMatch !== null`, not `startMatch?.[1]`. The capture is optional now, so
|
|
278
|
+
// a bare `// eess-exclude-start` matches with group 1 undefined — and testing
|
|
279
|
+
// the GROUP threw that line away again, which is the same "no frame, silent,
|
|
280
|
+
// enclosing block closes early" defect one level up from the regex.
|
|
281
|
+
if (startMatch !== null) {
|
|
282
|
+
handleBlockStart(startMatch[1] ?? '', openBlocks, warnings, filePath, lineNum);
|
|
139
283
|
continue;
|
|
140
284
|
}
|
|
141
285
|
// Check single-line exclude (must not match block directives)
|
|
142
|
-
const singleMatch = SINGLE_LINE_RE.exec(
|
|
286
|
+
const singleMatch = (body === undefined ? null : SINGLE_LINE_RE.exec(body)) ??
|
|
287
|
+
(htmlApply ? HTML_SINGLE_RE.exec(line) : null);
|
|
143
288
|
if (singleMatch?.[1]) {
|
|
144
289
|
handleSingleLine(singleMatch[1], exclusions, warnings, filePath, lineNum);
|
|
145
290
|
}
|
|
146
291
|
}
|
|
147
292
|
// Any unclosed blocks are errors
|
|
148
|
-
for (const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
293
|
+
for (const frame of openBlocks) {
|
|
294
|
+
for (const comment of frame) {
|
|
295
|
+
warnings.push({
|
|
296
|
+
message: `eess-exclude-start without matching end for rule '${comment.ruleId}'`,
|
|
297
|
+
file: filePath,
|
|
298
|
+
line: comment.line,
|
|
299
|
+
kind: 'malformed',
|
|
300
|
+
});
|
|
301
|
+
}
|
|
154
302
|
}
|
|
155
303
|
return { exclusions, warnings };
|
|
156
304
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclusion-comments.js","sourceRoot":"","sources":["../src/exclusion-comments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exclusion-comments.js","sourceRoot":"","sources":["../src/exclusion-comments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AA0DlF,gEAAgE;AAChE,wDAAwD;AACxD,iFAAiF;AACjF,kFAAkF;AAClF,kFAAkF;AAClF,kFAAkF;AAClF,kFAAkF;AAClF,QAAQ;AACR,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,uCAAuC;AACvC,MAAM,cAAc,GAAG,+BAA+B,CAAA;AAEtD;;;;;;;;;;;;;GAaG;AACH,MAAM,SAAS,GAAG,iCAAiC,CAAA;AACnD,MAAM,aAAa,GAAG,yBAAyB,CAAA;AAE/C;;;;;GAKG;AACH,SAAS,cAAc,CAAC,QAAgB;IACtC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AAClC,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AACnD,CAAC;A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AAC,MAAM,CAAA;IAC/B,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAEzB,OAAO,QAAQ,CAAC,IAAI,CAClB,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,MAAM,KAAK,MAAM;QACzB,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;QAC/B,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,CAClD,CAAA;AACH,CAAC"}
|
package/dist/execute-rule.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArchViolation } from './violation.js';
|
|
2
|
+
import { type CollectResult } from './collect-result.js';
|
|
2
3
|
import type { CheckOptions } from './check-options.js';
|
|
3
4
|
import type { RuleMetadata } from './rule-metadata.js';
|
|
4
5
|
/**
|
|
@@ -8,6 +9,15 @@ import type { RuleMetadata } from './rule-metadata.js';
|
|
|
8
9
|
*/
|
|
9
10
|
export interface ExecuteRuleContext {
|
|
10
11
|
reason?: string;
|
|
12
|
+
/**
|
|
13
|
+
* This rule's own sentence, deferred (bug 0258).
|
|
14
|
+
*
|
|
15
|
+
* A thunk rather than a string because `filterContext()` runs on every
|
|
16
|
+
* terminal call and this is only read when an id-less rule turns out to have
|
|
17
|
+
* an exclusion comment it cannot honour — the same shape `facts()` already
|
|
18
|
+
* uses for `describeRule` a few lines above it.
|
|
19
|
+
*/
|
|
20
|
+
describe?: () => string;
|
|
11
21
|
metadata?: RuleMetadata;
|
|
12
22
|
exclusions?: (string | RegExp)[];
|
|
13
23
|
silentIndices?: Set<number>;
|
|
@@ -28,7 +38,7 @@ export declare function applyFilters(violations: ArchViolation[], ctx: ExecuteRu
|
|
|
28
38
|
/**
|
|
29
39
|
* Execute the terminal "check" action: apply options, format, throw on violations.
|
|
30
40
|
*/
|
|
31
|
-
export declare function executeCheck(violations:
|
|
41
|
+
export declare function executeCheck(violations: CollectResult, ctx: ExecuteRuleContext, options?: CheckOptions): void;
|
|
32
42
|
/**
|
|
33
43
|
* Execute the terminal "warn" action: apply options, format, log to stderr.
|
|
34
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-rule.d.ts","sourceRoot":"","sources":["../src/execute-rule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"execute-rule.d.ts","sourceRoot":"","sources":["../src/execute-rule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,qBAAqB,CAAA;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AActD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAChC,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,aAAa,EAAE,EAC3B,GAAG,EAAE,kBAAkB,GACtB,aAAa,EAAE,CAmRjB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,aAAa,EACzB,GAAG,EAAE,kBAAkB,EACvB,OAAO,CAAC,EAAE,YAAY,GACrB,IAAI,CA+BN;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,aAAa,EAAE,EAC3B,GAAG,EAAE,kBAAkB,EACvB,OAAO,CAAC,EAAE,YAAY,GACrB,IAAI,CA8BN"}
|