@driftsys/markspec 0.12.1 → 0.13.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/esm/ast/build.d.ts.map +1 -1
- package/esm/ast/build.js +19 -5
- package/esm/ast/equivalence.js +14 -2
- package/esm/ast/nodes.d.ts +15 -3
- package/esm/ast/nodes.d.ts.map +1 -1
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +18 -3
- package/esm/compiler/mod.d.ts +34 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +112 -48
- package/esm/compiler/schema.d.ts +3 -2
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +6 -3
- package/esm/criteria/scenarios.d.ts +55 -0
- package/esm/criteria/scenarios.d.ts.map +1 -0
- package/esm/criteria/scenarios.js +133 -0
- package/esm/discovery/mod.d.ts +20 -1
- package/esm/discovery/mod.d.ts.map +1 -1
- package/esm/discovery/mod.js +105 -17
- package/esm/formatter/entry_body.d.ts +8 -5
- package/esm/formatter/entry_body.d.ts.map +1 -1
- package/esm/formatter/entry_body.js +12 -8
- package/esm/formatter/feature_file.d.ts +40 -0
- package/esm/formatter/feature_file.d.ts.map +1 -0
- package/esm/formatter/feature_file.js +88 -0
- package/esm/formatter/mod.d.ts +21 -2
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +64 -22
- package/esm/gates/mod.d.ts +2 -2
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +17 -2
- package/esm/gherkin/load.d.ts +35 -0
- package/esm/gherkin/load.d.ts.map +1 -0
- package/esm/gherkin/load.js +39 -0
- package/esm/gherkin/parse.d.ts +11 -0
- package/esm/gherkin/parse.d.ts.map +1 -0
- package/esm/gherkin/parse.js +311 -0
- package/esm/gherkin/position.d.ts +23 -0
- package/esm/gherkin/position.d.ts.map +1 -0
- package/esm/gherkin/position.js +21 -0
- package/esm/gherkin/procedure.d.ts +76 -0
- package/esm/gherkin/procedure.d.ts.map +1 -0
- package/esm/gherkin/procedure.js +164 -0
- package/esm/gherkin/project.d.ts +35 -0
- package/esm/gherkin/project.d.ts.map +1 -0
- package/esm/gherkin/project.js +64 -0
- package/esm/gherkin/role.d.ts +23 -0
- package/esm/gherkin/role.d.ts.map +1 -0
- package/esm/gherkin/role.js +28 -0
- package/esm/gherkin/types.d.ts +118 -0
- package/esm/gherkin/types.d.ts.map +1 -0
- package/esm/gherkin/types.js +12 -0
- package/esm/lock/acquire_compile.d.ts +12 -4
- package/esm/lock/acquire_compile.d.ts.map +1 -1
- package/esm/lock/acquire_compile.js +15 -5
- package/esm/lock/canonical_edges.d.ts +6 -2
- package/esm/lock/canonical_edges.d.ts.map +1 -1
- package/esm/lock/canonical_edges.js +10 -3
- package/esm/lock/model.d.ts +5 -0
- package/esm/lock/model.d.ts.map +1 -1
- package/esm/lock/parser.d.ts.map +1 -1
- package/esm/lock/parser.js +2 -0
- package/esm/lock/resolve.d.ts +6 -2
- package/esm/lock/resolve.d.ts.map +1 -1
- package/esm/lock/resolve.js +36 -4
- package/esm/lock/serializer.d.ts.map +1 -1
- package/esm/lock/serializer.js +7 -1
- package/esm/mod.d.ts +23 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +18 -5
- package/esm/model/mod.d.ts +42 -1
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +1 -1
- package/esm/model/relations.d.ts +9 -0
- package/esm/model/relations.d.ts.map +1 -1
- package/esm/model/relations.js +16 -1
- package/esm/parser/attributes.d.ts +82 -3
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +199 -32
- package/esm/parser/body_tokens.d.ts +1 -1
- package/esm/parser/body_tokens.d.ts.map +1 -1
- package/esm/parser/body_tokens.js +49 -35
- package/esm/parser/feature_file.d.ts +116 -0
- package/esm/parser/feature_file.d.ts.map +1 -0
- package/esm/parser/feature_file.js +540 -0
- package/esm/parser/markdown.d.ts +7 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +129 -40
- package/esm/parser/mod.d.ts +18 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +51 -0
- package/esm/parser/translate.d.ts.map +1 -1
- package/esm/parser/translate.js +5 -0
- package/esm/refs/mod.d.ts +2 -1
- package/esm/refs/mod.d.ts.map +1 -1
- package/esm/refs/mod.js +12 -4
- package/esm/refs/split.d.ts +58 -0
- package/esm/refs/split.d.ts.map +1 -0
- package/esm/refs/split.js +137 -0
- package/esm/reporter/mod.d.ts +7 -0
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +113 -3
- package/esm/validator/attributes.d.ts.map +1 -1
- package/esm/validator/attributes.js +4 -1
- package/esm/validator/block_role.d.ts +40 -0
- package/esm/validator/block_role.d.ts.map +1 -0
- package/esm/validator/block_role.js +109 -0
- package/esm/validator/feature_ac.d.ts.map +1 -1
- package/esm/validator/feature_ac.js +6 -1
- package/esm/validator/feature_parse.d.ts +35 -0
- package/esm/validator/feature_parse.d.ts.map +1 -0
- package/esm/validator/feature_parse.js +69 -0
- package/esm/validator/locators.d.ts +36 -0
- package/esm/validator/locators.d.ts.map +1 -0
- package/esm/validator/locators.js +184 -0
- package/esm/validator/mod.d.ts +10 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +38 -14
- package/esm/validator/normalize.d.ts.map +1 -1
- package/esm/validator/normalize.js +8 -3
- package/esm/validator/per_type_attrs.d.ts +3 -3
- package/esm/validator/per_type_attrs.js +3 -3
- package/esm/validator/pipeline.d.ts +4 -12
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +24 -5
- package/esm/validator/procedure.d.ts +22 -0
- package/esm/validator/procedure.d.ts.map +1 -0
- package/esm/validator/procedure.js +58 -0
- package/esm/validator/trace_types.d.ts.map +1 -1
- package/esm/validator/trace_types.js +4 -3
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +4 -1
- package/esm/validator/type_resolution.d.ts +5 -3
- package/esm/validator/type_resolution.d.ts.map +1 -1
- package/esm/validator/type_resolution.js +14 -2
- package/esm/validator/types.d.ts +11 -0
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +26 -4
- package/esm/validator/uxil_family.d.ts +1 -1
- package/package.json +3 -1
- package/script/ast/build.d.ts.map +1 -1
- package/script/ast/build.js +19 -5
- package/script/ast/equivalence.js +14 -2
- package/script/ast/nodes.d.ts +15 -3
- package/script/ast/nodes.d.ts.map +1 -1
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +18 -3
- package/script/compiler/mod.d.ts +34 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +110 -46
- package/script/compiler/schema.d.ts +3 -2
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +6 -3
- package/script/criteria/scenarios.d.ts +55 -0
- package/script/criteria/scenarios.d.ts.map +1 -0
- package/script/criteria/scenarios.js +139 -0
- package/script/discovery/mod.d.ts +20 -1
- package/script/discovery/mod.d.ts.map +1 -1
- package/script/discovery/mod.js +106 -17
- package/script/formatter/entry_body.d.ts +8 -5
- package/script/formatter/entry_body.d.ts.map +1 -1
- package/script/formatter/entry_body.js +12 -8
- package/script/formatter/feature_file.d.ts +40 -0
- package/script/formatter/feature_file.d.ts.map +1 -0
- package/script/formatter/feature_file.js +92 -0
- package/script/formatter/mod.d.ts +21 -2
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +63 -21
- package/script/gates/mod.d.ts +2 -2
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +17 -2
- package/script/gherkin/load.d.ts +35 -0
- package/script/gherkin/load.d.ts.map +1 -0
- package/script/gherkin/load.js +76 -0
- package/script/gherkin/parse.d.ts +11 -0
- package/script/gherkin/parse.d.ts.map +1 -0
- package/script/gherkin/parse.js +314 -0
- package/script/gherkin/position.d.ts +23 -0
- package/script/gherkin/position.d.ts.map +1 -0
- package/script/gherkin/position.js +24 -0
- package/script/gherkin/procedure.d.ts +76 -0
- package/script/gherkin/procedure.d.ts.map +1 -0
- package/script/gherkin/procedure.js +169 -0
- package/script/gherkin/project.d.ts +35 -0
- package/script/gherkin/project.d.ts.map +1 -0
- package/script/gherkin/project.js +67 -0
- package/script/gherkin/role.d.ts +23 -0
- package/script/gherkin/role.d.ts.map +1 -0
- package/script/gherkin/role.js +31 -0
- package/script/gherkin/types.d.ts +118 -0
- package/script/gherkin/types.d.ts.map +1 -0
- package/script/gherkin/types.js +13 -0
- package/script/lock/acquire_compile.d.ts +12 -4
- package/script/lock/acquire_compile.d.ts.map +1 -1
- package/script/lock/acquire_compile.js +15 -5
- package/script/lock/canonical_edges.d.ts +6 -2
- package/script/lock/canonical_edges.d.ts.map +1 -1
- package/script/lock/canonical_edges.js +10 -3
- package/script/lock/model.d.ts +5 -0
- package/script/lock/model.d.ts.map +1 -1
- package/script/lock/parser.d.ts.map +1 -1
- package/script/lock/parser.js +2 -0
- package/script/lock/resolve.d.ts +6 -2
- package/script/lock/resolve.d.ts.map +1 -1
- package/script/lock/resolve.js +36 -4
- package/script/lock/serializer.d.ts.map +1 -1
- package/script/lock/serializer.js +7 -1
- package/script/mod.d.ts +23 -6
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +45 -6
- package/script/model/mod.d.ts +42 -1
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +2 -1
- package/script/model/relations.d.ts +9 -0
- package/script/model/relations.d.ts.map +1 -1
- package/script/model/relations.js +17 -1
- package/script/parser/attributes.d.ts +82 -3
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +205 -33
- package/script/parser/body_tokens.d.ts +1 -1
- package/script/parser/body_tokens.d.ts.map +1 -1
- package/script/parser/body_tokens.js +49 -35
- package/script/parser/feature_file.d.ts +116 -0
- package/script/parser/feature_file.d.ts.map +1 -0
- package/script/parser/feature_file.js +548 -0
- package/script/parser/markdown.d.ts +7 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +128 -39
- package/script/parser/mod.d.ts +18 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +52 -1
- package/script/parser/translate.d.ts.map +1 -1
- package/script/parser/translate.js +5 -0
- package/script/refs/mod.d.ts +2 -1
- package/script/refs/mod.d.ts.map +1 -1
- package/script/refs/mod.js +12 -4
- package/script/refs/split.d.ts +58 -0
- package/script/refs/split.d.ts.map +1 -0
- package/script/refs/split.js +145 -0
- package/script/reporter/mod.d.ts +7 -0
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +113 -3
- package/script/validator/attributes.d.ts.map +1 -1
- package/script/validator/attributes.js +4 -1
- package/script/validator/block_role.d.ts +40 -0
- package/script/validator/block_role.d.ts.map +1 -0
- package/script/validator/block_role.js +112 -0
- package/script/validator/feature_ac.d.ts.map +1 -1
- package/script/validator/feature_ac.js +6 -1
- package/script/validator/feature_parse.d.ts +35 -0
- package/script/validator/feature_parse.d.ts.map +1 -0
- package/script/validator/feature_parse.js +73 -0
- package/script/validator/locators.d.ts +36 -0
- package/script/validator/locators.d.ts.map +1 -0
- package/script/validator/locators.js +188 -0
- package/script/validator/mod.d.ts +10 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +38 -14
- package/script/validator/normalize.d.ts.map +1 -1
- package/script/validator/normalize.js +8 -3
- package/script/validator/per_type_attrs.d.ts +3 -3
- package/script/validator/per_type_attrs.js +3 -3
- package/script/validator/pipeline.d.ts +4 -12
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +23 -5
- package/script/validator/procedure.d.ts +22 -0
- package/script/validator/procedure.d.ts.map +1 -0
- package/script/validator/procedure.js +61 -0
- package/script/validator/trace_types.d.ts.map +1 -1
- package/script/validator/trace_types.js +4 -3
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +4 -1
- package/script/validator/type_resolution.d.ts +5 -3
- package/script/validator/type_resolution.d.ts.map +1 -1
- package/script/validator/type_resolution.js +14 -2
- package/script/validator/types.d.ts +11 -0
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +27 -4
- package/script/validator/uxil_family.d.ts +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/locators
|
|
3
|
+
*
|
|
4
|
+
* Locator and scenario-name diagnostics (epic #915, scenario-locator
|
|
5
|
+
* slice):
|
|
6
|
+
*
|
|
7
|
+
* - `MSL-L007` (warning): a locator on a `"criterion"` relation
|
|
8
|
+
* (`Satisfies`, `Verifies`) names no addressable scenario of a resolved,
|
|
9
|
+
* criteria-bearing target. The edge to the target is kept.
|
|
10
|
+
* - `MSL-L008` (warning): a locator on a trace relation that does not
|
|
11
|
+
* accept one (every relation without a locator mode, including
|
|
12
|
+
* profile-declared relations and a hand-written `Verified-by`). The
|
|
13
|
+
* edge to the target is kept.
|
|
14
|
+
* - `MSL-L009` (warning): a trace value has a `[` after whitespace that
|
|
15
|
+
* no `]` closes. The value has no locator and is read as it was before
|
|
16
|
+
* scenario locators existed.
|
|
17
|
+
* - `MSL-B060` (warning): a scenario name occurs more than once in one
|
|
18
|
+
* entry; reported on the second and later occurrences.
|
|
19
|
+
* - `MSL-B061` (info): a scenario has an empty name.
|
|
20
|
+
*
|
|
21
|
+
* A locator on an unresolved target raises only `MSL-L006`, and a locator
|
|
22
|
+
* on a target that carries no criteria (not a Requirement or Contract, or a
|
|
23
|
+
* Reference entry) is free text: neither raises `MSL-L007`.
|
|
24
|
+
*/
|
|
25
|
+
import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
26
|
+
/**
|
|
27
|
+
* Report the locator and scenario-name diagnostics for `entries`.
|
|
28
|
+
* Targets resolve against every entry (upstream entries included);
|
|
29
|
+
* diagnostics are emitted for emittable entries only. When `profile` is
|
|
30
|
+
* given, an entry without a `type` is classified against it first.
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateLocators(entries: readonly Entry[], profile: EffectiveProfile | null): Diagnostic[];
|
|
33
|
+
/** `entry` with its type classified against `profile` when unset. Without a
|
|
34
|
+
* profile, a `.feature` header entry still gets its step-6a core type. */
|
|
35
|
+
export declare function withType(entry: Entry, profile: EffectiveProfile | null): Entry;
|
|
36
|
+
//# sourceMappingURL=locators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locators.d.ts","sourceRoot":"","sources":["../../src/validator/locators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,EAEN,MAAM,iBAAiB,CAAC;AA+BzB;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,UAAU,EAAE,CA6Dd;AA+BD;0EAC0E;AAC1E,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,KAAK,CAOP"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module core/validator/locators
|
|
4
|
+
*
|
|
5
|
+
* Locator and scenario-name diagnostics (epic #915, scenario-locator
|
|
6
|
+
* slice):
|
|
7
|
+
*
|
|
8
|
+
* - `MSL-L007` (warning): a locator on a `"criterion"` relation
|
|
9
|
+
* (`Satisfies`, `Verifies`) names no addressable scenario of a resolved,
|
|
10
|
+
* criteria-bearing target. The edge to the target is kept.
|
|
11
|
+
* - `MSL-L008` (warning): a locator on a trace relation that does not
|
|
12
|
+
* accept one (every relation without a locator mode, including
|
|
13
|
+
* profile-declared relations and a hand-written `Verified-by`). The
|
|
14
|
+
* edge to the target is kept.
|
|
15
|
+
* - `MSL-L009` (warning): a trace value has a `[` after whitespace that
|
|
16
|
+
* no `]` closes. The value has no locator and is read as it was before
|
|
17
|
+
* scenario locators existed.
|
|
18
|
+
* - `MSL-B060` (warning): a scenario name occurs more than once in one
|
|
19
|
+
* entry; reported on the second and later occurrences.
|
|
20
|
+
* - `MSL-B061` (info): a scenario has an empty name.
|
|
21
|
+
*
|
|
22
|
+
* A locator on an unresolved target raises only `MSL-L006`, and a locator
|
|
23
|
+
* on a target that carries no criteria (not a Requirement or Contract, or a
|
|
24
|
+
* Reference entry) is free text: neither raises `MSL-L007`.
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.validateLocators = validateLocators;
|
|
28
|
+
exports.withType = withType;
|
|
29
|
+
const mod_js_1 = require("../model/mod.js");
|
|
30
|
+
const scenarios_js_1 = require("../criteria/scenarios.js");
|
|
31
|
+
const split_js_1 = require("../refs/split.js");
|
|
32
|
+
const types_js_1 = require("./types.js");
|
|
33
|
+
/** Value types whose values reference other entries. */
|
|
34
|
+
const REFERENCE_VALUE_TYPES = new Set([
|
|
35
|
+
"id",
|
|
36
|
+
"id-list",
|
|
37
|
+
"citation",
|
|
38
|
+
]);
|
|
39
|
+
/** Core relations that accept a locator, for the MSL-L008 message. */
|
|
40
|
+
const LOCATOR_RELATIONS = (() => {
|
|
41
|
+
const names = mod_js_1.CORE_RELATIONS.filter((r) => r.locator !== undefined).map((r) => r.attr);
|
|
42
|
+
return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
43
|
+
})();
|
|
44
|
+
/**
|
|
45
|
+
* Report the locator and scenario-name diagnostics for `entries`.
|
|
46
|
+
* Targets resolve against every entry (upstream entries included);
|
|
47
|
+
* diagnostics are emitted for emittable entries only. When `profile` is
|
|
48
|
+
* given, an entry without a `type` is classified against it first.
|
|
49
|
+
*/
|
|
50
|
+
function validateLocators(entries, profile) {
|
|
51
|
+
const typed = entries.map((e) => withType(e, profile));
|
|
52
|
+
const byKey = new Map();
|
|
53
|
+
for (const e of typed) {
|
|
54
|
+
if (!byKey.has(e.displayId))
|
|
55
|
+
byKey.set(e.displayId, e);
|
|
56
|
+
if (e.id && !byKey.has(e.id))
|
|
57
|
+
byKey.set(e.id, e);
|
|
58
|
+
}
|
|
59
|
+
const relations = relationKeys(profile);
|
|
60
|
+
const diagnostics = [];
|
|
61
|
+
for (const entry of (0, mod_js_1.emittableEntries)(typed)) {
|
|
62
|
+
if ((0, scenarios_js_1.isCriteriaBearing)(entry, profile)) {
|
|
63
|
+
diagnostics.push(...scenarioNameDiagnostics(entry));
|
|
64
|
+
}
|
|
65
|
+
entry.rawAttributes.forEach((attr, index) => {
|
|
66
|
+
if (!relations.has(attr.key))
|
|
67
|
+
return;
|
|
68
|
+
const location = attributeLocation(entry, index);
|
|
69
|
+
for (const part of (0, split_js_1.splitTraceValues)(attr.value)) {
|
|
70
|
+
if ((0, split_js_1.isUnterminatedLocator)(part)) {
|
|
71
|
+
diagnostics.push({
|
|
72
|
+
code: "MSL-L009",
|
|
73
|
+
severity: "warning",
|
|
74
|
+
message: `${entry.displayId}: '${attr.key}' value '${part}' has ` +
|
|
75
|
+
"a '[' with no closing ']'. Add the closing ']'",
|
|
76
|
+
location,
|
|
77
|
+
});
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const parsed = (0, split_js_1.parseTraceValue)(part);
|
|
81
|
+
if (parsed.locator === undefined)
|
|
82
|
+
continue;
|
|
83
|
+
const mode = (0, mod_js_1.relationLocatorMode)(attr.key);
|
|
84
|
+
if (mode === undefined) {
|
|
85
|
+
diagnostics.push({
|
|
86
|
+
code: "MSL-L008",
|
|
87
|
+
severity: "warning",
|
|
88
|
+
message: `${entry.displayId}: '${attr.key}' does not accept a ` +
|
|
89
|
+
`locator ('${parsed.locator}'); only ${LOCATOR_RELATIONS} do. ` +
|
|
90
|
+
`The link to ${parsed.target} is kept`,
|
|
91
|
+
location,
|
|
92
|
+
});
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (mode !== "criterion")
|
|
96
|
+
continue;
|
|
97
|
+
const target = byKey.get(parsed.target);
|
|
98
|
+
// An upstream target carries no criteria (as in the compiler).
|
|
99
|
+
if (!target || (0, mod_js_1.isUpstreamEntry)(target))
|
|
100
|
+
continue;
|
|
101
|
+
if (!(0, scenarios_js_1.isCriteriaBearing)(target, profile))
|
|
102
|
+
continue;
|
|
103
|
+
const resolved = (0, scenarios_js_1.buildCriteria)(target).some((c) => c.addressable && c.name === parsed.locator);
|
|
104
|
+
if (resolved)
|
|
105
|
+
continue;
|
|
106
|
+
diagnostics.push({
|
|
107
|
+
code: "MSL-L007",
|
|
108
|
+
severity: "warning",
|
|
109
|
+
message: `${entry.displayId}: locator '${parsed.locator}' matches ` +
|
|
110
|
+
`no scenario of ${target.displayId}`,
|
|
111
|
+
location,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return diagnostics;
|
|
117
|
+
}
|
|
118
|
+
/** MSL-B060 and MSL-B061 for the scenarios of one entry. */
|
|
119
|
+
function scenarioNameDiagnostics(entry) {
|
|
120
|
+
const diagnostics = [];
|
|
121
|
+
const seen = new Set();
|
|
122
|
+
for (const criterion of (0, scenarios_js_1.buildCriteria)(entry)) {
|
|
123
|
+
if (criterion.name === "") {
|
|
124
|
+
diagnostics.push({
|
|
125
|
+
code: "MSL-B061",
|
|
126
|
+
severity: "info",
|
|
127
|
+
message: `${entry.displayId}: scenario has no name; ` +
|
|
128
|
+
"a locator cannot address it",
|
|
129
|
+
location: criterion.location,
|
|
130
|
+
});
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (seen.has(criterion.name)) {
|
|
134
|
+
diagnostics.push({
|
|
135
|
+
code: "MSL-B060",
|
|
136
|
+
severity: "warning",
|
|
137
|
+
message: `${entry.displayId}: scenario name '${criterion.name}' ` +
|
|
138
|
+
"is used more than once; a locator cannot address it",
|
|
139
|
+
location: criterion.location,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
seen.add(criterion.name);
|
|
143
|
+
}
|
|
144
|
+
return diagnostics;
|
|
145
|
+
}
|
|
146
|
+
/** `entry` with its type classified against `profile` when unset. Without a
|
|
147
|
+
* profile, a `.feature` header entry still gets its step-6a core type. */
|
|
148
|
+
function withType(entry, profile) {
|
|
149
|
+
if (entry.type !== undefined)
|
|
150
|
+
return entry;
|
|
151
|
+
// Without a profile only step 6a (a `.feature` header entry) can type it.
|
|
152
|
+
const type = profile === null
|
|
153
|
+
? (0, types_js_1.featureFileCoreType)(entry)
|
|
154
|
+
: (0, types_js_1.classifyEntry)(entry, profile).type;
|
|
155
|
+
return type === undefined ? entry : { ...entry, type };
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Trailer keys that are trace relations: the core relations, core
|
|
159
|
+
* attributes whose values reference entries (such as `Verified-by`), and
|
|
160
|
+
* the profile's reference-valued attributes and traceability links.
|
|
161
|
+
*/
|
|
162
|
+
function relationKeys(profile) {
|
|
163
|
+
const keys = new Set(mod_js_1.CORE_RELATIONS.map((r) => r.attr));
|
|
164
|
+
const isRelation = (key, type) => type !== undefined && REFERENCE_VALUE_TYPES.has(type) && keys.add(key);
|
|
165
|
+
for (const spec of mod_js_1.ATTRIBUTE_CATALOG)
|
|
166
|
+
isRelation(spec.key, spec.type);
|
|
167
|
+
if (profile === null)
|
|
168
|
+
return keys;
|
|
169
|
+
for (const [, a] of profile.attributes) {
|
|
170
|
+
isRelation(a.value.name, a.value.type);
|
|
171
|
+
}
|
|
172
|
+
for (const [, t] of profile.types) {
|
|
173
|
+
for (const [, a] of t.value.attributes) {
|
|
174
|
+
isRelation(a.value.name, a.value.type);
|
|
175
|
+
}
|
|
176
|
+
for (const name of t.value.traceability.keys())
|
|
177
|
+
keys.add(name);
|
|
178
|
+
}
|
|
179
|
+
return keys;
|
|
180
|
+
}
|
|
181
|
+
/** The location of the trailer line of `entry.rawAttributes[index]`. */
|
|
182
|
+
function attributeLocation(entry, index) {
|
|
183
|
+
const lines = entry.attributeLines;
|
|
184
|
+
if (!lines || lines.length !== entry.rawAttributes.length) {
|
|
185
|
+
return entry.location;
|
|
186
|
+
}
|
|
187
|
+
return { file: entry.location.file, line: lines[index], column: 1 };
|
|
188
|
+
}
|
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
* a profile-aware validator layer (not in the core).
|
|
15
15
|
*/
|
|
16
16
|
import type { Attribute, Diagnostic, Entry } from "../model/mod.js";
|
|
17
|
+
/**
|
|
18
|
+
* The values of a repeatable attribute (id-list, tag-list, citation or
|
|
19
|
+
* external-id) after trimming and splitting, by the value type's rule: a
|
|
20
|
+
* citation is not split, an id-list uses `splitTraceValues`, the other types
|
|
21
|
+
* split on commas. Empty values are dropped. `undefined` when `key` is not a
|
|
22
|
+
* repeatable attribute. MSL-A012 fires when the list is empty; the LSP quick
|
|
23
|
+
* fix for it uses the same function.
|
|
24
|
+
*/
|
|
25
|
+
export declare function repeatableAttributeValues(key: string, raw: string): string[] | undefined;
|
|
17
26
|
/** Result of a validation pass. */
|
|
18
27
|
export interface ValidateResult {
|
|
19
28
|
/** Diagnostics found during validation. */
|
|
@@ -30,7 +39,7 @@ export interface ValidateResult {
|
|
|
30
39
|
export declare function validate(entries: readonly Entry[]): ValidateResult;
|
|
31
40
|
export declare function indexByDisplayId(entries: readonly Entry[]): ReadonlyMap<string, Entry>;
|
|
32
41
|
export declare function findAttr(attrs: readonly Attribute[], key: string): Attribute | undefined;
|
|
33
|
-
export { runPipeline
|
|
42
|
+
export { runPipeline } from "./pipeline.js";
|
|
34
43
|
export type { PipelineOptions, PipelineResult } from "./pipeline.js";
|
|
35
44
|
export { validateListingDocuments } from "./listing.js";
|
|
36
45
|
export type { ListingFileContext, ListingKind } from "./listing.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAsCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAuBlE;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAsCpE;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,GAAG,SAAS,CAMtB;AAUD,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAuBlE;AAkbD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
package/script/validator/mod.js
CHANGED
|
@@ -15,15 +15,20 @@
|
|
|
15
15
|
* a profile-aware validator layer (not in the core).
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.detectCorpusCollisions = exports.attributeCorpusDiagnostics = exports.applyCorpusPostPass = exports.validateTraceabilityForEntry = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.normalizeListValues = exports.validateValue = exports.validateAttributesForEntry = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.validateListingDocuments = exports.
|
|
18
|
+
exports.detectCorpusCollisions = exports.attributeCorpusDiagnostics = exports.applyCorpusPostPass = exports.validateTraceabilityForEntry = exports.matchesAnyTarget = exports.effectiveTraceRules = exports.normalizeListValues = exports.validateValue = exports.validateAttributesForEntry = exports.effectiveScope = exports.compileDisplayIdPattern = exports.classifyEntry = exports.classifyEntriesStage = exports.validateListingDocuments = exports.runPipeline = void 0;
|
|
19
|
+
exports.repeatableAttributeValues = repeatableAttributeValues;
|
|
19
20
|
exports.validate = validate;
|
|
20
21
|
exports.indexByDisplayId = indexByDisplayId;
|
|
21
22
|
exports.findAttr = findAttr;
|
|
22
23
|
const mod_js_1 = require("../model/mod.js");
|
|
23
24
|
const value_types_js_1 = require("./value_types.js");
|
|
25
|
+
const split_js_1 = require("../refs/split.js");
|
|
24
26
|
const mod_js_2 = require("../typl/mod.js");
|
|
25
27
|
/** Universal attribute keys the core recognizes. */
|
|
26
28
|
const UNIVERSAL_KEYS = new Set(mod_js_1.UNIVERSAL_ATTRIBUTE_KEYS);
|
|
29
|
+
/** Trailer keys of the core relations. Core recognizes them without a
|
|
30
|
+
* profile, so MSL-R010 never applies to them. */
|
|
31
|
+
const CORE_RELATION_KEYS = new Set(mod_js_1.CORE_RELATIONS.map((r) => r.attr));
|
|
27
32
|
/**
|
|
28
33
|
* Value-type set that's repeatable per spec §1.8 — these attributes
|
|
29
34
|
* accept multiple lines for distinct values, so multiple trailers with
|
|
@@ -36,6 +41,24 @@ const REPEATABLE_VALUE_TYPES = new Set([
|
|
|
36
41
|
"citation",
|
|
37
42
|
"external-id",
|
|
38
43
|
]);
|
|
44
|
+
/**
|
|
45
|
+
* The values of a repeatable attribute (id-list, tag-list, citation or
|
|
46
|
+
* external-id) after trimming and splitting, by the value type's rule: a
|
|
47
|
+
* citation is not split, an id-list uses `splitTraceValues`, the other types
|
|
48
|
+
* split on commas. Empty values are dropped. `undefined` when `key` is not a
|
|
49
|
+
* repeatable attribute. MSL-A012 fires when the list is empty; the LSP quick
|
|
50
|
+
* fix for it uses the same function.
|
|
51
|
+
*/
|
|
52
|
+
function repeatableAttributeValues(key, raw) {
|
|
53
|
+
const spec = (0, mod_js_1.attributeSpec)(key);
|
|
54
|
+
if (!spec || !REPEATABLE_VALUE_TYPES.has(spec.type))
|
|
55
|
+
return undefined;
|
|
56
|
+
if (spec.type === "citation")
|
|
57
|
+
return [raw.trim()].filter((v) => v.length > 0);
|
|
58
|
+
if (spec.type === "id-list")
|
|
59
|
+
return (0, split_js_1.splitTraceValues)(raw);
|
|
60
|
+
return raw.split(",").map((v) => v.trim()).filter((v) => v.length > 0);
|
|
61
|
+
}
|
|
39
62
|
/**
|
|
40
63
|
* Slug pattern for Reference-shape display IDs (spec §1.7, ADR-002 §Part 3).
|
|
41
64
|
* Pandoc/BibTeX cite-key convention, restricted to a portable character
|
|
@@ -247,8 +270,13 @@ function checkStructural(emittable, diagnostics) {
|
|
|
247
270
|
continue;
|
|
248
271
|
let depth = 0;
|
|
249
272
|
let sawTopLevelComma = false;
|
|
250
|
-
|
|
251
|
-
|
|
273
|
+
const value = attr.value;
|
|
274
|
+
for (let i = 0; i < value.length; i++) {
|
|
275
|
+
const ch = value[i];
|
|
276
|
+
// Inside a locator, `\]` and `\\` are escapes (#915).
|
|
277
|
+
if (ch === "\\" && depth > 0)
|
|
278
|
+
i++;
|
|
279
|
+
else if (ch === "[")
|
|
252
280
|
depth++;
|
|
253
281
|
else if (ch === "]" && depth > 0)
|
|
254
282
|
depth--;
|
|
@@ -279,11 +307,7 @@ function checkStructural(emittable, diagnostics) {
|
|
|
279
307
|
continue;
|
|
280
308
|
if (!REPEATABLE_VALUE_TYPES.has(spec.type))
|
|
281
309
|
continue;
|
|
282
|
-
const
|
|
283
|
-
const isCitation = spec.type === "citation";
|
|
284
|
-
const values = isCitation
|
|
285
|
-
? [raw.trim()].filter((s) => s.length > 0)
|
|
286
|
-
: raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
310
|
+
const values = repeatableAttributeValues(attr.key, attr.value) ?? [];
|
|
287
311
|
if (values.length === 0) {
|
|
288
312
|
diagnostics.push({
|
|
289
313
|
code: "MSL-A012",
|
|
@@ -371,17 +395,18 @@ function checkStructural(emittable, diagnostics) {
|
|
|
371
395
|
}
|
|
372
396
|
// MSL-R010: Unknown attributes are warnings in the core. A
|
|
373
397
|
// profile-aware validator widens this check to include profile-declared
|
|
374
|
-
// attributes; until then, anything outside the universal set
|
|
375
|
-
// unrecognized. Core-typed attributes (per
|
|
376
|
-
// suppressed here — the per-type validator emits
|
|
377
|
-
// MSL-T022 when they appear on the "wrong" type.
|
|
398
|
+
// attributes; until then, anything outside the universal set and the
|
|
399
|
+
// core relation keys is unrecognized. Core-typed attributes (per
|
|
400
|
+
// ADR-003 §Part 2) are suppressed here — the per-type validator emits
|
|
401
|
+
// a more specific MSL-T022 when they appear on the "wrong" type.
|
|
378
402
|
if (!UNIVERSAL_KEYS.has(attr.key) &&
|
|
403
|
+
!CORE_RELATION_KEYS.has(attr.key) &&
|
|
379
404
|
attr.key !== "Type" &&
|
|
380
405
|
!mod_js_1.CORE_TYPE_SCOPED_ATTRS.has(attr.key)) {
|
|
381
406
|
diagnostics.push({
|
|
382
407
|
code: "MSL-R010",
|
|
383
408
|
severity: "warning",
|
|
384
|
-
message: `${entry.displayId}: unknown attribute '${attr.key}' (not in core universal set; profile-declared attributes are permitted when a profile is loaded)`,
|
|
409
|
+
message: `${entry.displayId}: unknown attribute '${attr.key}' (not in core universal set or core relation keys; profile-declared attributes are permitted when a profile is loaded)`,
|
|
385
410
|
location: entry.location,
|
|
386
411
|
});
|
|
387
412
|
}
|
|
@@ -487,7 +512,6 @@ function findAttr(attrs, key) {
|
|
|
487
512
|
}
|
|
488
513
|
var pipeline_js_1 = require("./pipeline.js");
|
|
489
514
|
Object.defineProperty(exports, "runPipeline", { enumerable: true, get: function () { return pipeline_js_1.runPipeline; } });
|
|
490
|
-
Object.defineProperty(exports, "suppressDeclaredAttrR010", { enumerable: true, get: function () { return pipeline_js_1.suppressDeclaredAttrR010; } });
|
|
491
515
|
var listing_js_1 = require("./listing.js");
|
|
492
516
|
Object.defineProperty(exports, "validateListingDocuments", { enumerable: true, get: function () { return listing_js_1.validateListingDocuments; } });
|
|
493
517
|
var types_js_1 = require("./types.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/validator/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAa,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/validator/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAa,MAAM,iBAAiB,CAAC;AAM1E;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,KAAK,CAoBP"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.normalizeListValues = normalizeListValues;
|
|
18
18
|
const attributes_js_1 = require("./attributes.js");
|
|
19
|
+
const split_js_1 = require("../refs/split.js");
|
|
19
20
|
const LIST_TYPES = new Set(["id-list", "tag-list"]);
|
|
20
21
|
/**
|
|
21
22
|
* Return a new Entry with list-typed attribute values split on commas. If no
|
|
@@ -28,7 +29,7 @@ function normalizeListValues(entry, profile) {
|
|
|
28
29
|
for (const [name, values] of entry.typedAttributes) {
|
|
29
30
|
const decl = scope.attributes.get(name);
|
|
30
31
|
if (decl !== undefined && LIST_TYPES.has(decl.type)) {
|
|
31
|
-
const split = splitListValues(values);
|
|
32
|
+
const split = splitListValues(values, decl.type === "id-list");
|
|
32
33
|
if (!arraysEqual(split, values)) {
|
|
33
34
|
rewritten.set(name, split);
|
|
34
35
|
anyChange = true;
|
|
@@ -41,10 +42,14 @@ function normalizeListValues(entry, profile) {
|
|
|
41
42
|
return entry;
|
|
42
43
|
return { ...entry, typedAttributes: rewritten };
|
|
43
44
|
}
|
|
44
|
-
function splitListValues(values) {
|
|
45
|
+
function splitListValues(values, isTraceList) {
|
|
45
46
|
const out = [];
|
|
46
47
|
for (const v of values) {
|
|
47
|
-
|
|
48
|
+
// In a trace list, commas inside a bracket locator (`A [x, y]`) do not
|
|
49
|
+
// split. Other lists (tag-list) split on every comma.
|
|
50
|
+
const parts = isTraceList
|
|
51
|
+
? (0, split_js_1.splitTraceValues)(v)
|
|
52
|
+
: v.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
48
53
|
if (parts.length === 0)
|
|
49
54
|
continue;
|
|
50
55
|
out.push(...parts);
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* `Type:`, profile classification, or URI-scheme inference for
|
|
7
7
|
* Reference-shape entries — any attribute that's known to the core
|
|
8
8
|
* hierarchy but not allowed on that type fires MSL-T022 as a warning.
|
|
9
|
-
* Unknown attributes (neither universal
|
|
10
|
-
* to the existing MSL-R010 unknown-attribute
|
|
11
|
-
* `validator/mod.ts`.
|
|
9
|
+
* Unknown attributes (neither universal, core relation keys, nor
|
|
10
|
+
* core-typed) fall through to the existing MSL-R010 unknown-attribute
|
|
11
|
+
* warning in `validator/mod.ts`.
|
|
12
12
|
*/
|
|
13
13
|
import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
14
14
|
/**
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* `Type:`, profile classification, or URI-scheme inference for
|
|
8
8
|
* Reference-shape entries — any attribute that's known to the core
|
|
9
9
|
* hierarchy but not allowed on that type fires MSL-T022 as a warning.
|
|
10
|
-
* Unknown attributes (neither universal
|
|
11
|
-
* to the existing MSL-R010 unknown-attribute
|
|
12
|
-
* `validator/mod.ts`.
|
|
10
|
+
* Unknown attributes (neither universal, core relation keys, nor
|
|
11
|
+
* core-typed) fall through to the existing MSL-R010 unknown-attribute
|
|
12
|
+
* warning in `validator/mod.ts`.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.validatePerTypeAttributes = validatePerTypeAttributes;
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* Stage 2 (type classification — {@linkcode classifyEntriesStage}),
|
|
6
6
|
* Stage 2.5 (list-value normalization — {@linkcode normalizeListValues}),
|
|
7
7
|
* Stage 3 (typed attribute validation — {@linkcode validateAttributesForEntry}),
|
|
8
|
-
*
|
|
8
|
+
* Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}),
|
|
9
|
+
* then the Gherkin checks: Stage 4.4 (MSL-B062), Stage 4.5 (scenario
|
|
10
|
+
* locators), Stage 4.6 (procedure steps, MSL-B063) and Stage 4.7 (block
|
|
11
|
+
* roles, MSL-B064 to MSL-B068).
|
|
9
12
|
*/
|
|
10
13
|
import type { CaptionConventions, Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
11
14
|
/** Result of running the full validator pipeline. */
|
|
@@ -58,15 +61,4 @@ export interface PipelineOptions {
|
|
|
58
61
|
* validating a file-local subset to suppress cross-entry diagnostics.
|
|
59
62
|
*/
|
|
60
63
|
export declare function runPipeline(entries: readonly Entry[], profile: EffectiveProfile | null, captionConventions?: CaptionConventions, opts?: PipelineOptions): PipelineResult;
|
|
61
|
-
/**
|
|
62
|
-
* Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes
|
|
63
|
-
* the loaded profile declares — Stage 3 validates those directly, so the
|
|
64
|
-
* core-only check would be noise. Returns `diagnostics` unchanged when no
|
|
65
|
-
* profile is loaded.
|
|
66
|
-
*
|
|
67
|
-
* Exported so callers that run only Stage 1 (e.g. the compiler's diagnostic
|
|
68
|
-
* pass) suppress the same false positives the full {@linkcode runPipeline}
|
|
69
|
-
* does, keeping LSP/MCP diagnostics consistent with the `validate` command.
|
|
70
|
-
*/
|
|
71
|
-
export declare function suppressDeclaredAttrR010(diagnostics: readonly Diagnostic[], entries: readonly Entry[], profile: EffectiveProfile | null): readonly Diagnostic[];
|
|
72
64
|
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AA6CzB,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,EAChC,kBAAkB,GAAE,kBAAuB,EAC3C,IAAI,GAAE,eAAoB,GACzB,cAAc,CA4KhB"}
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
* Stage 2 (type classification — {@linkcode classifyEntriesStage}),
|
|
7
7
|
* Stage 2.5 (list-value normalization — {@linkcode normalizeListValues}),
|
|
8
8
|
* Stage 3 (typed attribute validation — {@linkcode validateAttributesForEntry}),
|
|
9
|
-
*
|
|
9
|
+
* Stage 4 (traceability rules — {@linkcode validateTraceabilityForEntry}),
|
|
10
|
+
* then the Gherkin checks: Stage 4.4 (MSL-B062), Stage 4.5 (scenario
|
|
11
|
+
* locators), Stage 4.6 (procedure steps, MSL-B063) and Stage 4.7 (block
|
|
12
|
+
* roles, MSL-B064 to MSL-B068).
|
|
10
13
|
*/
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.runPipeline = runPipeline;
|
|
13
|
-
exports.suppressDeclaredAttrR010 = suppressDeclaredAttrR010;
|
|
14
16
|
const mod_js_1 = require("../model/mod.js");
|
|
15
17
|
const mod_js_2 = require("./mod.js");
|
|
16
18
|
const types_js_1 = require("./types.js");
|
|
@@ -27,6 +29,10 @@ const caption_convention_js_1 = require("./caption_convention.js");
|
|
|
27
29
|
const discipline_js_1 = require("./discipline.js");
|
|
28
30
|
const discipline_registry_js_1 = require("../profile/discipline_registry.js");
|
|
29
31
|
const uxil_family_js_1 = require("./uxil_family.js");
|
|
32
|
+
const locators_js_1 = require("./locators.js");
|
|
33
|
+
const block_role_js_1 = require("./block_role.js");
|
|
34
|
+
const procedure_js_1 = require("./procedure.js");
|
|
35
|
+
const feature_parse_js_1 = require("./feature_parse.js");
|
|
30
36
|
/** Cross-entry DSL codes suppressed under file-local scope: a
|
|
31
37
|
* subset registry cannot distinguish a dangling reference from an
|
|
32
38
|
* unchecked file — the same false-positive class the MSL-L006 filter
|
|
@@ -172,6 +178,20 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
|
|
|
172
178
|
: stage4.filter((d) => d.code !== "MSL-L006" && d.code !== "MSL-T014"));
|
|
173
179
|
}
|
|
174
180
|
}
|
|
181
|
+
// Stage 4.4 — Gherkin blocks that do not parse (MSL-B062, epic #915).
|
|
182
|
+
diagnostics.push(...(0, feature_parse_js_1.checkFeatureParse)(entries));
|
|
183
|
+
// Stage 4.5 — scenario locators and scenario names (epic #915). Runs
|
|
184
|
+
// on the classified entries so criteria-bearing types resolve; targets
|
|
185
|
+
// resolve against the full list, diagnostics come from the emittable
|
|
186
|
+
// entries only. An unresolved target raises MSL-L006 (Stage 4), never
|
|
187
|
+
// MSL-L007, so no file-local filter is needed here.
|
|
188
|
+
diagnostics.push(...(0, locators_js_1.validateLocators)(finalEntries, profile));
|
|
189
|
+
// Stage 4.6 — Gherkin procedure steps with no expected result (MSL-B063).
|
|
190
|
+
// Only Test entries are checked; unclassified entries are classified first.
|
|
191
|
+
diagnostics.push(...(0, procedure_js_1.checkProcedureSteps)(finalEntries, profile));
|
|
192
|
+
// Stage 4.7 — Gherkin block roles (MSL-B064 warning, MSL-B065..B068 info).
|
|
193
|
+
// Unclassified entries are classified first, as in Stage 4.6.
|
|
194
|
+
diagnostics.push(...(0, block_role_js_1.checkBlockRoles)(finalEntries, profile));
|
|
175
195
|
// Stage 5 — uxil diagnostics family (S9 #727). Inert unless some profile
|
|
176
196
|
// tier designates a declaring type (`declares: ux-surface`). Receives the
|
|
177
197
|
// FULL classified list on purpose: the family derives its own #771
|
|
@@ -190,9 +210,7 @@ function runPipeline(entries, profile, captionConventions = {}, opts = {}) {
|
|
|
190
210
|
* core-only check would be noise. Returns `diagnostics` unchanged when no
|
|
191
211
|
* profile is loaded.
|
|
192
212
|
*
|
|
193
|
-
*
|
|
194
|
-
* pass) suppress the same false positives the full {@linkcode runPipeline}
|
|
195
|
-
* does, keeping LSP/MCP diagnostics consistent with the `validate` command.
|
|
213
|
+
* Used by {@linkcode runPipeline} Stage 1 only.
|
|
196
214
|
*/
|
|
197
215
|
function suppressDeclaredAttrR010(diagnostics, entries, profile) {
|
|
198
216
|
if (profile === null)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/procedure
|
|
3
|
+
*
|
|
4
|
+
* `MSL-B063` (warning): a step of a Gherkin procedure has actions and no
|
|
5
|
+
* expected result (epic #915). Only entries whose type is, or extends, core
|
|
6
|
+
* `Test` are checked, because the procedure view belongs to Test entries.
|
|
7
|
+
* In a Requirement the block is a criterion, which is another check.
|
|
8
|
+
*
|
|
9
|
+
* Each `feature` or `gherkin` block is checked in a top-level block or in a
|
|
10
|
+
* list item at any depth, as for `MSL-B062`. A block that has a
|
|
11
|
+
* `parseError` or no `feature` is skipped: `MSL-B062` reports the first, and
|
|
12
|
+
* the second means the Gherkin parser was not loaded. Upstream entries are
|
|
13
|
+
* not checked (`emittableEntries`).
|
|
14
|
+
*
|
|
15
|
+
* The warning is reported at the file line of the last action of the step,
|
|
16
|
+
* in column 1. An entry without `entry.type` is classified with the profile
|
|
17
|
+
* first, so callers may pass classified or unclassified entries.
|
|
18
|
+
*/
|
|
19
|
+
import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
20
|
+
/** Report one MSL-B063 warning per procedure step with no expected result. */
|
|
21
|
+
export declare function checkProcedureSteps(entries: readonly Entry[], profile: EffectiveProfile | null): Diagnostic[];
|
|
22
|
+
//# sourceMappingURL=procedure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procedure.d.ts","sourceRoot":"","sources":["../../src/validator/procedure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAQ3E,8EAA8E;AAC9E,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,UAAU,EAAE,CA6Bd"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module core/validator/procedure
|
|
4
|
+
*
|
|
5
|
+
* `MSL-B063` (warning): a step of a Gherkin procedure has actions and no
|
|
6
|
+
* expected result (epic #915). Only entries whose type is, or extends, core
|
|
7
|
+
* `Test` are checked, because the procedure view belongs to Test entries.
|
|
8
|
+
* In a Requirement the block is a criterion, which is another check.
|
|
9
|
+
*
|
|
10
|
+
* Each `feature` or `gherkin` block is checked in a top-level block or in a
|
|
11
|
+
* list item at any depth, as for `MSL-B062`. A block that has a
|
|
12
|
+
* `parseError` or no `feature` is skipped: `MSL-B062` reports the first, and
|
|
13
|
+
* the second means the Gherkin parser was not loaded. Upstream entries are
|
|
14
|
+
* not checked (`emittableEntries`).
|
|
15
|
+
*
|
|
16
|
+
* The warning is reported at the file line of the last action of the step,
|
|
17
|
+
* in column 1. An entry without `entry.type` is classified with the profile
|
|
18
|
+
* first, so callers may pass classified or unclassified entries.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.checkProcedureSteps = checkProcedureSteps;
|
|
22
|
+
const mod_js_1 = require("../model/mod.js");
|
|
23
|
+
const scenarios_js_1 = require("../criteria/scenarios.js");
|
|
24
|
+
const procedure_js_1 = require("../gherkin/procedure.js");
|
|
25
|
+
const position_js_1 = require("../gherkin/position.js");
|
|
26
|
+
const feature_parse_js_1 = require("./feature_parse.js");
|
|
27
|
+
const locators_js_1 = require("./locators.js");
|
|
28
|
+
/** Report one MSL-B063 warning per procedure step with no expected result. */
|
|
29
|
+
function checkProcedureSteps(entries, profile) {
|
|
30
|
+
const diagnostics = [];
|
|
31
|
+
for (const candidate of (0, mod_js_1.emittableEntries)(entries)) {
|
|
32
|
+
// Classify an unclassified entry, as `validateLocators` does.
|
|
33
|
+
const entry = (0, locators_js_1.withType)(candidate, profile);
|
|
34
|
+
if (!(0, scenarios_js_1.isTestEntry)(entry, profile))
|
|
35
|
+
continue;
|
|
36
|
+
for (const node of (0, feature_parse_js_1.featureNodes)(entry.bodyAst ?? [])) {
|
|
37
|
+
if (node.parseError !== undefined || node.feature === undefined)
|
|
38
|
+
continue;
|
|
39
|
+
for (const scenario of node.feature.scenarios) {
|
|
40
|
+
for (const step of (0, procedure_js_1.scenarioProcedure)(scenario).steps) {
|
|
41
|
+
const last = step.actions.at(-1);
|
|
42
|
+
if (last === undefined || step.expected.length > 0)
|
|
43
|
+
continue;
|
|
44
|
+
diagnostics.push({
|
|
45
|
+
code: "MSL-B063",
|
|
46
|
+
severity: "warning",
|
|
47
|
+
message: `${entry.displayId}: step ${step.n} of scenario ` +
|
|
48
|
+
`"${scenario.name}" has no expected result (no Then step); ` +
|
|
49
|
+
"add a Then step after the last action",
|
|
50
|
+
location: {
|
|
51
|
+
file: entry.location.file,
|
|
52
|
+
line: (0, position_js_1.featureFileLine)(entry, node, last.step.range.start.line),
|
|
53
|
+
column: 1,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return diagnostics;
|
|
61
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAyFzD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,KAAK,EAAE,EAC3B,GAAG,EAAE,SAAS,KAAK,EAAE,GACpB,SAAS,UAAU,EAAE,CA8HvB"}
|