@driftsys/markspec 0.4.0 → 0.6.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 +74 -20
- package/esm/ast/build.d.ts +60 -0
- package/esm/ast/build.d.ts.map +1 -0
- package/esm/ast/build.js +516 -0
- package/esm/ast/equivalence.d.ts +18 -0
- package/esm/ast/equivalence.d.ts.map +1 -0
- package/esm/ast/equivalence.js +56 -0
- package/esm/ast/nodes.d.ts +189 -0
- package/esm/ast/nodes.d.ts.map +1 -0
- package/esm/ast/nodes.js +17 -0
- package/esm/ast/normalize.d.ts +58 -0
- package/esm/ast/normalize.d.ts.map +1 -0
- package/esm/ast/normalize.js +197 -0
- package/esm/ast/render.d.ts +34 -0
- package/esm/ast/render.d.ts.map +1 -0
- package/esm/ast/render.js +215 -0
- package/esm/compiler/constants.d.ts +16 -0
- package/esm/compiler/constants.d.ts.map +1 -0
- package/esm/compiler/constants.js +26 -0
- package/esm/compiler/discipline_classifier.d.ts +55 -0
- package/esm/compiler/discipline_classifier.d.ts.map +1 -0
- package/esm/compiler/discipline_classifier.js +191 -0
- package/esm/compiler/inverses.d.ts +2 -1
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +33 -14
- package/esm/compiler/manifest.d.ts +59 -0
- package/esm/compiler/manifest.d.ts.map +1 -0
- package/esm/compiler/manifest.js +48 -0
- package/esm/compiler/mod.d.ts +38 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +202 -50
- package/esm/compiler/ndjson_writer.d.ts +50 -0
- package/esm/compiler/ndjson_writer.d.ts.map +1 -0
- package/esm/compiler/ndjson_writer.js +73 -0
- package/esm/compiler/schema.d.ts +33 -1
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +30 -9
- package/esm/config/markspec.d.ts +5 -0
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +17 -2
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +54 -0
- package/esm/formatter/mod.d.ts +55 -4
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +423 -46
- package/esm/formatter/synth_ulid.d.ts +21 -0
- package/esm/formatter/synth_ulid.d.ts.map +1 -0
- package/esm/formatter/synth_ulid.js +64 -0
- package/esm/lexicons/loader.d.ts +35 -0
- package/esm/lexicons/loader.d.ts.map +1 -0
- package/esm/lexicons/loader.js +51 -0
- package/esm/lexicons/mod.d.ts +13 -0
- package/esm/lexicons/mod.d.ts.map +1 -0
- package/esm/lexicons/mod.js +12 -0
- package/esm/lint/glossary.d.ts +45 -0
- package/esm/lint/glossary.d.ts.map +1 -0
- package/esm/lint/glossary.js +85 -0
- package/esm/lint/mod.d.ts +14 -0
- package/esm/lint/mod.d.ts.map +1 -0
- package/esm/lint/mod.js +9 -0
- package/esm/lint/range_util.d.ts +25 -0
- package/esm/lint/range_util.d.ts.map +1 -0
- package/esm/lint/range_util.js +50 -0
- package/esm/lint/rules/ears.d.ts +39 -0
- package/esm/lint/rules/ears.d.ts.map +1 -0
- package/esm/lint/rules/ears.js +316 -0
- package/esm/lint/rules/incose_sentence.d.ts +46 -0
- package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
- package/esm/lint/rules/incose_sentence.js +417 -0
- package/esm/lint/rules/lexicon.d.ts +24 -0
- package/esm/lint/rules/lexicon.d.ts.map +1 -0
- package/esm/lint/rules/lexicon.js +236 -0
- package/esm/lint/rules/modal_sentence.d.ts +46 -0
- package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
- package/esm/lint/rules/modal_sentence.js +146 -0
- package/esm/lint/rules/passive.d.ts +64 -0
- package/esm/lint/rules/passive.d.ts.map +1 -0
- package/esm/lint/rules/passive.js +282 -0
- package/esm/lint/rules/struct.d.ts +17 -0
- package/esm/lint/rules/struct.d.ts.map +1 -0
- package/esm/lint/rules/struct.js +55 -0
- package/esm/lint/rules/suppression.d.ts +54 -0
- package/esm/lint/rules/suppression.d.ts.map +1 -0
- package/esm/lint/rules/suppression.js +129 -0
- package/esm/lint/rules/xref.d.ts +19 -0
- package/esm/lint/rules/xref.d.ts.map +1 -0
- package/esm/lint/rules/xref.js +248 -0
- package/esm/lint/runner.d.ts +59 -0
- package/esm/lint/runner.d.ts.map +1 -0
- package/esm/lint/runner.js +153 -0
- package/esm/lint/score.d.ts +64 -0
- package/esm/lint/score.d.ts.map +1 -0
- package/esm/lint/score.js +163 -0
- package/esm/lint/segmenter.d.ts +32 -0
- package/esm/lint/segmenter.d.ts.map +1 -0
- package/esm/lint/segmenter.js +79 -0
- package/esm/lint/types.d.ts +31 -0
- package/esm/lint/types.d.ts.map +1 -0
- package/esm/lint/types.js +9 -0
- package/esm/lock/canonical_edges.d.ts +31 -0
- package/esm/lock/canonical_edges.d.ts.map +1 -0
- package/esm/lock/canonical_edges.js +57 -0
- package/esm/lock/check.d.ts +24 -0
- package/esm/lock/check.d.ts.map +1 -0
- package/esm/lock/check.js +127 -0
- package/esm/lock/hash.d.ts +12 -0
- package/esm/lock/hash.d.ts.map +1 -0
- package/esm/lock/hash.js +32 -0
- package/esm/lock/mod.d.ts +19 -0
- package/esm/lock/mod.d.ts.map +1 -0
- package/esm/lock/mod.js +14 -0
- package/esm/lock/model.d.ts +81 -0
- package/esm/lock/model.d.ts.map +1 -0
- package/esm/lock/model.js +7 -0
- package/esm/lock/parser.d.ts +26 -0
- package/esm/lock/parser.d.ts.map +1 -0
- package/esm/lock/parser.js +195 -0
- package/esm/lock/resolve.d.ts +142 -0
- package/esm/lock/resolve.d.ts.map +1 -0
- package/esm/lock/resolve.js +389 -0
- package/esm/lock/serializer.d.ts +14 -0
- package/esm/lock/serializer.d.ts.map +1 -0
- package/esm/lock/serializer.js +104 -0
- package/esm/mod.d.ts +28 -8
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +23 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +200 -2
- package/esm/model/discipline.d.ts +53 -0
- package/esm/model/discipline.d.ts.map +1 -0
- package/esm/model/discipline.js +50 -0
- package/esm/model/discriminating_attr.d.ts +33 -0
- package/esm/model/discriminating_attr.d.ts.map +1 -0
- package/esm/model/discriminating_attr.js +74 -0
- package/esm/model/mod.d.ts +267 -14
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +99 -3
- package/esm/model/profile.d.ts +102 -27
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/model/source_introspection.d.ts +26 -0
- package/esm/model/source_introspection.d.ts.map +1 -0
- package/esm/model/source_introspection.js +77 -0
- package/esm/model/type_hierarchy.d.ts +51 -0
- package/esm/model/type_hierarchy.d.ts.map +1 -0
- package/esm/model/type_hierarchy.js +126 -0
- package/esm/model/uri_scheme_map.d.ts +21 -0
- package/esm/model/uri_scheme_map.d.ts.map +1 -0
- package/esm/model/uri_scheme_map.js +66 -0
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +10 -16
- package/esm/parser/body_tokens.d.ts +35 -0
- package/esm/parser/body_tokens.d.ts.map +1 -0
- package/esm/parser/body_tokens.js +232 -0
- package/esm/parser/glossary.d.ts +51 -0
- package/esm/parser/glossary.d.ts.map +1 -0
- package/esm/parser/glossary.js +219 -0
- package/esm/parser/grammars.d.ts +5 -3
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +12 -4
- package/esm/parser/language_spec.d.ts +55 -0
- package/esm/parser/language_spec.d.ts.map +1 -0
- package/esm/parser/language_spec.js +419 -0
- package/esm/parser/line_map.d.ts +60 -0
- package/esm/parser/line_map.d.ts.map +1 -0
- package/esm/parser/line_map.js +41 -0
- package/esm/parser/markdown.d.ts +9 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +317 -25
- package/esm/parser/mod.d.ts +5 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +31 -8
- package/esm/parser/source.d.ts +53 -2
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +158 -68
- package/esm/parser/translate.d.ts +24 -0
- package/esm/parser/translate.d.ts.map +1 -0
- package/esm/parser/translate.js +99 -0
- package/esm/profile/chain.d.ts +8 -0
- package/esm/profile/chain.d.ts.map +1 -1
- package/esm/profile/chain.js +32 -14
- package/esm/profile/colors.js +1 -1
- package/esm/profile/default_profile.d.ts +25 -0
- package/esm/profile/default_profile.d.ts.map +1 -0
- package/esm/profile/default_profile.js +43 -0
- package/esm/profile/discipline_mode.d.ts +64 -0
- package/esm/profile/discipline_mode.d.ts.map +1 -0
- package/esm/profile/discipline_mode.js +133 -0
- package/esm/profile/discipline_registry.d.ts +41 -0
- package/esm/profile/discipline_registry.d.ts.map +1 -0
- package/esm/profile/discipline_registry.js +67 -0
- package/esm/profile/introspect.d.ts +135 -0
- package/esm/profile/introspect.d.ts.map +1 -0
- package/esm/profile/introspect.js +378 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +91 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +512 -90
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +251 -39
- package/esm/profile/mod.d.ts +4 -4
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +7 -2
- package/esm/reporter/mod.js +4 -4
- package/esm/sync/locked_attributes.d.ts +19 -0
- package/esm/sync/locked_attributes.d.ts.map +1 -0
- package/esm/sync/locked_attributes.js +27 -0
- package/esm/sync/log.d.ts +34 -0
- package/esm/sync/log.d.ts.map +1 -0
- package/esm/sync/log.js +48 -0
- package/esm/sync/mapping.d.ts +66 -0
- package/esm/sync/mapping.d.ts.map +1 -0
- package/esm/sync/mapping.js +165 -0
- package/esm/sync/mod.d.ts +16 -0
- package/esm/sync/mod.d.ts.map +1 -0
- package/esm/sync/mod.js +12 -0
- package/esm/sync/status.d.ts +23 -0
- package/esm/sync/status.d.ts.map +1 -0
- package/esm/sync/status.js +21 -0
- package/esm/typl/ast.d.ts +87 -0
- package/esm/typl/ast.d.ts.map +1 -0
- package/esm/typl/ast.js +21 -0
- package/esm/typl/bridge.d.ts +32 -0
- package/esm/typl/bridge.d.ts.map +1 -0
- package/esm/typl/bridge.js +27 -0
- package/esm/typl/bullet.d.ts +34 -0
- package/esm/typl/bullet.d.ts.map +1 -0
- package/esm/typl/bullet.js +44 -0
- package/esm/typl/diagnostics.d.ts +43 -0
- package/esm/typl/diagnostics.d.ts.map +1 -0
- package/esm/typl/diagnostics.js +61 -0
- package/esm/typl/fence.d.ts +31 -0
- package/esm/typl/fence.d.ts.map +1 -0
- package/esm/typl/fence.js +24 -0
- package/esm/typl/grammar.d.ts +20 -0
- package/esm/typl/grammar.d.ts.map +1 -0
- package/esm/typl/grammar.js +471 -0
- package/esm/typl/inline.d.ts +34 -0
- package/esm/typl/inline.d.ts.map +1 -0
- package/esm/typl/inline.js +48 -0
- package/esm/typl/lexer.d.ts +37 -0
- package/esm/typl/lexer.d.ts.map +1 -0
- package/esm/typl/lexer.js +234 -0
- package/esm/typl/mod.d.ts +23 -0
- package/esm/typl/mod.d.ts.map +1 -0
- package/esm/typl/mod.js +16 -0
- package/esm/typl/registry.d.ts +42 -0
- package/esm/typl/registry.d.ts.map +1 -0
- package/esm/typl/registry.js +26 -0
- package/esm/typl/validator.d.ts +29 -0
- package/esm/typl/validator.d.ts.map +1 -0
- package/esm/typl/validator.js +141 -0
- package/esm/util/fence.d.ts +30 -0
- package/esm/util/fence.d.ts.map +1 -0
- package/esm/util/fence.js +40 -0
- package/esm/util/line_endings.d.ts +33 -0
- package/esm/util/line_endings.d.ts.map +1 -0
- package/esm/util/line_endings.js +53 -0
- package/esm/util/modals.d.ts +29 -0
- package/esm/util/modals.d.ts.map +1 -0
- package/esm/util/modals.js +38 -0
- package/esm/validator/attributes.d.ts +3 -3
- package/esm/validator/attributes.d.ts.map +1 -1
- package/esm/validator/attributes.js +1 -18
- package/esm/validator/body_blocks.d.ts +38 -0
- package/esm/validator/body_blocks.d.ts.map +1 -0
- package/esm/validator/body_blocks.js +218 -0
- package/esm/validator/caption_convention.d.ts +29 -0
- package/esm/validator/caption_convention.d.ts.map +1 -0
- package/esm/validator/caption_convention.js +58 -0
- package/esm/validator/captions.d.ts +22 -0
- package/esm/validator/captions.d.ts.map +1 -0
- package/esm/validator/captions.js +137 -0
- package/esm/validator/component_schemes.d.ts +73 -0
- package/esm/validator/component_schemes.d.ts.map +1 -0
- package/esm/validator/component_schemes.js +375 -0
- package/esm/validator/discipline.d.ts +35 -0
- package/esm/validator/discipline.d.ts.map +1 -0
- package/esm/validator/discipline.js +204 -0
- package/esm/validator/feature_ac.d.ts +28 -0
- package/esm/validator/feature_ac.d.ts.map +1 -0
- package/esm/validator/feature_ac.js +102 -0
- package/esm/validator/listing.d.ts +42 -0
- package/esm/validator/listing.d.ts.map +1 -0
- package/esm/validator/listing.js +295 -0
- package/esm/validator/mod.d.ts +3 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +275 -13
- package/esm/validator/modal_keywords.d.ts +25 -0
- package/esm/validator/modal_keywords.d.ts.map +1 -0
- package/esm/validator/modal_keywords.js +54 -0
- package/esm/validator/pattern.d.ts +15 -8
- package/esm/validator/pattern.d.ts.map +1 -1
- package/esm/validator/pattern.js +42 -19
- package/esm/validator/per_type_attrs.d.ts +29 -0
- package/esm/validator/per_type_attrs.d.ts.map +1 -0
- package/esm/validator/per_type_attrs.js +75 -0
- package/esm/validator/pipeline.d.ts +18 -2
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +76 -21
- package/esm/validator/trace_types.d.ts +26 -0
- package/esm/validator/trace_types.d.ts.map +1 -0
- package/esm/validator/trace_types.js +232 -0
- package/esm/validator/traceability.d.ts +3 -4
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +5 -10
- package/esm/validator/type_resolution.d.ts +67 -0
- package/esm/validator/type_resolution.d.ts.map +1 -0
- package/esm/validator/type_resolution.js +162 -0
- package/esm/validator/types.d.ts +45 -0
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +128 -16
- package/esm/validator/value_types.d.ts +8 -0
- package/esm/validator/value_types.d.ts.map +1 -1
- package/esm/validator/value_types.js +8 -1
- package/package.json +2 -2
- package/script/ast/build.d.ts +60 -0
- package/script/ast/build.d.ts.map +1 -0
- package/script/ast/build.js +521 -0
- package/script/ast/equivalence.d.ts +18 -0
- package/script/ast/equivalence.d.ts.map +1 -0
- package/script/ast/equivalence.js +59 -0
- package/script/ast/nodes.d.ts +189 -0
- package/script/ast/nodes.d.ts.map +1 -0
- package/script/ast/nodes.js +18 -0
- package/script/ast/normalize.d.ts +58 -0
- package/script/ast/normalize.d.ts.map +1 -0
- package/script/ast/normalize.js +200 -0
- package/script/ast/render.d.ts +34 -0
- package/script/ast/render.d.ts.map +1 -0
- package/script/ast/render.js +218 -0
- package/script/compiler/constants.d.ts +16 -0
- package/script/compiler/constants.d.ts.map +1 -0
- package/script/compiler/constants.js +29 -0
- package/script/compiler/discipline_classifier.d.ts +55 -0
- package/script/compiler/discipline_classifier.d.ts.map +1 -0
- package/script/compiler/discipline_classifier.js +196 -0
- package/script/compiler/inverses.d.ts +2 -1
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +33 -14
- package/script/compiler/manifest.d.ts +59 -0
- package/script/compiler/manifest.d.ts.map +1 -0
- package/script/compiler/manifest.js +51 -0
- package/script/compiler/mod.d.ts +38 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +206 -54
- package/script/compiler/ndjson_writer.d.ts +50 -0
- package/script/compiler/ndjson_writer.d.ts.map +1 -0
- package/script/compiler/ndjson_writer.js +78 -0
- package/script/compiler/schema.d.ts +33 -1
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +30 -8
- package/script/config/markspec.d.ts +5 -0
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +17 -2
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +54 -0
- package/script/formatter/mod.d.ts +55 -4
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +426 -46
- package/script/formatter/synth_ulid.d.ts +21 -0
- package/script/formatter/synth_ulid.d.ts.map +1 -0
- package/script/formatter/synth_ulid.js +67 -0
- package/script/lexicons/loader.d.ts +35 -0
- package/script/lexicons/loader.d.ts.map +1 -0
- package/script/lexicons/loader.js +55 -0
- package/script/lexicons/mod.d.ts +13 -0
- package/script/lexicons/mod.d.ts.map +1 -0
- package/script/lexicons/mod.js +17 -0
- package/script/lint/glossary.d.ts +45 -0
- package/script/lint/glossary.d.ts.map +1 -0
- package/script/lint/glossary.js +88 -0
- package/script/lint/mod.d.ts +14 -0
- package/script/lint/mod.d.ts.map +1 -0
- package/script/lint/mod.js +17 -0
- package/script/lint/range_util.d.ts +25 -0
- package/script/lint/range_util.d.ts.map +1 -0
- package/script/lint/range_util.js +53 -0
- package/script/lint/rules/ears.d.ts +39 -0
- package/script/lint/rules/ears.d.ts.map +1 -0
- package/script/lint/rules/ears.js +320 -0
- package/script/lint/rules/incose_sentence.d.ts +46 -0
- package/script/lint/rules/incose_sentence.d.ts.map +1 -0
- package/script/lint/rules/incose_sentence.js +421 -0
- package/script/lint/rules/lexicon.d.ts +24 -0
- package/script/lint/rules/lexicon.d.ts.map +1 -0
- package/script/lint/rules/lexicon.js +240 -0
- package/script/lint/rules/modal_sentence.d.ts +46 -0
- package/script/lint/rules/modal_sentence.d.ts.map +1 -0
- package/script/lint/rules/modal_sentence.js +150 -0
- package/script/lint/rules/passive.d.ts +64 -0
- package/script/lint/rules/passive.d.ts.map +1 -0
- package/script/lint/rules/passive.js +286 -0
- package/script/lint/rules/struct.d.ts +17 -0
- package/script/lint/rules/struct.d.ts.map +1 -0
- package/script/lint/rules/struct.js +59 -0
- package/script/lint/rules/suppression.d.ts +54 -0
- package/script/lint/rules/suppression.d.ts.map +1 -0
- package/script/lint/rules/suppression.js +136 -0
- package/script/lint/rules/xref.d.ts +19 -0
- package/script/lint/rules/xref.d.ts.map +1 -0
- package/script/lint/rules/xref.js +251 -0
- package/script/lint/runner.d.ts +59 -0
- package/script/lint/runner.d.ts.map +1 -0
- package/script/lint/runner.js +157 -0
- package/script/lint/score.d.ts +64 -0
- package/script/lint/score.d.ts.map +1 -0
- package/script/lint/score.js +167 -0
- package/script/lint/segmenter.d.ts +32 -0
- package/script/lint/segmenter.d.ts.map +1 -0
- package/script/lint/segmenter.js +82 -0
- package/script/lint/types.d.ts +31 -0
- package/script/lint/types.d.ts.map +1 -0
- package/script/lint/types.js +10 -0
- package/script/lock/canonical_edges.d.ts +31 -0
- package/script/lock/canonical_edges.d.ts.map +1 -0
- package/script/lock/canonical_edges.js +61 -0
- package/script/lock/check.d.ts +24 -0
- package/script/lock/check.d.ts.map +1 -0
- package/script/lock/check.js +130 -0
- package/script/lock/hash.d.ts +12 -0
- package/script/lock/hash.d.ts.map +1 -0
- package/script/lock/hash.js +36 -0
- package/script/lock/mod.d.ts +19 -0
- package/script/lock/mod.d.ts.map +1 -0
- package/script/lock/mod.js +31 -0
- package/script/lock/model.d.ts +81 -0
- package/script/lock/model.d.ts.map +1 -0
- package/script/lock/model.js +10 -0
- package/script/lock/parser.d.ts +26 -0
- package/script/lock/parser.d.ts.map +1 -0
- package/script/lock/parser.js +198 -0
- package/script/lock/resolve.d.ts +142 -0
- package/script/lock/resolve.d.ts.map +1 -0
- package/script/lock/resolve.js +397 -0
- package/script/lock/serializer.d.ts +14 -0
- package/script/lock/serializer.d.ts.map +1 -0
- package/script/lock/serializer.js +107 -0
- package/script/mod.d.ts +28 -8
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +129 -32
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +201 -3
- package/script/model/discipline.d.ts +53 -0
- package/script/model/discipline.d.ts.map +1 -0
- package/script/model/discipline.js +53 -0
- package/script/model/discriminating_attr.d.ts +33 -0
- package/script/model/discriminating_attr.d.ts.map +1 -0
- package/script/model/discriminating_attr.js +77 -0
- package/script/model/mod.d.ts +267 -14
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +111 -3
- package/script/model/profile.d.ts +102 -27
- package/script/model/profile.d.ts.map +1 -1
- package/script/model/source_introspection.d.ts +26 -0
- package/script/model/source_introspection.d.ts.map +1 -0
- package/script/model/source_introspection.js +80 -0
- package/script/model/type_hierarchy.d.ts +51 -0
- package/script/model/type_hierarchy.d.ts.map +1 -0
- package/script/model/type_hierarchy.js +130 -0
- package/script/model/uri_scheme_map.d.ts +21 -0
- package/script/model/uri_scheme_map.d.ts.map +1 -0
- package/script/model/uri_scheme_map.js +69 -0
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +10 -16
- package/script/parser/body_tokens.d.ts +35 -0
- package/script/parser/body_tokens.d.ts.map +1 -0
- package/script/parser/body_tokens.js +235 -0
- package/script/parser/glossary.d.ts +51 -0
- package/script/parser/glossary.d.ts.map +1 -0
- package/script/parser/glossary.js +224 -0
- package/script/parser/grammars.d.ts +5 -3
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +15 -8
- package/script/parser/language_spec.d.ts +55 -0
- package/script/parser/language_spec.d.ts.map +1 -0
- package/script/parser/language_spec.js +423 -0
- package/script/parser/line_map.d.ts +60 -0
- package/script/parser/line_map.d.ts.map +1 -0
- package/script/parser/line_map.js +44 -0
- package/script/parser/markdown.d.ts +9 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +315 -23
- package/script/parser/mod.d.ts +5 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +36 -7
- package/script/parser/source.d.ts +53 -2
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +159 -69
- package/script/parser/translate.d.ts +24 -0
- package/script/parser/translate.d.ts.map +1 -0
- package/script/parser/translate.js +102 -0
- package/script/profile/chain.d.ts +8 -0
- package/script/profile/chain.d.ts.map +1 -1
- package/script/profile/chain.js +32 -14
- package/script/profile/colors.js +1 -1
- package/script/profile/default_profile.d.ts +25 -0
- package/script/profile/default_profile.d.ts.map +1 -0
- package/script/profile/default_profile.js +46 -0
- package/script/profile/discipline_mode.d.ts +64 -0
- package/script/profile/discipline_mode.d.ts.map +1 -0
- package/script/profile/discipline_mode.js +138 -0
- package/script/profile/discipline_registry.d.ts +41 -0
- package/script/profile/discipline_registry.d.ts.map +1 -0
- package/script/profile/discipline_registry.js +70 -0
- package/script/profile/introspect.d.ts +135 -0
- package/script/profile/introspect.d.ts.map +1 -0
- package/script/profile/introspect.js +381 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +91 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +511 -89
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +251 -39
- package/script/profile/mod.d.ts +4 -4
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +12 -6
- package/script/reporter/mod.js +4 -4
- package/script/sync/locked_attributes.d.ts +19 -0
- package/script/sync/locked_attributes.d.ts.map +1 -0
- package/script/sync/locked_attributes.js +30 -0
- package/script/sync/log.d.ts +34 -0
- package/script/sync/log.d.ts.map +1 -0
- package/script/sync/log.js +52 -0
- package/script/sync/mapping.d.ts +66 -0
- package/script/sync/mapping.d.ts.map +1 -0
- package/script/sync/mapping.js +169 -0
- package/script/sync/mod.d.ts +16 -0
- package/script/sync/mod.d.ts.map +1 -0
- package/script/sync/mod.js +21 -0
- package/script/sync/status.d.ts +23 -0
- package/script/sync/status.d.ts.map +1 -0
- package/script/sync/status.js +24 -0
- package/script/typl/ast.d.ts +87 -0
- package/script/typl/ast.d.ts.map +1 -0
- package/script/typl/ast.js +24 -0
- package/script/typl/bridge.d.ts +32 -0
- package/script/typl/bridge.d.ts.map +1 -0
- package/script/typl/bridge.js +30 -0
- package/script/typl/bullet.d.ts +34 -0
- package/script/typl/bullet.d.ts.map +1 -0
- package/script/typl/bullet.js +47 -0
- package/script/typl/diagnostics.d.ts +43 -0
- package/script/typl/diagnostics.d.ts.map +1 -0
- package/script/typl/diagnostics.js +65 -0
- package/script/typl/fence.d.ts +31 -0
- package/script/typl/fence.d.ts.map +1 -0
- package/script/typl/fence.js +27 -0
- package/script/typl/grammar.d.ts +20 -0
- package/script/typl/grammar.d.ts.map +1 -0
- package/script/typl/grammar.js +474 -0
- package/script/typl/inline.d.ts +34 -0
- package/script/typl/inline.d.ts.map +1 -0
- package/script/typl/inline.js +51 -0
- package/script/typl/lexer.d.ts +37 -0
- package/script/typl/lexer.d.ts.map +1 -0
- package/script/typl/lexer.js +237 -0
- package/script/typl/mod.d.ts +23 -0
- package/script/typl/mod.d.ts.map +1 -0
- package/script/typl/mod.js +29 -0
- package/script/typl/registry.d.ts +42 -0
- package/script/typl/registry.d.ts.map +1 -0
- package/script/typl/registry.js +29 -0
- package/script/typl/validator.d.ts +29 -0
- package/script/typl/validator.d.ts.map +1 -0
- package/script/typl/validator.js +144 -0
- package/script/util/fence.d.ts +30 -0
- package/script/util/fence.d.ts.map +1 -0
- package/script/util/fence.js +44 -0
- package/script/util/line_endings.d.ts +33 -0
- package/script/util/line_endings.d.ts.map +1 -0
- package/script/util/line_endings.js +58 -0
- package/script/util/modals.d.ts +29 -0
- package/script/util/modals.d.ts.map +1 -0
- package/script/util/modals.js +42 -0
- package/script/validator/attributes.d.ts +3 -3
- package/script/validator/attributes.d.ts.map +1 -1
- package/script/validator/attributes.js +1 -18
- package/script/validator/body_blocks.d.ts +38 -0
- package/script/validator/body_blocks.d.ts.map +1 -0
- package/script/validator/body_blocks.js +221 -0
- package/script/validator/caption_convention.d.ts +29 -0
- package/script/validator/caption_convention.d.ts.map +1 -0
- package/script/validator/caption_convention.js +61 -0
- package/script/validator/captions.d.ts +22 -0
- package/script/validator/captions.d.ts.map +1 -0
- package/script/validator/captions.js +140 -0
- package/script/validator/component_schemes.d.ts +73 -0
- package/script/validator/component_schemes.d.ts.map +1 -0
- package/script/validator/component_schemes.js +384 -0
- package/script/validator/discipline.d.ts +35 -0
- package/script/validator/discipline.d.ts.map +1 -0
- package/script/validator/discipline.js +207 -0
- package/script/validator/feature_ac.d.ts +28 -0
- package/script/validator/feature_ac.d.ts.map +1 -0
- package/script/validator/feature_ac.js +105 -0
- package/script/validator/listing.d.ts +42 -0
- package/script/validator/listing.d.ts.map +1 -0
- package/script/validator/listing.js +298 -0
- package/script/validator/mod.d.ts +3 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +278 -14
- package/script/validator/modal_keywords.d.ts +25 -0
- package/script/validator/modal_keywords.d.ts.map +1 -0
- package/script/validator/modal_keywords.js +57 -0
- package/script/validator/pattern.d.ts +15 -8
- package/script/validator/pattern.d.ts.map +1 -1
- package/script/validator/pattern.js +42 -19
- package/script/validator/per_type_attrs.d.ts +29 -0
- package/script/validator/per_type_attrs.d.ts.map +1 -0
- package/script/validator/per_type_attrs.js +78 -0
- package/script/validator/pipeline.d.ts +18 -2
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +78 -22
- package/script/validator/trace_types.d.ts +26 -0
- package/script/validator/trace_types.d.ts.map +1 -0
- package/script/validator/trace_types.js +235 -0
- package/script/validator/traceability.d.ts +3 -4
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +5 -10
- package/script/validator/type_resolution.d.ts +67 -0
- package/script/validator/type_resolution.d.ts.map +1 -0
- package/script/validator/type_resolution.js +168 -0
- package/script/validator/types.d.ts +45 -0
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +131 -16
- package/script/validator/value_types.d.ts +8 -0
- package/script/validator/value_types.d.ts.map +1 -1
- package/script/validator/value_types.js +10 -2
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/lint/rules/ears
|
|
3
|
+
*
|
|
4
|
+
* EARS (Easy Approach to Requirements Syntax) pattern rules for PA-3.
|
|
5
|
+
* Five rules targeting normative sentences that violate or misapply the
|
|
6
|
+
* six canonical EARS patterns (Mavin 2009):
|
|
7
|
+
*
|
|
8
|
+
* Ubiquitous — `The <system> shall <response>`
|
|
9
|
+
* State-driven — `While <precondition>, the <system> shall <response>`
|
|
10
|
+
* Event-driven — `When <trigger>, the <system> shall <response>`
|
|
11
|
+
* Optional-feat. — `Where <feature>, the <system> shall <response>`
|
|
12
|
+
* Unwanted-behav. — `If <trigger>, then the <system> shall <response>`
|
|
13
|
+
* Complex — `While <precondition>, when <trigger>, the <system> shall <response>`
|
|
14
|
+
*
|
|
15
|
+
* Rules:
|
|
16
|
+
* MSL-Q100 ears-no-pattern (info, score 1)
|
|
17
|
+
* MSL-Q101 ears-missing-actor (warn, score 3)
|
|
18
|
+
* MSL-Q102 ears-negative-response (info, score 1)
|
|
19
|
+
* MSL-Q103 ears-stacked-preconditions (warn, score 3)
|
|
20
|
+
* MSL-Q104 ears-malformed-attempt (info, score 1)
|
|
21
|
+
*
|
|
22
|
+
* All rules are heuristic and intentionally fire narrow rather than broad.
|
|
23
|
+
* Q100 and Q101 are the most likely to have false-positive risk; their
|
|
24
|
+
* detection conditions are tighter than the full grammar.
|
|
25
|
+
*/
|
|
26
|
+
import { segmentSentences } from "../segmenter.js";
|
|
27
|
+
import { loadLexicon } from "../../lexicons/mod.js";
|
|
28
|
+
import { offsetToRange } from "../range_util.js";
|
|
29
|
+
const ABBREVS = loadLexicon("sentence-abbrev");
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Regexes — all case-insensitive unless noted
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
/** RFC 2119 modal verbs — bare forms and compound "shall not" etc. */
|
|
34
|
+
const MODAL_RE = /\b(shall not|should not|must not|shall|should|may|must|will)\b/i;
|
|
35
|
+
/** RFC 2119 negative compound modals (Q102). */
|
|
36
|
+
const NEGATIVE_MODAL_RE = /\b(shall not|should not|must not|may not)\b/i;
|
|
37
|
+
/** EARS leading-clause keywords — capital-initial only (sentence-initial). */
|
|
38
|
+
const EARS_LEADING_RE = /^(While|When|Where|If)\b/i;
|
|
39
|
+
/**
|
|
40
|
+
* EARS precondition-style keywords counting stacked clauses (Q103).
|
|
41
|
+
* Counts `While`, `When`, and `If` occurrences (not `Where` — it marks
|
|
42
|
+
* optional features, not preconditions). Case-insensitive, whole word.
|
|
43
|
+
*/
|
|
44
|
+
const EARS_PRECONDITION_RE = /\b(While|When|If)\b/gi;
|
|
45
|
+
/**
|
|
46
|
+
* Actor detection: `the <noun phrase>` immediately before the modal.
|
|
47
|
+
*
|
|
48
|
+
* An actor is considered PRESENT when the noun phrase has either:
|
|
49
|
+
* (a) at least one Capitalized (PascalCase) word, OR
|
|
50
|
+
* (b) two or more lowercase words (a compound noun phrase like
|
|
51
|
+
* "the brake controller" or "the pedal unit").
|
|
52
|
+
*
|
|
53
|
+
* An actor is considered ABSENT (Q101 fires) when the noun phrase is
|
|
54
|
+
* a single bare lowercase word ("the brake shall", "the system shall").
|
|
55
|
+
*
|
|
56
|
+
* This heuristic deliberately passes "the brake controller shall"
|
|
57
|
+
* (compound noun = named subsystem) and fires on "the brake shall"
|
|
58
|
+
* (single generic noun = too vague). It is intentionally narrow to
|
|
59
|
+
* keep false-positive risk low.
|
|
60
|
+
*
|
|
61
|
+
* `ACTOR_SINGLE_LOWERCASE_RE` matches the problematic form:
|
|
62
|
+
* `the <single-lowercase-word> <modal>`. After matching, the captured
|
|
63
|
+
* noun is checked against {@linkcode GENERIC_ACTOR_ALLOWLIST}; nouns in
|
|
64
|
+
* the allowlist are accepted as valid (if imprecise) actors.
|
|
65
|
+
*/
|
|
66
|
+
const ACTOR_SINGLE_LOWERCASE_RE = /\b[Tt]he\s+([a-z][a-z0-9]*)\s+(?:shall not|should not|must not|shall|should|may|must|will)\b/;
|
|
67
|
+
/**
|
|
68
|
+
* Single-word lowercase nouns that are conventionally accepted as generic
|
|
69
|
+
* system-level actor names in requirements prose. "The system shall…" and
|
|
70
|
+
* "The controller shall…" are ubiquitous in requirements engineering and
|
|
71
|
+
* are treated as valid actors even though they are technically vague.
|
|
72
|
+
*
|
|
73
|
+
* Q101 fires when the noun is NOT in this list — e.g. "the brake shall"
|
|
74
|
+
* (component reference without qualification) triggers the warning.
|
|
75
|
+
*
|
|
76
|
+
* Profile-extensible in a future iteration; for now the list is narrow.
|
|
77
|
+
*/
|
|
78
|
+
const GENERIC_ACTOR_ALLOWLIST = new Set([
|
|
79
|
+
"system",
|
|
80
|
+
"controller",
|
|
81
|
+
"module",
|
|
82
|
+
"unit",
|
|
83
|
+
"device",
|
|
84
|
+
"software",
|
|
85
|
+
"firmware",
|
|
86
|
+
"application",
|
|
87
|
+
"processor",
|
|
88
|
+
"subsystem",
|
|
89
|
+
"component",
|
|
90
|
+
"platform",
|
|
91
|
+
"service",
|
|
92
|
+
"driver",
|
|
93
|
+
"manager",
|
|
94
|
+
]);
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// Pattern matchers
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
/**
|
|
99
|
+
* Returns true when the sentence text contains at least one RFC 2119 modal
|
|
100
|
+
* verb. This is the normative-sentence gate: only normative sentences receive
|
|
101
|
+
* Q100–Q103 analysis.
|
|
102
|
+
*/
|
|
103
|
+
function isNormative(sentence) {
|
|
104
|
+
return MODAL_RE.test(sentence);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Returns true when the sentence matches one of the six EARS patterns.
|
|
108
|
+
*
|
|
109
|
+
* Detection heuristics (intentionally narrow to keep false-positive risk low):
|
|
110
|
+
*
|
|
111
|
+
* - State-driven: starts with `While` + contains modal
|
|
112
|
+
* - Event-driven: starts with `When` + contains modal
|
|
113
|
+
* - Optional-feature: starts with `Where` + contains modal
|
|
114
|
+
* - Unwanted-behav.: starts with `If` + contains `, then` + modal
|
|
115
|
+
* - Complex: starts with `While` + contains `when` (mid-sentence) + modal
|
|
116
|
+
* - Ubiquitous: does NOT start with EARS keyword + starts with `The` + modal
|
|
117
|
+
*
|
|
118
|
+
* Note: Ubiquitous requires an explicit `The` to reduce false-positives
|
|
119
|
+
* from non-EARS prose that happens to contain a modal.
|
|
120
|
+
*/
|
|
121
|
+
function matchesEarsPattern(sentence) {
|
|
122
|
+
if (!isNormative(sentence))
|
|
123
|
+
return false;
|
|
124
|
+
const trimmed = sentence.trim();
|
|
125
|
+
// Leading EARS keyword → one of the event/state/optional/unwanted/complex patterns.
|
|
126
|
+
if (EARS_LEADING_RE.test(trimmed)) {
|
|
127
|
+
// Unwanted-behaviour requires `, then` somewhere before the modal.
|
|
128
|
+
if (/^If\b/i.test(trimmed)) {
|
|
129
|
+
return /,\s*then\b/i.test(trimmed);
|
|
130
|
+
}
|
|
131
|
+
// State-driven, Event-driven, Optional-feature, Complex all pass when the
|
|
132
|
+
// leading keyword is present and a modal follows.
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
// Ubiquitous: no EARS leading keyword, starts with `The <noun>`, has modal.
|
|
136
|
+
if (/^The\s+/i.test(trimmed)) {
|
|
137
|
+
return MODAL_RE.test(trimmed);
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns false (actor is MISSING) when the sentence's modal is
|
|
143
|
+
* preceded by a single bare lowercase noun that is not a generic
|
|
144
|
+
* system-level term (e.g. "the brake shall"). Returns true (actor
|
|
145
|
+
* PRESENT) for:
|
|
146
|
+
* - compound noun phrases ("the brake controller shall"),
|
|
147
|
+
* - Capitalized/PascalCase nouns ("the BrakeController shall"), or
|
|
148
|
+
* - generic system nouns in {@linkcode GENERIC_ACTOR_ALLOWLIST}
|
|
149
|
+
* ("the system shall", "the controller shall").
|
|
150
|
+
*
|
|
151
|
+
* Q101 fires when this returns false.
|
|
152
|
+
*/
|
|
153
|
+
function hasActor(sentence) {
|
|
154
|
+
const m = ACTOR_SINGLE_LOWERCASE_RE.exec(sentence);
|
|
155
|
+
if (!m)
|
|
156
|
+
return true; // compound or Capitalized → actor present
|
|
157
|
+
const noun = m[1].toLowerCase();
|
|
158
|
+
return GENERIC_ACTOR_ALLOWLIST.has(noun);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Count the number of EARS precondition keywords (While/When/If) in the
|
|
162
|
+
* sentence. Used by Q103 to detect stacked preconditions.
|
|
163
|
+
*/
|
|
164
|
+
function countPreconditions(sentence) {
|
|
165
|
+
EARS_PRECONDITION_RE.lastIndex = 0;
|
|
166
|
+
let count = 0;
|
|
167
|
+
while (EARS_PRECONDITION_RE.exec(sentence) !== null)
|
|
168
|
+
count++;
|
|
169
|
+
return count;
|
|
170
|
+
}
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// Rule implementations
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
function emitQ100(sentence, sentenceOffset, paragraphText, baseLine, baseCol, entry) {
|
|
175
|
+
const range = offsetToRange(paragraphText, sentenceOffset, sentence.length, baseLine, baseCol);
|
|
176
|
+
return {
|
|
177
|
+
code: "MSL-Q100",
|
|
178
|
+
slug: "ears-no-pattern",
|
|
179
|
+
severity: "info",
|
|
180
|
+
scoreContribution: 1,
|
|
181
|
+
group: "ears",
|
|
182
|
+
message: `ears-no-pattern: normative sentence does not conform to any EARS pattern (Ubiquitous, State-driven, Event-driven, Optional-feature, Unwanted-behaviour, Complex)`,
|
|
183
|
+
location: entry.location,
|
|
184
|
+
range,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function emitQ101(sentence, sentenceOffset, paragraphText, baseLine, baseCol, entry) {
|
|
188
|
+
const range = offsetToRange(paragraphText, sentenceOffset, sentence.length, baseLine, baseCol);
|
|
189
|
+
return {
|
|
190
|
+
code: "MSL-Q101",
|
|
191
|
+
slug: "ears-missing-actor",
|
|
192
|
+
severity: "warning",
|
|
193
|
+
scoreContribution: 3,
|
|
194
|
+
group: "ears",
|
|
195
|
+
message: `ears-missing-actor: EARS sentence has no explicit actor ('the <System>') before the modal verb`,
|
|
196
|
+
location: entry.location,
|
|
197
|
+
range,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function emitQ102(sentence, sentenceOffset, paragraphText, baseLine, baseCol, entry) {
|
|
201
|
+
const range = offsetToRange(paragraphText, sentenceOffset, sentence.length, baseLine, baseCol);
|
|
202
|
+
return {
|
|
203
|
+
code: "MSL-Q102",
|
|
204
|
+
slug: "ears-negative-response",
|
|
205
|
+
severity: "info",
|
|
206
|
+
scoreContribution: 1,
|
|
207
|
+
group: "ears",
|
|
208
|
+
message: `ears-negative-response: response clause is bare negation ('shall not …'); prefer a positive form where possible`,
|
|
209
|
+
location: entry.location,
|
|
210
|
+
range,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function emitQ103(sentence, sentenceOffset, paragraphText, baseLine, baseCol, entry, count) {
|
|
214
|
+
const range = offsetToRange(paragraphText, sentenceOffset, sentence.length, baseLine, baseCol);
|
|
215
|
+
return {
|
|
216
|
+
code: "MSL-Q103",
|
|
217
|
+
slug: "ears-stacked-preconditions",
|
|
218
|
+
severity: "warning",
|
|
219
|
+
scoreContribution: 3,
|
|
220
|
+
group: "ears",
|
|
221
|
+
message: `ears-stacked-preconditions: ${count} stacked preconditions (While/When/If) in one sentence; split or restructure as canonical Complex pattern`,
|
|
222
|
+
location: entry.location,
|
|
223
|
+
range,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function emitQ104(sentence, sentenceOffset, paragraphText, baseLine, baseCol, entry) {
|
|
227
|
+
const range = offsetToRange(paragraphText, sentenceOffset, sentence.length, baseLine, baseCol);
|
|
228
|
+
return {
|
|
229
|
+
code: "MSL-Q104",
|
|
230
|
+
slug: "ears-malformed-attempt",
|
|
231
|
+
severity: "info",
|
|
232
|
+
scoreContribution: 1,
|
|
233
|
+
group: "ears",
|
|
234
|
+
message: `ears-malformed-attempt: sentence opens with EARS keyword (When/While/Where/If) but has no modal+response clause`,
|
|
235
|
+
location: entry.location,
|
|
236
|
+
range,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
// Rule code registry (for suppression hygiene)
|
|
241
|
+
// ---------------------------------------------------------------------------
|
|
242
|
+
/** All EARS rule codes exported for the suppression-hygiene known-code set. */
|
|
243
|
+
export const EARS_RULE_CODES = new Set([
|
|
244
|
+
"MSL-Q100",
|
|
245
|
+
"MSL-Q101",
|
|
246
|
+
"MSL-Q102",
|
|
247
|
+
"MSL-Q103",
|
|
248
|
+
"MSL-Q104",
|
|
249
|
+
]);
|
|
250
|
+
// ---------------------------------------------------------------------------
|
|
251
|
+
// Public entry point
|
|
252
|
+
// ---------------------------------------------------------------------------
|
|
253
|
+
/**
|
|
254
|
+
* Run EARS rules (Q100–Q104) on an entry's paragraph bodies.
|
|
255
|
+
*
|
|
256
|
+
* For each paragraph, segments into sentences. For each sentence:
|
|
257
|
+
* - Q104 fires on ANY sentence that opens with an EARS keyword but lacks
|
|
258
|
+
* a modal anywhere (catches malformed attempts even in non-normative prose).
|
|
259
|
+
* - Q100–Q103 fire ONLY on normative sentences (those containing a modal).
|
|
260
|
+
*/
|
|
261
|
+
export function runEarsRules(entry) {
|
|
262
|
+
const out = [];
|
|
263
|
+
const blocks = entry.bodyAst ?? [];
|
|
264
|
+
for (const block of blocks) {
|
|
265
|
+
if (block.kind !== "paragraph")
|
|
266
|
+
continue;
|
|
267
|
+
const p = block;
|
|
268
|
+
const text = p.content.text;
|
|
269
|
+
// Compute file-absolute base line for this paragraph.
|
|
270
|
+
// p.range.start.line is body-relative (line 1 = first body line).
|
|
271
|
+
// entry.bodyStartLine is file-absolute. Fall back to entry.location.line + 1.
|
|
272
|
+
const absBodyStart = entry.bodyStartLine ?? (entry.location.line + 1);
|
|
273
|
+
const absLine = absBodyStart + p.range.start.line - 1;
|
|
274
|
+
const baseCol = p.range.start.column;
|
|
275
|
+
const sentences = segmentSentences(text, ABBREVS);
|
|
276
|
+
for (const sentence of sentences) {
|
|
277
|
+
const s = sentence.text;
|
|
278
|
+
const off = sentence.offset;
|
|
279
|
+
// Q104: fires on non-normative malformed EARS attempts too.
|
|
280
|
+
// Sentence opens with an EARS keyword but has NO modal anywhere.
|
|
281
|
+
if (EARS_LEADING_RE.test(s.trim()) && !MODAL_RE.test(s)) {
|
|
282
|
+
out.push(emitQ104(s, off, text, absLine, baseCol, entry));
|
|
283
|
+
continue; // malformed → skip other EARS rules for this sentence
|
|
284
|
+
}
|
|
285
|
+
// Remaining rules only fire on normative sentences.
|
|
286
|
+
if (!isNormative(s))
|
|
287
|
+
continue;
|
|
288
|
+
// Q103: ≥3 stacked preconditions (fires before Q100 to avoid double-flagging).
|
|
289
|
+
const precondCount = countPreconditions(s);
|
|
290
|
+
if (precondCount >= 3) {
|
|
291
|
+
out.push(emitQ103(s, off, text, absLine, baseCol, entry, precondCount));
|
|
292
|
+
// Don't also fire Q100 on the same sentence — the sentence IS EARS-shaped,
|
|
293
|
+
// just over-complex. Q103 is the actionable diagnostic. Q101 is also
|
|
294
|
+
// skipped (the precondCount<3 guard at line 411 excludes it). Q102 still
|
|
295
|
+
// applies independently below.
|
|
296
|
+
}
|
|
297
|
+
else if (!matchesEarsPattern(s)) {
|
|
298
|
+
// Q100: normative sentence matches no EARS pattern.
|
|
299
|
+
out.push(emitQ100(s, off, text, absLine, baseCol, entry));
|
|
300
|
+
// Q101 is inapplicable when no pattern matches — Q100 already flags it.
|
|
301
|
+
// Q102 still applies (a "shall not" in a non-pattern sentence is still
|
|
302
|
+
// a negation concern).
|
|
303
|
+
}
|
|
304
|
+
// Q101: EARS pattern detected but no explicit actor.
|
|
305
|
+
// Only fire when the sentence DOES match an EARS pattern (no Q100).
|
|
306
|
+
if (precondCount < 3 && matchesEarsPattern(s) && !hasActor(s)) {
|
|
307
|
+
out.push(emitQ101(s, off, text, absLine, baseCol, entry));
|
|
308
|
+
}
|
|
309
|
+
// Q102: bare negation in response clause.
|
|
310
|
+
if (NEGATIVE_MODAL_RE.test(s)) {
|
|
311
|
+
out.push(emitQ102(s, off, text, absLine, baseCol, entry));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return out;
|
|
316
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/lint/rules/incose_sentence
|
|
3
|
+
*
|
|
4
|
+
* INCOSE sentence-level rules for PA-3 plus the entry-level Q402:
|
|
5
|
+
*
|
|
6
|
+
* MSL-Q306 incose-r11-separate-clauses (info, score 1)
|
|
7
|
+
* MSL-Q307 incose-r18-single-thought (warn, score 3)
|
|
8
|
+
* MSL-Q308 incose-r19-combinator (info, score 1)
|
|
9
|
+
* MSL-Q309 incose-r24-pronouns (info, score 1)
|
|
10
|
+
* MSL-Q311 incose-r27-explicit-conditions (info, score 1)
|
|
11
|
+
* MSL-Q312 incose-r33-range-of-values (info, score 1)
|
|
12
|
+
* MSL-Q402 struct-multiple-shall (warn, score 3)
|
|
13
|
+
*
|
|
14
|
+
* Q300 (passive voice) and Q301 (subject-verb) are deferred to slice 10
|
|
15
|
+
* due to heuristic complexity.
|
|
16
|
+
*
|
|
17
|
+
* All rules are heuristic. Default to `info` severity to avoid training
|
|
18
|
+
* authors to ignore the catalog. Q307 and Q402 are `warn` because they
|
|
19
|
+
* indicate multi-obligation requirements — structural issues, not style.
|
|
20
|
+
*
|
|
21
|
+
* Q402 is entry-level: it fires when ≥2 normative modals appear across
|
|
22
|
+
* the whole body but no single sentence already triggered Q200 (the
|
|
23
|
+
* per-sentence modal-multiple rule). This catches requirements where
|
|
24
|
+
* obligations are spread across separate sentences/paragraphs rather
|
|
25
|
+
* than concentrated in one.
|
|
26
|
+
*/
|
|
27
|
+
import type { Entry } from "../../model/mod.js";
|
|
28
|
+
import type { LintDiagnostic } from "../types.js";
|
|
29
|
+
/** All INCOSE sentence rule codes exported for suppression-hygiene set. */
|
|
30
|
+
export declare const INCOSE_SENTENCE_RULE_CODES: ReadonlySet<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Run INCOSE sentence rules (Q306–Q312) and entry-level Q402.
|
|
33
|
+
*
|
|
34
|
+
* For each paragraph, segments into sentences. For each normative sentence:
|
|
35
|
+
* - Q306 fires on exactly 2 EARS condition keywords (separate-clauses).
|
|
36
|
+
* - Q307 fires when `and` joins ≥2 modal verbs (single-thought).
|
|
37
|
+
* - Q308 fires on discourse combinators (however/whereas/meanwhile/but/unless).
|
|
38
|
+
* - Q309 fires on personal/indefinite pronouns without explicit antecedent.
|
|
39
|
+
* - Q311 fires on vague applicability phrases when no EARS leading clause.
|
|
40
|
+
* - Q312 fires on bare numeric quantities without a tolerance marker.
|
|
41
|
+
*
|
|
42
|
+
* Entry-level Q402 fires when the whole body has ≥2 modals but no single
|
|
43
|
+
* sentence concentrated them (which would be Q200 territory).
|
|
44
|
+
*/
|
|
45
|
+
export declare function runIncoseSentenceRules(entry: Entry): LintDiagnostic[];
|
|
46
|
+
//# sourceMappingURL=incose_sentence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incose_sentence.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/incose_sentence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA2JlD,2EAA2E;AAC3E,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAQzD,CAAC;AAgVH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,EAAE,CAsDrE"}
|