@nielspeter/eess 0.4.0 → 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 +94 -1
- 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 +1 -1
- package/dist/cardinality.d.ts.map +1 -1
- package/dist/cardinality.js +20 -5
- package/dist/cardinality.js.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/condition.d.ts +37 -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.d.ts +30 -0
- package/dist/correspondence.d.ts.map +1 -1
- package/dist/correspondence.js +36 -1
- package/dist/correspondence.js.map +1 -1
- package/dist/dedupe-config-findings.d.ts.map +1 -1
- package/dist/dedupe-config-findings.js +27 -0
- package/dist/dedupe-config-findings.js.map +1 -1
- package/dist/diff-aware.d.ts +8 -9
- package/dist/diff-aware.d.ts.map +1 -1
- package/dist/diff-aware.js +38 -17
- package/dist/diff-aware.js.map +1 -1
- 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 +48 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +61 -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 +12 -3
- package/dist/execute-rule.d.ts.map +1 -1
- package/dist/execute-rule.js +184 -7
- 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-json.d.ts +13 -0
- package/dist/format-json.d.ts.map +1 -1
- package/dist/format-json.js +24 -0
- package/dist/format-json.js.map +1 -1
- package/dist/index.d.ts +14 -46
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -41
- 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.map +1 -1
- package/dist/owns-empty-discovery.js +12 -4
- package/dist/owns-empty-discovery.js.map +1 -1
- 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/predicate.d.ts +12 -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 -34
- package/dist/preset-dispatch.d.ts.map +1 -1
- package/dist/preset-dispatch.js +30 -52
- package/dist/preset-dispatch.js.map +1 -1
- package/dist/report.d.ts +31 -7
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +174 -15
- package/dist/report.js.map +1 -1
- package/dist/rule-builder-like.d.ts +8 -2
- package/dist/rule-builder-like.d.ts.map +1 -1
- package/dist/rule-builder.d.ts +15 -0
- package/dist/rule-builder.d.ts.map +1 -1
- package/dist/rule-builder.js +41 -36
- package/dist/rule-builder.js.map +1 -1
- package/dist/rule-description.d.ts +50 -0
- package/dist/rule-description.d.ts.map +1 -1
- package/dist/rule-description.js +58 -0
- package/dist/rule-description.js.map +1 -1
- package/dist/selection-memo.d.ts +1 -3
- package/dist/selection-memo.d.ts.map +1 -1
- package/dist/selection-memo.js +1 -3
- package/dist/selection-memo.js.map +1 -1
- 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/terminal-builder.d.ts +29 -15
- package/dist/terminal-builder.d.ts.map +1 -1
- package/dist/terminal-builder.js +97 -51
- package/dist/terminal-builder.js.map +1 -1
- package/dist/vacuity-findings.d.ts +0 -6
- package/dist/vacuity-findings.d.ts.map +1 -1
- package/dist/vacuity-findings.js +27 -57
- package/dist/vacuity-findings.js.map +1 -1
- package/dist/violation.d.ts +22 -1
- package/dist/violation.d.ts.map +1 -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
package/dist/combinators.d.ts
CHANGED
|
@@ -22,6 +22,20 @@ export type Matcher<V> = (value: V) => boolean;
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function not<T>(input: Predicate<T>): Predicate<T>;
|
|
24
24
|
export declare function not<V>(input: Matcher<V>): Matcher<V>;
|
|
25
|
+
/**
|
|
26
|
+
* Every input to `and()`/`or()` must be the same kind.
|
|
27
|
+
*
|
|
28
|
+
* `eess-ts` carried a byte-identical copy — `no-copy-paste` reported it at
|
|
29
|
+
* 100%, with only the noun in the message differing — so the noun is now the
|
|
30
|
+
* parameter and the check has one owner.
|
|
31
|
+
*
|
|
32
|
+
* A `TypeError` and not a filtered result: mixing an object predicate with a
|
|
33
|
+
* matcher function silently drops one kind (the implementations below filter
|
|
34
|
+
* by `typeof`), so a rule composed that way would narrow by half of what its
|
|
35
|
+
* author wrote and pass on the rest. Refusing at composition time is the only
|
|
36
|
+
* point where the mistake is still visible.
|
|
37
|
+
*/
|
|
38
|
+
export declare function assertHomogeneous<T, V>(inputs: (Predicate<T> | Matcher<V>)[], matcherNoun?: string): void;
|
|
25
39
|
/**
|
|
26
40
|
* Combines predicates or matchers with AND logic.
|
|
27
41
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAA;AAE9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AACzD,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAiBrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EACpC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EACrC,WAAW,SAAY,GACtB,IAAI,CAMN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AACnE,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAK7D;;;;;;;;;;;;GAYG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAClE,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA"}
|
package/dist/combinators.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { combineGlobs, negateGlobs } from './glob-site.js';
|
|
1
2
|
export function not(input) {
|
|
2
3
|
if (typeof input === 'function') {
|
|
3
4
|
return (value) => !input(value);
|
|
@@ -5,39 +6,75 @@ export function not(input) {
|
|
|
5
6
|
return {
|
|
6
7
|
description: `not (${input.description})`,
|
|
7
8
|
test: (element) => !input.test(element),
|
|
9
|
+
// Negation-normal-form push-down: `op` inverts as well as `polarity`.
|
|
10
|
+
// `not(unsatisfiable)` selects everything, so a negated site is
|
|
11
|
+
// over-selection rather than vacuity and can never be a fault — but a
|
|
12
|
+
// `not` nested inside the subtree flips it back, which is why this cannot
|
|
13
|
+
// just flip polarity. See `negateGlobs`.
|
|
14
|
+
globs: input.globs && negateGlobs(input.globs),
|
|
8
15
|
};
|
|
9
16
|
}
|
|
10
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Every input to `and()`/`or()` must be the same kind.
|
|
19
|
+
*
|
|
20
|
+
* `eess-ts` carried a byte-identical copy — `no-copy-paste` reported it at
|
|
21
|
+
* 100%, with only the noun in the message differing — so the noun is now the
|
|
22
|
+
* parameter and the check has one owner.
|
|
23
|
+
*
|
|
24
|
+
* A `TypeError` and not a filtered result: mixing an object predicate with a
|
|
25
|
+
* matcher function silently drops one kind (the implementations below filter
|
|
26
|
+
* by `typeof`), so a rule composed that way would narrow by half of what its
|
|
27
|
+
* author wrote and pass on the rest. Refusing at composition time is the only
|
|
28
|
+
* point where the mistake is still visible.
|
|
29
|
+
*/
|
|
30
|
+
export function assertHomogeneous(inputs, matcherNoun = 'Matcher') {
|
|
11
31
|
if (inputs.length === 0)
|
|
12
32
|
return;
|
|
13
33
|
const firstIsFunction = typeof inputs[0] === 'function';
|
|
14
34
|
if (inputs.some((i) => (typeof i === 'function') !== firstIsFunction)) {
|
|
15
|
-
throw new TypeError(
|
|
35
|
+
throw new TypeError(`Cannot mix Predicate objects and ${matcherNoun} functions in and()/or()`);
|
|
16
36
|
}
|
|
17
37
|
}
|
|
18
38
|
export function and(...inputs) {
|
|
19
|
-
|
|
20
|
-
if (typeof inputs[0] === 'function') {
|
|
21
|
-
const matchers = inputs.filter((input) => typeof input === 'function');
|
|
22
|
-
const fn = (value) => matchers.every((m) => m(value));
|
|
23
|
-
return fn;
|
|
24
|
-
}
|
|
25
|
-
const predicates = inputs.filter((input) => typeof input !== 'function');
|
|
26
|
-
return {
|
|
27
|
-
description: predicates.map((p) => p.description).join(' and '),
|
|
28
|
-
test: (element) => predicates.every((p) => p.test(element)),
|
|
29
|
-
};
|
|
39
|
+
return combine(inputs, 'all');
|
|
30
40
|
}
|
|
31
41
|
export function or(...inputs) {
|
|
42
|
+
return combine(inputs, 'any');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The body `and()` and `or()` share, with the quantifier as its one parameter.
|
|
46
|
+
*
|
|
47
|
+
* They were the same fifteen lines twice — `no-copy-paste` reported them at
|
|
48
|
+
* 98%, across both packages — but the reason to share them is that **three
|
|
49
|
+
* choices have to agree and nothing was making them**:
|
|
50
|
+
*
|
|
51
|
+
* | `op` | quantifier | joined with | glob node |
|
|
52
|
+
* | ------- | ---------- | ----------- | --------- |
|
|
53
|
+
* | `'all'` | `every` | `' and '` | `'all'` |
|
|
54
|
+
* | `'any'` | `some` | `' or '` | `'any'` |
|
|
55
|
+
*
|
|
56
|
+
* A conjunction selects nothing as soon as ONE input does; a disjunction only
|
|
57
|
+
* when EVERY input does. Pairing `some` with a `'all'` glob node — one edit
|
|
58
|
+
* away, in two files, when they were written out separately — reports a live
|
|
59
|
+
* selector as dead, which is a configuration finding against a rule that is
|
|
60
|
+
* fine. Deriving all three from `op` is what makes that unreachable.
|
|
61
|
+
*
|
|
62
|
+
* Inputs that declare no globs become retained opaque children rather than
|
|
63
|
+
* being dropped: dropping them is what would red `or(deadGlob, byName)`.
|
|
64
|
+
*/
|
|
65
|
+
function combine(inputs, op) {
|
|
32
66
|
assertHomogeneous(inputs);
|
|
67
|
+
const holds = (xs, f) => op === 'all' ? xs.every(f) : xs.some(f);
|
|
33
68
|
if (typeof inputs[0] === 'function') {
|
|
34
69
|
const matchers = inputs.filter((input) => typeof input === 'function');
|
|
35
|
-
|
|
70
|
+
const fn = (value) => holds(matchers, (m) => m(value));
|
|
71
|
+
return fn;
|
|
36
72
|
}
|
|
37
73
|
const predicates = inputs.filter((input) => typeof input !== 'function');
|
|
38
74
|
return {
|
|
39
|
-
description: predicates.map((p) => p.description).join(' or '),
|
|
40
|
-
test: (element) => predicates
|
|
75
|
+
description: predicates.map((p) => p.description).join(op === 'all' ? ' and ' : ' or '),
|
|
76
|
+
test: (element) => holds(predicates, (p) => p.test(element)),
|
|
77
|
+
globs: combineGlobs(op, predicates.map((p) => p.globs)),
|
|
41
78
|
};
|
|
42
79
|
}
|
|
43
80
|
//# sourceMappingURL=combinators.js.map
|
package/dist/combinators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combinators.js","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"combinators.js","sourceRoot":"","sources":["../src/combinators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW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ACF,CAAA;AACH,CAAC"}
|
package/dist/condition.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ArchViolation } from './violation.js';
|
|
2
|
+
import { type CollectResult } from './collect-result.js';
|
|
2
3
|
import type { DeclaredGlobs } from './glob-site.js';
|
|
4
|
+
import type { RuleMetadata } from './rule-metadata.js';
|
|
3
5
|
/**
|
|
4
6
|
* Context passed to conditions during evaluation.
|
|
5
7
|
*
|
|
@@ -33,6 +35,25 @@ export interface ConditionContext {
|
|
|
33
35
|
*/
|
|
34
36
|
identifyByArgument?: number;
|
|
35
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The context a condition receives, projected from what the rule declared.
|
|
40
|
+
*
|
|
41
|
+
* Four of the five fields are read off `RuleMetadata` identically everywhere;
|
|
42
|
+
* only `rule` — the assembled English sentence — differs, because the kernel's
|
|
43
|
+
* `RuleBuilder` builds it from its own lists and `eess-ts`'s builds it from a
|
|
44
|
+
* `DeclaredRule`. The two bodies were 93% similar with that as the sole varying
|
|
45
|
+
* axis.
|
|
46
|
+
*
|
|
47
|
+
* Worth one owner beyond the duplicate count: this context is what a violation
|
|
48
|
+
* message is written from, so a field silently absent on one side of the family
|
|
49
|
+
* produces findings that name their rule in one dialect and not the other —
|
|
50
|
+
* exactly the "a violation must be actionable" clause of ADR-009.
|
|
51
|
+
*/
|
|
52
|
+
export declare function conditionContextFrom(opts: {
|
|
53
|
+
metadata: RuleMetadata | undefined;
|
|
54
|
+
reason: string | undefined;
|
|
55
|
+
rule: string;
|
|
56
|
+
}): ConditionContext;
|
|
36
57
|
/**
|
|
37
58
|
* A condition that evaluates filtered elements and returns violations.
|
|
38
59
|
*
|
|
@@ -59,4 +80,20 @@ export interface Condition<T> {
|
|
|
59
80
|
*/
|
|
60
81
|
readonly globs?: DeclaredGlobs;
|
|
61
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Run every condition over the selected elements, carrying the evidence.
|
|
85
|
+
*
|
|
86
|
+
* `examined` is the count the conditions were actually HANDED — not the
|
|
87
|
+
* pre-predicate population — and that distinction is the reason this is shared
|
|
88
|
+
* rather than written per builder. `graphql/resolver-rule-builder.ts` records
|
|
89
|
+
* what happened when two sibling builders derived it separately: one counted
|
|
90
|
+
* pre-predicate and the other post, and a chain whose `.that()` selected nothing
|
|
91
|
+
* reported 14 units examined, handed its conditions 0, and passed green with
|
|
92
|
+
* `diagnose()` silent. That is the fail-open cell ADR-009 exists to close.
|
|
93
|
+
*
|
|
94
|
+
* The zero-element early exit is stated rather than implied by an empty
|
|
95
|
+
* violation list (plan 0098): a receipt with `examined: 0` is the
|
|
96
|
+
* zero-evidence case, and ADR-010 wants it said out loud.
|
|
97
|
+
*/
|
|
98
|
+
export declare function evaluateConditions<T>(elements: T[], conditions: readonly Condition<T>[], context: ConditionContext): CollectResult;
|
|
62
99
|
//# sourceMappingURL=condition.d.ts.map
|
package/dist/condition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../src/condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../src/condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,qBAAqB,CAAA;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAA;IAClC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,gBAAgB,CAQnB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAE5B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAAA;IAEnE;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAA;CAC/B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,QAAQ,EAAE,CAAC,EAAE,EACb,UAAU,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,EACnC,OAAO,EAAE,gBAAgB,GACxB,aAAa,CAOf"}
|
package/dist/condition.js
CHANGED
|
@@ -1,2 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
import { collectResult } from './collect-result.js';
|
|
2
|
+
/**
|
|
3
|
+
* The context a condition receives, projected from what the rule declared.
|
|
4
|
+
*
|
|
5
|
+
* Four of the five fields are read off `RuleMetadata` identically everywhere;
|
|
6
|
+
* only `rule` — the assembled English sentence — differs, because the kernel's
|
|
7
|
+
* `RuleBuilder` builds it from its own lists and `eess-ts`'s builds it from a
|
|
8
|
+
* `DeclaredRule`. The two bodies were 93% similar with that as the sole varying
|
|
9
|
+
* axis.
|
|
10
|
+
*
|
|
11
|
+
* Worth one owner beyond the duplicate count: this context is what a violation
|
|
12
|
+
* message is written from, so a field silently absent on one side of the family
|
|
13
|
+
* produces findings that name their rule in one dialect and not the other —
|
|
14
|
+
* exactly the "a violation must be actionable" clause of ADR-009.
|
|
15
|
+
*/
|
|
16
|
+
export function conditionContextFrom(opts) {
|
|
17
|
+
return {
|
|
18
|
+
rule: opts.rule,
|
|
19
|
+
because: opts.reason,
|
|
20
|
+
ruleId: opts.metadata?.id,
|
|
21
|
+
suggestion: opts.metadata?.suggestion,
|
|
22
|
+
docs: opts.metadata?.docs,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Run every condition over the selected elements, carrying the evidence.
|
|
27
|
+
*
|
|
28
|
+
* `examined` is the count the conditions were actually HANDED — not the
|
|
29
|
+
* pre-predicate population — and that distinction is the reason this is shared
|
|
30
|
+
* rather than written per builder. `graphql/resolver-rule-builder.ts` records
|
|
31
|
+
* what happened when two sibling builders derived it separately: one counted
|
|
32
|
+
* pre-predicate and the other post, and a chain whose `.that()` selected nothing
|
|
33
|
+
* reported 14 units examined, handed its conditions 0, and passed green with
|
|
34
|
+
* `diagnose()` silent. That is the fail-open cell ADR-009 exists to close.
|
|
35
|
+
*
|
|
36
|
+
* The zero-element early exit is stated rather than implied by an empty
|
|
37
|
+
* violation list (plan 0098): a receipt with `examined: 0` is the
|
|
38
|
+
* zero-evidence case, and ADR-010 wants it said out loud.
|
|
39
|
+
*/
|
|
40
|
+
export function evaluateConditions(elements, conditions, context) {
|
|
41
|
+
if (elements.length === 0)
|
|
42
|
+
return collectResult([], { examined: 0 });
|
|
43
|
+
const violations = [];
|
|
44
|
+
for (const condition of conditions) {
|
|
45
|
+
violations.push(...condition.evaluate(elements, context));
|
|
46
|
+
}
|
|
47
|
+
return collectResult(violations, { examined: elements.length });
|
|
48
|
+
}
|
|
2
49
|
//# sourceMappingURL=condition.js.map
|
package/dist/condition.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../src/condition.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"condition.js","sourceRoot":"","sources":["../src/condition.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAsCvE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAIpC;IACC,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,MAAM;QACpB,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE;QACzB,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU;QACrC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI;KAC1B,CAAA;AACH,CAAC;AA+BD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAa,EACb,UAAmC,EACnC,OAAyB;IAEzB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,aAAa,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAA;IACpE,MAAM,UAAU,GAAoB,EAAE,CAAA;IACtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,aAAa,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;AACjE,CAAC"}
|
package/dist/correspondence.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Predicate } from './predicate.js';
|
|
1
2
|
import { TerminalBuilder, type CollectResult } from './terminal-builder.js';
|
|
2
3
|
/** How to identify an element for a two-sided violation message. */
|
|
3
4
|
export interface ElementInfo {
|
|
@@ -97,4 +98,33 @@ export declare class CorrespondenceBuilder<L, R> extends TerminalBuilder {
|
|
|
97
98
|
}
|
|
98
99
|
/** Bind two selections into a correspondence. */
|
|
99
100
|
export declare function correspondence<L, R>(opts: CorrespondenceOptions<L, R>): CorrespondenceBuilder<L, R>;
|
|
101
|
+
/**
|
|
102
|
+
* The elements a rule's predicates admit, as a `Selection`.
|
|
103
|
+
*
|
|
104
|
+
* A free function over the elements and the predicates rather than a method,
|
|
105
|
+
* for the same reason as `recordExclusions`: the two builders that need it sit
|
|
106
|
+
* in incompatible hierarchies — `eess-ts` has three levels where the kernel has
|
|
107
|
+
* two — so there is no common base to hold it. The two copies were
|
|
108
|
+
* byte-identical.
|
|
109
|
+
*/
|
|
110
|
+
export declare function selectMatching<T>(elements: readonly T[], predicates: readonly Predicate<T>[], opts: {
|
|
111
|
+
label: string;
|
|
112
|
+
identify: (element: T) => ElementInfo;
|
|
113
|
+
}): Selection<T>;
|
|
114
|
+
/**
|
|
115
|
+
* The elements every predicate admits.
|
|
116
|
+
*
|
|
117
|
+
* The same conjunction as `selectMatching`, without a `Selection` around it —
|
|
118
|
+
* split out because `eess-ts`'s two GraphQL builders want the ARRAY, to memoise
|
|
119
|
+
* it as the one set both `check()` and `diagnose()` read (plan 0096). They each
|
|
120
|
+
* carried this filter inline, byte for byte, which `no-copy-paste` reported at
|
|
121
|
+
* 100%; folding them onto `selectMatching` was not open, since a `Selection`
|
|
122
|
+
* carries a label and an `identify` neither of them has at that point.
|
|
123
|
+
*
|
|
124
|
+
* Sharing it with `selectMatching` matters beyond the duplicate count: "the
|
|
125
|
+
* elements a rule selected" must be ONE answer, or a builder's `.select()` side
|
|
126
|
+
* and its condition side can disagree about which elements the predicates
|
|
127
|
+
* admitted — the divergence ADR-010 exists to make impossible.
|
|
128
|
+
*/
|
|
129
|
+
export declare function matchingElements<T>(elements: readonly T[], predicates: readonly Predicate<T>[]): T[];
|
|
100
130
|
//# sourceMappingURL=correspondence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correspondence.d.ts","sourceRoot":"","sources":["../src/correspondence.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"correspondence.d.ts","sourceRoot":"","sources":["../src/correspondence.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAO3E,oEAAoE;AACpE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,WAAW,CAAA;CAC/C;AAED,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,eAAe,GAAG,MAAM,CAAA;AAElE,2EAA2E;AAC3E,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,SAAS,MAAM,EAAE,CAAA;IAChD,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,SAAS,MAAM,EAAE,CAAA;IACjD,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAC/B;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAClB,CAAC,CAAC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AIG;IACH,UAAU,CAAC,IAAI,GAAE;QAAE,SAAS,CAAC,EAAE,SAAS,CAAA;KAAO,GAAG,IAAI;IAStD;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI;IASjD,SAAS,CAAC,iBAAiB,IAAI,aAAa;IAW5C;;;;;;;;;;;;;OAaG;cACgB,kBAAkB,IAAI,OAAO;CAIjD;AAED,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EACjC,IAAI,EAAE,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,GAChC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAE7B;AA6GD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,QAAQ,EAAE,SAAS,CAAC,EAAE,EACtB,UAAU,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,EACnC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,WAAW,CAAA;CAAE,GAC7D,SAAS,CAAC,CAAC,CAAC,CAMd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,QAAQ,EAAE,SAAS,CAAC,EAAE,EACtB,UAAU,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,GAClC,CAAC,EAAE,CAEL"}
|
package/dist/correspondence.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { collectResult } from './collect-result.js';
|
|
1
2
|
import { TerminalBuilder } from './terminal-builder.js';
|
|
2
3
|
import { matchSelections } from './matching.js';
|
|
3
4
|
import { marksAssertsCardinality, assertsCardinality as checkAssertsCardinality, } from './cardinality.js';
|
|
@@ -60,7 +61,7 @@ export class CorrespondenceBuilder extends TerminalBuilder {
|
|
|
60
61
|
// many checks were chained; one side alone being empty is still real
|
|
61
62
|
// examination of the other.
|
|
62
63
|
const examined = this.opts.left.elements.length + this.opts.right.elements.length;
|
|
63
|
-
return
|
|
64
|
+
return collectResult(violations, { examined });
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
66
67
|
* ADR-010: mirrors `RuleBuilder.assertsCardinality()` — per-check, not a
|
|
@@ -158,4 +159,38 @@ function relations(o, spec, ruleId) {
|
|
|
158
159
|
}
|
|
159
160
|
return out;
|
|
160
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* The elements a rule's predicates admit, as a `Selection`.
|
|
164
|
+
*
|
|
165
|
+
* A free function over the elements and the predicates rather than a method,
|
|
166
|
+
* for the same reason as `recordExclusions`: the two builders that need it sit
|
|
167
|
+
* in incompatible hierarchies — `eess-ts` has three levels where the kernel has
|
|
168
|
+
* two — so there is no common base to hold it. The two copies were
|
|
169
|
+
* byte-identical.
|
|
170
|
+
*/
|
|
171
|
+
export function selectMatching(elements, predicates, opts) {
|
|
172
|
+
return {
|
|
173
|
+
elements: matchingElements(elements, predicates),
|
|
174
|
+
label: opts.label,
|
|
175
|
+
identify: opts.identify,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The elements every predicate admits.
|
|
180
|
+
*
|
|
181
|
+
* The same conjunction as `selectMatching`, without a `Selection` around it —
|
|
182
|
+
* split out because `eess-ts`'s two GraphQL builders want the ARRAY, to memoise
|
|
183
|
+
* it as the one set both `check()` and `diagnose()` read (plan 0096). They each
|
|
184
|
+
* carried this filter inline, byte for byte, which `no-copy-paste` reported at
|
|
185
|
+
* 100%; folding them onto `selectMatching` was not open, since a `Selection`
|
|
186
|
+
* carries a label and an `identify` neither of them has at that point.
|
|
187
|
+
*
|
|
188
|
+
* Sharing it with `selectMatching` matters beyond the duplicate count: "the
|
|
189
|
+
* elements a rule selected" must be ONE answer, or a builder's `.select()` side
|
|
190
|
+
* and its condition side can disagree about which elements the predicates
|
|
191
|
+
* admitted — the divergence ADR-010 exists to make impossible.
|
|
192
|
+
*/
|
|
193
|
+
export function matchingElements(elements, predicates) {
|
|
194
|
+
return elements.filter((element) => predicates.every((predicate) => predicate.test(element)));
|
|
195
|
+
}
|
|
161
196
|
//# sourceMappingURL=correspondence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correspondence.js","sourceRoot":"","sources":["../src/correspondence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAsB,MAAM,uBAAuB,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAA;AAClE,OAAO,EACL,uBAAuB,EACvB,kBAAkB,IAAI,uBAAuB,GAC9C,MAAM,kBAAkB,CAAA;AAyDzB,SAAS,YAAY,CAAC,IAAiB,EAAE,OAAe,EAAE,MAAe;IACvE,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,MAAM;QACN,OAAO,EAAE,IAAI,CAAC,IAAI;QAClB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,aAAa;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;QACpB,OAAO;QACP,SAAS,EAAE,SAAS;KACrB,CAAA;AACH,CAAC;AAID;;;;;;GAMG;AACH,MAAM,OAAO,qBAA4B,SAAQ,eAAe;IAGjC;IAFZ,OAAO,GAAkB,EAAE,CAAA;IAE5C,YAA6B,IAAiC;QAC5D,KAAK,EAAE,CAAA;QADoB,SAAI,GAAJ,IAAI,CAA6B;IAE9D,CAAC;IAED,2DAA2D;IAC3D,MAAM;QACJ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,gDAAgD;IAChD,SAAS;QACP,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAkC,EAAE;QAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,CACf,uBAAuB,CAAC,CAAC,CAA8B,EAAE,MAAe,EAAE,EAAE,CAC1E,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,IAAI,M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AAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAsB,EACtB,UAAmC;IAEnC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAC/F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedupe-config-findings.d.ts","sourceRoot":"","sources":["../src/dedupe-config-findings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"dedupe-config-findings.d.ts","sourceRoot":"","sources":["../src/dedupe-config-findings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAenD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,GAAG,aAAa,EAAE,CAsC1F"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// The ids that are never collapsed — see `keyFor`. Imported rather than
|
|
2
|
+
// re-listed: `emitter-findings.ts` declares them and owns the set, so the next
|
|
3
|
+
// id is added in one place. A second local list here is how this guard would
|
|
4
|
+
// silently stop covering a fifth id.
|
|
5
|
+
import { EMITTER_IDS } from './emitter-findings.js';
|
|
1
6
|
/** How the surviving finding states the fan-out it stands for. */
|
|
2
7
|
function affectedNote(count) {
|
|
3
8
|
return (` This one option generated ${String(count)} rules that cannot enforce anything; they are ` +
|
|
@@ -69,6 +74,28 @@ function keyFor(violation) {
|
|
|
69
74
|
return undefined;
|
|
70
75
|
if (violation.element === '' || violation.element === 'unnamed')
|
|
71
76
|
return undefined;
|
|
77
|
+
// An emitter finding is about a VERDICT, not about a rule's narrowing, so the
|
|
78
|
+
// collapse's premise — one authored option fanned out by a preset — never
|
|
79
|
+
// holds for it. Each one stands for a different builder that hands back no
|
|
80
|
+
// evidence, and each is its own edit in its own place.
|
|
81
|
+
//
|
|
82
|
+
// It cannot be told apart by shape: `emitter-findings.ts` sets
|
|
83
|
+
// `element: ruleId` (the fault is the verdict, so there is no place in anyone's
|
|
84
|
+
// code to point at) and `file: ''`, so the key degenerates to `('' , id, id)`
|
|
85
|
+
// and every occurrence in a run merges. Measured before this guard: three
|
|
86
|
+
// hand-rolled builders in one rule file reported as ONE finding whose note said
|
|
87
|
+
// they were "one edit". They are three edits — the case 0069's appendix decides
|
|
88
|
+
// the other way ("two different `shared` entries that both match nothing are
|
|
89
|
+
// two findings, because they are two edits").
|
|
90
|
+
//
|
|
91
|
+
// **Keyed on the id set, not on the `element === identity` shape.** A first cut
|
|
92
|
+
// refused a key whenever the element repeated the identity, and that is too
|
|
93
|
+
// broad: a real rule with a real narrowing and no glob to name does the same,
|
|
94
|
+
// and two instances of it genuinely ARE one edit — `the-floor.test.ts`'s
|
|
95
|
+
// "CONTROL: genuinely identical findings still collapse" reds on it, over
|
|
96
|
+
// `smells.duplicateBodies(p).minLines(500)`.
|
|
97
|
+
if (EMITTER_IDS.has(identity))
|
|
98
|
+
return undefined;
|
|
72
99
|
return `${violation.file} ${identity} ${violation.element}`;
|
|
73
100
|
}
|
|
74
101
|
//# sourceMappingURL=dedupe-config-findings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedupe-config-findings.js","sourceRoot":"","sources":["../src/dedupe-config-findings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dedupe-config-findings.js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6CAA6C;IAC7C,IAAI,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAA;IAC/C,OAAO,GAAG,SAAS,CAAC,IAAI,IAAI,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE,CAAA;AAC7D,CAAC"}
|
package/dist/diff-aware.d.ts
CHANGED
|
@@ -10,18 +10,17 @@ import type { ArchViolation } from './violation.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class DiffFilter {
|
|
12
12
|
private readonly changedFiles;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The branch this filter diffed against, for the suppression notice plan
|
|
15
|
+
* 0071 added. Defaulted rather than required: the constructor is public API
|
|
16
|
+
* (`src/index.ts` exports `DiffFilter`), so an existing
|
|
17
|
+
* `new DiffFilter(files)` must keep compiling.
|
|
18
|
+
*/
|
|
19
|
+
readonly baseBranch: string;
|
|
20
|
+
constructor(changedFiles: Set<string> | null, baseBranch?: string);
|
|
14
21
|
/**
|
|
15
22
|
* Filter violations to only those in changed files.
|
|
16
23
|
* If changedFiles is null (git error), returns all violations unfiltered.
|
|
17
|
-
*
|
|
18
|
-
* A `bypassFilters` configuration finding (ADR-010's zero-examined /
|
|
19
|
-
* expired-`.expectEmpty()` violations) is never filtered here, even
|
|
20
|
-
* though its `file` is always `''` and can never be a member of
|
|
21
|
-
* `changedFiles`. Without this, "unsuppressable" was false for the most
|
|
22
|
-
* realistic adoption path: a rule whose instrument silently broke would
|
|
23
|
-
* report nothing at all under `--changed`, with no diagnostic that
|
|
24
|
-
* anything was ever hidden.
|
|
25
24
|
*/
|
|
26
25
|
filterToChanged(violations: ArchViolation[]): ArchViolation[];
|
|
27
26
|
/** Number of changed files detected, or -1 if diff unavailable */
|
package/dist/diff-aware.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-aware.d.ts","sourceRoot":"","sources":["../src/diff-aware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAGnD;;;;;;;;GAQG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;
|
|
1
|
+
{"version":3,"file":"diff-aware.d.ts","sourceRoot":"","sources":["../src/diff-aware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAGnD;;;;;;;;GAQG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IAEjD;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;gBAEf,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,UAAU,GAAE,MAA0B;IAKpF;;;OAGG;IACH,eAAe,CAAC,UAAU,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE;IA0B7D,kEAAkE;IAClE,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,UAAU,GAAE,MAAe,GAAG,UAAU,CAiCjE"}
|
package/dist/diff-aware.js
CHANGED
|
@@ -12,26 +12,43 @@ import { writeStderr } from './stderr.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export class DiffFilter {
|
|
14
14
|
changedFiles;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The branch this filter diffed against, for the suppression notice plan
|
|
17
|
+
* 0071 added. Defaulted rather than required: the constructor is public API
|
|
18
|
+
* (`src/index.ts` exports `DiffFilter`), so an existing
|
|
19
|
+
* `new DiffFilter(files)` must keep compiling.
|
|
20
|
+
*/
|
|
21
|
+
baseBranch;
|
|
22
|
+
constructor(changedFiles, baseBranch = 'the base branch') {
|
|
16
23
|
this.changedFiles = changedFiles;
|
|
24
|
+
this.baseBranch = baseBranch;
|
|
17
25
|
}
|
|
18
26
|
/**
|
|
19
27
|
* Filter violations to only those in changed files.
|
|
20
28
|
* If changedFiles is null (git error), returns all violations unfiltered.
|
|
21
|
-
*
|
|
22
|
-
* A `bypassFilters` configuration finding (ADR-010's zero-examined /
|
|
23
|
-
* expired-`.expectEmpty()` violations) is never filtered here, even
|
|
24
|
-
* though its `file` is always `''` and can never be a member of
|
|
25
|
-
* `changedFiles`. Without this, "unsuppressable" was false for the most
|
|
26
|
-
* realistic adoption path: a rule whose instrument silently broke would
|
|
27
|
-
* report nothing at all under `--changed`, with no diagnostic that
|
|
28
|
-
* anything was ever hidden.
|
|
29
29
|
*/
|
|
30
30
|
filterToChanged(violations) {
|
|
31
31
|
const files = this.changedFiles;
|
|
32
32
|
if (files === null)
|
|
33
33
|
return violations;
|
|
34
|
-
|
|
34
|
+
// Config-level meta-findings (empty selector/discovery) have no changed file
|
|
35
|
+
// to attribute to — never filter them out (ADR-008; plan 0067).
|
|
36
|
+
//
|
|
37
|
+
// Kept from the kernel's copy when the two were unified, because it is the
|
|
38
|
+
// half that says WHY: a `bypassFilters` configuration finding (ADR-010's
|
|
39
|
+
// zero-examined / expired-`.expectEmpty()` violations) has `file: ''` and can
|
|
40
|
+
// never be a member of `changedFiles`. Without this branch, "unsuppressable"
|
|
41
|
+
// was false for the most realistic adoption path — a rule whose instrument
|
|
42
|
+
// silently broke reported nothing at all under `--changed`, with no
|
|
43
|
+
// diagnostic that anything had been hidden.
|
|
44
|
+
// `relatedFiles` (bug 0239): a finding about a RELATIONSHIP concerns several
|
|
45
|
+
// files and can only be reported at one of them. Keeping it when any of them
|
|
46
|
+
// changed is what makes `--changed` honest for it — the alternative measured
|
|
47
|
+
// in 0239 was that the developer who introduced a duplicate saw nothing,
|
|
48
|
+
// because the finding was anchored on the file they had not edited.
|
|
49
|
+
return violations.filter((v) => v.bypassFilters === true ||
|
|
50
|
+
files.has(v.file) ||
|
|
51
|
+
(v.relatedFiles?.some((f) => files.has(f)) ?? false));
|
|
35
52
|
}
|
|
36
53
|
/** Number of changed files detected, or -1 if diff unavailable */
|
|
37
54
|
get size() {
|
|
@@ -62,17 +79,21 @@ export function diffAware(baseBranch = 'main') {
|
|
|
62
79
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
63
80
|
}).trim();
|
|
64
81
|
}
|
|
65
|
-
catch (
|
|
66
|
-
// Not a git repo, or base branch doesn't exist — skip filtering (report
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
catch (error) {
|
|
83
|
+
// Not a git repo, or the base branch doesn't exist — skip filtering (report
|
|
84
|
+
// all violations). The cause is named: "could not run git diff" alone sends
|
|
85
|
+
// a reader looking for a missing branch when the real answer may be that git
|
|
86
|
+
// is not installed, or that the cwd is not a repository at all.
|
|
87
|
+
writeStderr(`[eess] Could not run git diff against '${baseBranch}' ` +
|
|
88
|
+
`(${error instanceof Error ? error.message.split('\n')[0] : String(error)}). ` +
|
|
89
|
+
'All violations will be reported.');
|
|
90
|
+
return new DiffFilter(null, baseBranch);
|
|
70
91
|
}
|
|
71
92
|
if (output === '') {
|
|
72
93
|
// No changes — empty set means nothing is "changed", so all violations are filtered out
|
|
73
|
-
return new DiffFilter(new Set());
|
|
94
|
+
return new DiffFilter(new Set(), baseBranch);
|
|
74
95
|
}
|
|
75
96
|
const changedFiles = new Set(output.split('\n').map((relativePath) => path.resolve(cwd, relativePath)));
|
|
76
|
-
return new DiffFilter(changedFiles);
|
|
97
|
+
return new DiffFilter(changedFiles, baseBranch);
|
|
77
98
|
}
|
|
78
99
|
//# sourceMappingURL=diff-aware.js.map
|
package/dist/diff-aware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-aware.js","sourceRoot":"","sources":["../src/diff-aware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC;;;;;;;;GAQG;AACH,MAAM,OAAO,UAA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