@descent-vtt/spec-guard 0.3.0 → 0.4.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/CHANGELOG.md +60 -0
- package/README.md +89 -24
- package/dist/cli.d.ts +2 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/engine.d.ts +43 -49
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +162 -254
- package/dist/engine.js.map +1 -1
- package/dist/glob.d.ts +19 -6
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +14 -28
- package/dist/glob.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +33 -3
- package/dist/reporter.js.map +1 -1
- package/dist/runner.d.ts +12 -3
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +137 -92
- package/dist/runner.js.map +1 -1
- package/dist/scope.d.ts +108 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +115 -0
- package/dist/scope.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/scope.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search scope: what an assertion actually looked at.
|
|
3
|
+
*
|
|
4
|
+
* An assertion's answer is worth exactly as much as the set of files behind it.
|
|
5
|
+
* "`LegacyThing` appears nowhere in `src`" is a useful claim; "`LegacyThing`
|
|
6
|
+
* appears nowhere in the part of `src` we happened to walk" is not, and the two
|
|
7
|
+
* are indistinguishable in a report that only prints a count.
|
|
8
|
+
*
|
|
9
|
+
* So every file under a target lands in exactly one of three states, and the
|
|
10
|
+
* third one is never silent:
|
|
11
|
+
*
|
|
12
|
+
* inspected - read and searched.
|
|
13
|
+
* excluded - the assertion's own `exclude`/`glob` said so. Not reported:
|
|
14
|
+
* the user asked for it and already knows.
|
|
15
|
+
* skipped - spec-guard decided. Always counted, always reported.
|
|
16
|
+
*
|
|
17
|
+
* Skips split further, because two very different things were being conflated:
|
|
18
|
+
*
|
|
19
|
+
* policy - `.git`, `node_modules`. Deliberate, uninteresting, and not a
|
|
20
|
+
* gap in the analysis. Reported as a total.
|
|
21
|
+
* uncertainty - a file that could not be read, or whose bytes are not text.
|
|
22
|
+
* These are gaps: the file might contain the symbol and nobody
|
|
23
|
+
* knows. Reported individually, and `--strict` fails on them.
|
|
24
|
+
*
|
|
25
|
+
* The policy list is deliberately tiny. Every name on it is a place where the
|
|
26
|
+
* tool can be sure it is not looking at your code: version-control object
|
|
27
|
+
* stores, which hold compressed copies of code you already deleted, and
|
|
28
|
+
* dependency trees, which hold code you did not write. Names like `dist`,
|
|
29
|
+
* `build`, `out` and `coverage` are **not** on it, because spec-guard cannot
|
|
30
|
+
* tell a build output directory from a directory of build scripts, and a guess
|
|
31
|
+
* that goes the wrong way is exactly the silent false green this module exists
|
|
32
|
+
* to prevent. Narrowing scope is the assertion's job, through `exclude`.
|
|
33
|
+
*/
|
|
34
|
+
/** Why spec-guard, rather than the user, left a path out. */
|
|
35
|
+
export type SkipReason = 'vcs' | 'dependencies' | 'unreadable' | 'binary';
|
|
36
|
+
/**
|
|
37
|
+
* Reasons that represent a gap in the analysis rather than a deliberate
|
|
38
|
+
* omission. These are what `--strict` refuses to pass over.
|
|
39
|
+
*/
|
|
40
|
+
export declare const UNCERTAIN_REASONS: ReadonlySet<SkipReason>;
|
|
41
|
+
/**
|
|
42
|
+
* Directory names skipped unless `--no-default-skips` is given.
|
|
43
|
+
*
|
|
44
|
+
* Four names, each one a place where anything found would be misleading rather
|
|
45
|
+
* than merely noisy: a version-control store answers "did this ever exist",
|
|
46
|
+
* not "does this exist", and a dependency tree answers for somebody else's
|
|
47
|
+
* code.
|
|
48
|
+
*/
|
|
49
|
+
export declare const DEFAULT_SKIPPED_DIRECTORIES: ReadonlyMap<string, SkipReason>;
|
|
50
|
+
/**
|
|
51
|
+
* What a run is allowed to look at.
|
|
52
|
+
*
|
|
53
|
+
* One object, shared by both engines: the JavaScript walker consults it
|
|
54
|
+
* directly and the ripgrep arguments are derived from it, so the two cannot
|
|
55
|
+
* drift apart without a test noticing.
|
|
56
|
+
*/
|
|
57
|
+
export interface ScopePolicy {
|
|
58
|
+
/** Directory names to skip, and why. Empty under `--no-default-skips`. */
|
|
59
|
+
readonly skippedDirectories: ReadonlyMap<string, SkipReason>;
|
|
60
|
+
}
|
|
61
|
+
export declare const DEFAULT_SCOPE: ScopePolicy;
|
|
62
|
+
/** A policy that walks everything, for when only certainty will do. */
|
|
63
|
+
export declare const SCAN_EVERYTHING: ScopePolicy;
|
|
64
|
+
export declare function createScope(useDefaultSkips: boolean): ScopePolicy;
|
|
65
|
+
/** One path spec-guard declined to inspect, with the reason. */
|
|
66
|
+
export interface SkippedPath {
|
|
67
|
+
/** Path relative to the run root, POSIX separators. */
|
|
68
|
+
readonly path: string;
|
|
69
|
+
readonly reason: SkipReason;
|
|
70
|
+
/**
|
|
71
|
+
* Matches found inside a file that was not counted.
|
|
72
|
+
*
|
|
73
|
+
* Only meaningful for `binary`: the bytes were searched, so we know whether
|
|
74
|
+
* ignoring the file mattered. A binary file with no match is a non-event; a
|
|
75
|
+
* binary file *with* one is the difference between a real pass and a lie.
|
|
76
|
+
*/
|
|
77
|
+
readonly matches?: number;
|
|
78
|
+
}
|
|
79
|
+
/** How many paths were skipped, by reason, plus a sample for the report. */
|
|
80
|
+
export interface ScopeLedger {
|
|
81
|
+
readonly skipped: readonly SkippedPath[];
|
|
82
|
+
}
|
|
83
|
+
export declare const EMPTY_LEDGER: ScopeLedger;
|
|
84
|
+
/** Longest list of skipped paths a single result will carry. */
|
|
85
|
+
export declare const MAX_LEDGER_ENTRIES = 100;
|
|
86
|
+
/** Accumulates skips without letting a pathological tree exhaust memory. */
|
|
87
|
+
export declare class LedgerBuilder {
|
|
88
|
+
private readonly entries;
|
|
89
|
+
private readonly counts;
|
|
90
|
+
add(path: string, reason: SkipReason, matches?: number): void;
|
|
91
|
+
/** How many paths carried this reason, including any beyond the sample cap. */
|
|
92
|
+
count(reason: SkipReason): number;
|
|
93
|
+
build(): ScopeLedger;
|
|
94
|
+
}
|
|
95
|
+
/** Totals per reason, computed from a ledger. */
|
|
96
|
+
export declare function tallyLedger(ledger: ScopeLedger): Map<SkipReason, number>;
|
|
97
|
+
/** Merges ledgers from several searches into one. */
|
|
98
|
+
export declare function mergeLedgers(ledgers: readonly ScopeLedger[]): ScopeLedger;
|
|
99
|
+
/**
|
|
100
|
+
* True when the bytes are not text.
|
|
101
|
+
*
|
|
102
|
+
* A NUL anywhere means binary, which is the same question ripgrep answers when
|
|
103
|
+
* it reports a `binary_offset` and stops. Checking only a prefix - the usual
|
|
104
|
+
* shortcut - would disagree with ripgrep on any file whose first NUL comes
|
|
105
|
+
* late, and disagreeing engines are the defect this module exists to remove.
|
|
106
|
+
*/
|
|
107
|
+
export declare function isBinary(buffer: Buffer): boolean;
|
|
108
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,cAAc,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,UAAU,CAAiD,CAAC;AAExG;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAKtE,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,0EAA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B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD"}
|
package/dist/scope.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search scope: what an assertion actually looked at.
|
|
3
|
+
*
|
|
4
|
+
* An assertion's answer is worth exactly as much as the set of files behind it.
|
|
5
|
+
* "`LegacyThing` appears nowhere in `src`" is a useful claim; "`LegacyThing`
|
|
6
|
+
* appears nowhere in the part of `src` we happened to walk" is not, and the two
|
|
7
|
+
* are indistinguishable in a report that only prints a count.
|
|
8
|
+
*
|
|
9
|
+
* So every file under a target lands in exactly one of three states, and the
|
|
10
|
+
* third one is never silent:
|
|
11
|
+
*
|
|
12
|
+
* inspected - read and searched.
|
|
13
|
+
* excluded - the assertion's own `exclude`/`glob` said so. Not reported:
|
|
14
|
+
* the user asked for it and already knows.
|
|
15
|
+
* skipped - spec-guard decided. Always counted, always reported.
|
|
16
|
+
*
|
|
17
|
+
* Skips split further, because two very different things were being conflated:
|
|
18
|
+
*
|
|
19
|
+
* policy - `.git`, `node_modules`. Deliberate, uninteresting, and not a
|
|
20
|
+
* gap in the analysis. Reported as a total.
|
|
21
|
+
* uncertainty - a file that could not be read, or whose bytes are not text.
|
|
22
|
+
* These are gaps: the file might contain the symbol and nobody
|
|
23
|
+
* knows. Reported individually, and `--strict` fails on them.
|
|
24
|
+
*
|
|
25
|
+
* The policy list is deliberately tiny. Every name on it is a place where the
|
|
26
|
+
* tool can be sure it is not looking at your code: version-control object
|
|
27
|
+
* stores, which hold compressed copies of code you already deleted, and
|
|
28
|
+
* dependency trees, which hold code you did not write. Names like `dist`,
|
|
29
|
+
* `build`, `out` and `coverage` are **not** on it, because spec-guard cannot
|
|
30
|
+
* tell a build output directory from a directory of build scripts, and a guess
|
|
31
|
+
* that goes the wrong way is exactly the silent false green this module exists
|
|
32
|
+
* to prevent. Narrowing scope is the assertion's job, through `exclude`.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Reasons that represent a gap in the analysis rather than a deliberate
|
|
36
|
+
* omission. These are what `--strict` refuses to pass over.
|
|
37
|
+
*/
|
|
38
|
+
export const UNCERTAIN_REASONS = new Set(['unreadable', 'binary']);
|
|
39
|
+
/**
|
|
40
|
+
* Directory names skipped unless `--no-default-skips` is given.
|
|
41
|
+
*
|
|
42
|
+
* Four names, each one a place where anything found would be misleading rather
|
|
43
|
+
* than merely noisy: a version-control store answers "did this ever exist",
|
|
44
|
+
* not "does this exist", and a dependency tree answers for somebody else's
|
|
45
|
+
* code.
|
|
46
|
+
*/
|
|
47
|
+
export const DEFAULT_SKIPPED_DIRECTORIES = new Map([
|
|
48
|
+
['.git', 'vcs'],
|
|
49
|
+
['.hg', 'vcs'],
|
|
50
|
+
['.svn', 'vcs'],
|
|
51
|
+
['node_modules', 'dependencies'],
|
|
52
|
+
]);
|
|
53
|
+
export const DEFAULT_SCOPE = { skippedDirectories: DEFAULT_SKIPPED_DIRECTORIES };
|
|
54
|
+
/** A policy that walks everything, for when only certainty will do. */
|
|
55
|
+
export const SCAN_EVERYTHING = { skippedDirectories: new Map() };
|
|
56
|
+
export function createScope(useDefaultSkips) {
|
|
57
|
+
return useDefaultSkips ? DEFAULT_SCOPE : SCAN_EVERYTHING;
|
|
58
|
+
}
|
|
59
|
+
export const EMPTY_LEDGER = { skipped: [] };
|
|
60
|
+
/** Longest list of skipped paths a single result will carry. */
|
|
61
|
+
export const MAX_LEDGER_ENTRIES = 100;
|
|
62
|
+
/** Accumulates skips without letting a pathological tree exhaust memory. */
|
|
63
|
+
export class LedgerBuilder {
|
|
64
|
+
entries = [];
|
|
65
|
+
counts = new Map();
|
|
66
|
+
add(path, reason, matches) {
|
|
67
|
+
this.counts.set(reason, (this.counts.get(reason) ?? 0) + 1);
|
|
68
|
+
if (this.entries.length < MAX_LEDGER_ENTRIES) {
|
|
69
|
+
this.entries.push(matches === undefined ? { path, reason } : { path, reason, matches });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** How many paths carried this reason, including any beyond the sample cap. */
|
|
73
|
+
count(reason) {
|
|
74
|
+
return this.counts.get(reason) ?? 0;
|
|
75
|
+
}
|
|
76
|
+
build() {
|
|
77
|
+
return { skipped: this.entries };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Totals per reason, computed from a ledger. */
|
|
81
|
+
export function tallyLedger(ledger) {
|
|
82
|
+
const totals = new Map();
|
|
83
|
+
for (const entry of ledger.skipped) {
|
|
84
|
+
totals.set(entry.reason, (totals.get(entry.reason) ?? 0) + 1);
|
|
85
|
+
}
|
|
86
|
+
return totals;
|
|
87
|
+
}
|
|
88
|
+
/** Merges ledgers from several searches into one. */
|
|
89
|
+
export function mergeLedgers(ledgers) {
|
|
90
|
+
const seen = new Set();
|
|
91
|
+
const skipped = [];
|
|
92
|
+
for (const ledger of ledgers) {
|
|
93
|
+
for (const entry of ledger.skipped) {
|
|
94
|
+
const key = `${entry.reason}:${entry.path}`;
|
|
95
|
+
if (seen.has(key))
|
|
96
|
+
continue;
|
|
97
|
+
seen.add(key);
|
|
98
|
+
if (skipped.length < MAX_LEDGER_ENTRIES)
|
|
99
|
+
skipped.push(entry);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return { skipped };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* True when the bytes are not text.
|
|
106
|
+
*
|
|
107
|
+
* A NUL anywhere means binary, which is the same question ripgrep answers when
|
|
108
|
+
* it reports a `binary_offset` and stops. Checking only a prefix - the usual
|
|
109
|
+
* shortcut - would disagree with ripgrep on any file whose first NUL comes
|
|
110
|
+
* late, and disagreeing engines are the defect this module exists to remove.
|
|
111
|
+
*/
|
|
112
|
+
export function isBinary(buffer) {
|
|
113
|
+
return buffer.includes(0);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../src/scope.ts"],"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,CAAC;YACd,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB;gBAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ScopeLedger, ScopePolicy } from './scope.js';
|
|
1
2
|
/**
|
|
2
3
|
* Shared types for spec-guard.
|
|
3
4
|
*
|
|
@@ -64,6 +65,14 @@ export interface SearchOptions {
|
|
|
64
65
|
* be what proves the symbol is still there.
|
|
65
66
|
*/
|
|
66
67
|
ignoreComments: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* What the walk is allowed to look at.
|
|
70
|
+
*
|
|
71
|
+
* Lives on the options, not on the engine, because both engines read it: the
|
|
72
|
+
* scanner consults it while walking and the ripgrep arguments are derived
|
|
73
|
+
* from it. One policy, so the two cannot drift.
|
|
74
|
+
*/
|
|
75
|
+
scope: ScopePolicy;
|
|
67
76
|
/** Absolute file paths to exclude from results (the spec files themselves). */
|
|
68
77
|
excludeFiles: ReadonlySet<string>;
|
|
69
78
|
}
|
|
@@ -92,6 +101,8 @@ export interface SearchResult {
|
|
|
92
101
|
commentMatches: number;
|
|
93
102
|
/** Files whose language has no known comment syntax, so nothing was excluded. */
|
|
94
103
|
unclassifiedFiles: number;
|
|
104
|
+
/** What was not inspected, and why. Never empty for a reason nobody stated. */
|
|
105
|
+
scope: ScopeLedger;
|
|
95
106
|
/** Up to `maxSnippets` match locations, in file order. */
|
|
96
107
|
matches: MatchLocation[];
|
|
97
108
|
/** Engine that produced this result. */
|
|
@@ -143,6 +154,8 @@ export interface AssertionResult {
|
|
|
143
154
|
commentMatches: number;
|
|
144
155
|
/** Matching files whose language is unknown, so their comments counted as code. */
|
|
145
156
|
unclassifiedFiles: number;
|
|
157
|
+
/** What this assertion did not inspect, and why. */
|
|
158
|
+
scope: ScopeLedger;
|
|
146
159
|
engine?: EngineName;
|
|
147
160
|
durationMs: number;
|
|
148
161
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GACrB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,uBAAuB,GACvB,qBAAqB,CAAC;AAE1B,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,mEAAmE;IACnE,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oEAAoE;AACpE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,QAAQ,EAAE,cAAc,CAAC;IACzB,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,MA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AC;IAC1B,oDAAoD;IACpD,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,oEAAoE;IACpE,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|