chaffjs 0.17.0 → 0.19.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 +52 -56
- package/bin/chaff.js +17 -2
- package/dist/acronym-expansions.d.ts +26 -0
- package/dist/acronym-expansions.d.ts.map +1 -0
- package/dist/acronym-expansions.js +88 -0
- package/dist/acronym-expansions.js.map +1 -0
- package/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +138 -0
- package/dist/announced-count.js.map +1 -0
- package/dist/announced-list.d.ts +30 -0
- package/dist/announced-list.d.ts.map +1 -0
- package/dist/announced-list.js +95 -0
- package/dist/announced-list.js.map +1 -0
- package/dist/api.d.ts +168 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +10 -0
- package/dist/api.js.map +1 -0
- package/dist/bare-url.d.ts +14 -0
- package/dist/bare-url.d.ts.map +1 -0
- package/dist/bare-url.js +28 -0
- package/dist/bare-url.js.map +1 -0
- package/dist/baseline.d.ts +5 -0
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +16 -1
- package/dist/baseline.js.map +1 -1
- package/dist/body-section.d.ts +7 -0
- package/dist/body-section.d.ts.map +1 -0
- package/dist/body-section.js +6 -0
- package/dist/body-section.js.map +1 -0
- package/dist/calendar-number.d.ts +2 -0
- package/dist/calendar-number.d.ts.map +1 -1
- package/dist/calendar-number.js +9 -2
- package/dist/calendar-number.js.map +1 -1
- package/dist/cli-args.d.ts +4 -0
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts +0 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +14 -18
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +83 -84
- package/dist/cli.js.map +1 -1
- package/dist/closing-paragraph.d.ts +7 -0
- package/dist/closing-paragraph.d.ts.map +1 -0
- package/dist/closing-paragraph.js +22 -0
- package/dist/closing-paragraph.js.map +1 -0
- package/dist/commands/compare.d.ts +15 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +64 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/document-commands.d.ts +9 -0
- package/dist/commands/document-commands.d.ts.map +1 -0
- package/dist/commands/document-commands.js +17 -0
- package/dist/commands/document-commands.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +19 -10
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/facts.d.ts +8 -0
- package/dist/commands/facts.d.ts.map +1 -0
- package/dist/commands/facts.js +30 -0
- package/dist/commands/facts.js.map +1 -0
- package/dist/commands/feedback.d.ts +15 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +36 -6
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/fix-plan.d.ts +13 -0
- package/dist/commands/fix-plan.d.ts.map +1 -0
- package/dist/commands/fix-plan.js +44 -0
- package/dist/commands/fix-plan.js.map +1 -0
- package/dist/commands/outline.d.ts +8 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +43 -0
- package/dist/commands/outline.js.map +1 -0
- package/dist/commands/read-document.d.ts +14 -0
- package/dist/commands/read-document.d.ts.map +1 -0
- package/dist/commands/read-document.js +21 -0
- package/dist/commands/read-document.js.map +1 -0
- package/dist/commands/suppressions.d.ts +7 -0
- package/dist/commands/suppressions.d.ts.map +1 -0
- package/dist/commands/suppressions.js +9 -0
- package/dist/commands/suppressions.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +3 -5
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/tree.d.ts +13 -0
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +35 -5
- package/dist/commands/tree.js.map +1 -1
- package/dist/compare/atom.d.ts +31 -0
- package/dist/compare/atom.d.ts.map +1 -0
- package/dist/compare/atom.js +4 -0
- package/dist/compare/atom.js.map +1 -0
- package/dist/compare/clock-time.d.ts +8 -0
- package/dist/compare/clock-time.d.ts.map +1 -0
- package/dist/compare/clock-time.js +68 -0
- package/dist/compare/clock-time.js.map +1 -0
- package/dist/compare/distinct.d.ts +9 -0
- package/dist/compare/distinct.d.ts.map +1 -0
- package/dist/compare/distinct.js +12 -0
- package/dist/compare/distinct.js.map +1 -0
- package/dist/compare/extract.d.ts +15 -0
- package/dist/compare/extract.d.ts.map +1 -0
- package/dist/compare/extract.js +60 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-key.d.ts +17 -0
- package/dist/compare/fact-key.d.ts.map +1 -0
- package/dist/compare/fact-key.js +25 -0
- package/dist/compare/fact-key.js.map +1 -0
- package/dist/compare/fact-text.d.ts +28 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +61 -0
- package/dist/compare/fact-text.js.map +1 -0
- package/dist/compare/facts-render.d.ts +17 -0
- package/dist/compare/facts-render.d.ts.map +1 -0
- package/dist/compare/facts-render.js +43 -0
- package/dist/compare/facts-render.js.map +1 -0
- package/dist/compare/facts-text.d.ts +15 -0
- package/dist/compare/facts-text.d.ts.map +1 -0
- package/dist/compare/facts-text.js +27 -0
- package/dist/compare/facts-text.js.map +1 -0
- package/dist/compare/markup-atoms.d.ts +11 -0
- package/dist/compare/markup-atoms.d.ts.map +1 -0
- package/dist/compare/markup-atoms.js +23 -0
- package/dist/compare/markup-atoms.js.map +1 -0
- package/dist/compare/match.d.ts +20 -0
- package/dist/compare/match.d.ts.map +1 -0
- package/dist/compare/match.js +84 -0
- package/dist/compare/match.js.map +1 -0
- package/dist/compare/outcome.d.ts +36 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +46 -0
- package/dist/compare/outcome.js.map +1 -0
- package/dist/compare/proper-nouns.d.ts +19 -0
- package/dist/compare/proper-nouns.d.ts.map +1 -0
- package/dist/compare/proper-nouns.js +43 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +13 -0
- package/dist/compare/render.d.ts.map +1 -0
- package/dist/compare/render.js +64 -0
- package/dist/compare/render.js.map +1 -0
- package/dist/compare/spans.d.ts +9 -0
- package/dist/compare/spans.d.ts.map +1 -0
- package/dist/compare/spans.js +11 -0
- package/dist/compare/spans.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +27 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +69 -0
- package/dist/compare/text-atoms.js.map +1 -0
- package/dist/compare/text.d.ts +24 -0
- package/dist/compare/text.d.ts.map +1 -0
- package/dist/compare/text.js +90 -0
- package/dist/compare/text.js.map +1 -0
- package/dist/compare/tree-atoms.d.ts +20 -0
- package/dist/compare/tree-atoms.d.ts.map +1 -0
- package/dist/compare/tree-atoms.js +58 -0
- package/dist/compare/tree-atoms.js.map +1 -0
- package/dist/compare/written-names.d.ts +8 -0
- package/dist/compare/written-names.d.ts.map +1 -0
- package/dist/compare/written-names.js +24 -0
- package/dist/compare/written-names.js.map +1 -0
- package/dist/config/load.d.ts +23 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +6 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +17 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +59 -0
- package/dist/config/option-problems.js.map +1 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.d.ts.map +1 -0
- package/dist/config/read.js +8 -0
- package/dist/config/read.js.map +1 -0
- package/dist/config/rule-problems.d.ts +2 -4
- package/dist/config/rule-problems.d.ts.map +1 -1
- package/dist/config/rule-problems.js +7 -1
- package/dist/config/rule-problems.js.map +1 -1
- package/dist/config/style.d.ts +21 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +48 -0
- package/dist/config/style.js.map +1 -0
- package/dist/config/warnings.d.ts +6 -0
- package/dist/config/warnings.d.ts.map +1 -0
- package/dist/config/warnings.js +10 -0
- package/dist/config/warnings.js.map +1 -0
- package/dist/config/write.d.ts.map +1 -1
- package/dist/config/write.js +17 -4
- package/dist/config/write.js.map +1 -1
- package/dist/custom/bounded-match.d.ts +15 -0
- package/dist/custom/bounded-match.d.ts.map +1 -0
- package/dist/custom/bounded-match.js +43 -0
- package/dist/custom/bounded-match.js.map +1 -0
- package/dist/custom/load.d.ts +11 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +19 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/module-path.d.ts +11 -0
- package/dist/custom/module-path.d.ts.map +1 -0
- package/dist/custom/module-path.js +15 -0
- package/dist/custom/module-path.js.map +1 -0
- package/dist/custom/parse.d.ts +84 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +258 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +8 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +95 -0
- package/dist/custom/problems.js.map +1 -0
- package/dist/custom/regex-safety.d.ts +11 -0
- package/dist/custom/regex-safety.d.ts.map +1 -0
- package/dist/custom/regex-safety.js +110 -0
- package/dist/custom/regex-safety.js.map +1 -0
- package/dist/custom/token-pattern.d.ts +8 -0
- package/dist/custom/token-pattern.d.ts.map +1 -0
- package/dist/custom/token-pattern.js +75 -0
- package/dist/custom/token-pattern.js.map +1 -0
- package/dist/detect-language.js +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +30 -2
- package/dist/detect.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +2 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +12 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +23 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +116 -0
- package/dist/detectors/ai-phrasing.js.map +1 -0
- package/dist/detectors/announced-count.d.ts +4 -0
- package/dist/detectors/announced-count.d.ts.map +1 -0
- package/dist/detectors/announced-count.js +20 -0
- package/dist/detectors/announced-count.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +10 -0
- package/dist/detectors/bold-label.d.ts.map +1 -0
- package/dist/detectors/bold-label.js +44 -0
- package/dist/detectors/bold-label.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +17 -0
- package/dist/detectors/broken-link.d.ts.map +1 -0
- package/dist/detectors/broken-link.js +66 -0
- package/dist/detectors/broken-link.js.map +1 -0
- package/dist/detectors/cited-name.d.ts.map +1 -1
- package/dist/detectors/cited-name.js +4 -4
- package/dist/detectors/cited-name.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +11 -0
- package/dist/detectors/cited-title.d.ts.map +1 -0
- package/dist/detectors/cited-title.js +75 -0
- package/dist/detectors/cited-title.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +1 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +2 -1
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contrast-frame.d.ts +17 -0
- package/dist/detectors/contrast-frame.d.ts.map +1 -0
- package/dist/detectors/contrast-frame.js +32 -0
- package/dist/detectors/contrast-frame.js.map +1 -0
- package/dist/detectors/custom.d.ts +8 -0
- package/dist/detectors/custom.d.ts.map +1 -0
- package/dist/detectors/custom.js +71 -0
- package/dist/detectors/custom.js.map +1 -0
- package/dist/detectors/dangling-figure.d.ts +7 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +20 -0
- package/dist/detectors/dangling-figure.js.map +1 -0
- package/dist/detectors/definition-use.d.ts +8 -0
- package/dist/detectors/definition-use.d.ts.map +1 -0
- package/dist/detectors/definition-use.js +32 -0
- package/dist/detectors/definition-use.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +9 -0
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -0
- package/dist/detectors/doubled-punctuation.js +35 -0
- package/dist/detectors/doubled-punctuation.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts +5 -0
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +24 -11
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/duplicate-heading.d.ts +14 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -0
- package/dist/detectors/duplicate-heading.js +39 -0
- package/dist/detectors/duplicate-heading.js.map +1 -0
- package/dist/detectors/empty-section.d.ts +8 -0
- package/dist/detectors/empty-section.d.ts.map +1 -0
- package/dist/detectors/empty-section.js +16 -0
- package/dist/detectors/empty-section.js.map +1 -0
- package/dist/detectors/enumerated-runs.d.ts +1 -1
- package/dist/detectors/enumerated-runs.d.ts.map +1 -1
- package/dist/detectors/enumerated-runs.js +15 -4
- package/dist/detectors/enumerated-runs.js.map +1 -1
- package/dist/detectors/fullwidth-alnum.d.ts +24 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -0
- package/dist/detectors/fullwidth-alnum.js +88 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -0
- package/dist/detectors/gram-furniture.d.ts +6 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -0
- package/dist/detectors/gram-furniture.js +21 -0
- package/dist/detectors/gram-furniture.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +2 -0
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +9 -7
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-windows.d.ts +9 -0
- package/dist/detectors/gram-windows.d.ts.map +1 -0
- package/dist/detectors/gram-windows.js +27 -0
- package/dist/detectors/gram-windows.js.map +1 -0
- package/dist/detectors/hankaku-kana.d.ts +9 -0
- package/dist/detectors/hankaku-kana.d.ts.map +1 -0
- package/dist/detectors/hankaku-kana.js +27 -0
- package/dist/detectors/hankaku-kana.js.map +1 -0
- package/dist/detectors/heading-case.d.ts +2 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +29 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-code-words.d.ts +6 -0
- package/dist/detectors/heading-code-words.d.ts.map +1 -0
- package/dist/detectors/heading-code-words.js +29 -0
- package/dist/detectors/heading-code-words.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +7 -4
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-level-skip.d.ts +12 -0
- package/dist/detectors/heading-level-skip.d.ts.map +1 -0
- package/dist/detectors/heading-level-skip.js +11 -0
- package/dist/detectors/heading-level-skip.js.map +1 -0
- package/dist/detectors/image-alt-text.d.ts +3 -0
- package/dist/detectors/image-alt-text.d.ts.map +1 -0
- package/dist/detectors/image-alt-text.js +9 -0
- package/dist/detectors/image-alt-text.js.map +1 -0
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +70 -1
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/invisible-character.d.ts +20 -0
- package/dist/detectors/invisible-character.d.ts.map +1 -0
- package/dist/detectors/invisible-character.js +143 -0
- package/dist/detectors/invisible-character.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts +24 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -0
- package/dist/detectors/kutoten-consistency.js +77 -0
- package/dist/detectors/kutoten-consistency.js.map +1 -0
- package/dist/detectors/lead-in.d.ts +1 -0
- package/dist/detectors/lead-in.d.ts.map +1 -1
- package/dist/detectors/lead-in.js +2 -1
- package/dist/detectors/lead-in.js.map +1 -1
- package/dist/detectors/lexicon-match.d.ts +14 -1
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +32 -2
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +6 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +31 -13
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-item.d.ts +45 -0
- package/dist/detectors/list-item.d.ts.map +1 -0
- package/dist/detectors/list-item.js +88 -0
- package/dist/detectors/list-item.js.map +1 -0
- package/dist/detectors/list-items.d.ts +31 -0
- package/dist/detectors/list-items.d.ts.map +1 -0
- package/dist/detectors/list-items.js +113 -0
- package/dist/detectors/list-items.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts +7 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -0
- package/dist/detectors/list-lead-in.js +28 -0
- package/dist/detectors/list-lead-in.js.map +1 -0
- package/dist/detectors/list-sentence.d.ts +67 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +130 -0
- package/dist/detectors/list-sentence.js.map +1 -0
- package/dist/detectors/list-view.d.ts +34 -0
- package/dist/detectors/list-view.d.ts.map +1 -0
- package/dist/detectors/list-view.js +137 -0
- package/dist/detectors/list-view.js.map +1 -0
- package/dist/detectors/long-vowel.d.ts +7 -0
- package/dist/detectors/long-vowel.d.ts.map +1 -0
- package/dist/detectors/long-vowel.js +71 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +8 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +29 -0
- package/dist/detectors/markup-finding.js.map +1 -0
- package/dist/detectors/modal-conflict.d.ts +4 -0
- package/dist/detectors/modal-conflict.d.ts.map +1 -0
- package/dist/detectors/modal-conflict.js +22 -0
- package/dist/detectors/modal-conflict.js.map +1 -0
- package/dist/detectors/name-numeral.d.ts +1 -1
- package/dist/detectors/name-numeral.d.ts.map +1 -1
- package/dist/detectors/name-numeral.js +2 -7
- package/dist/detectors/name-numeral.js.map +1 -1
- package/dist/detectors/name-variant.d.ts +4 -0
- package/dist/detectors/name-variant.d.ts.map +1 -0
- package/dist/detectors/name-variant.js +13 -0
- package/dist/detectors/name-variant.js.map +1 -0
- package/dist/detectors/nominalization.d.ts +11 -0
- package/dist/detectors/nominalization.d.ts.map +1 -0
- package/dist/detectors/nominalization.js +56 -0
- package/dist/detectors/nominalization.js.map +1 -0
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +72 -37
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outside-announced-list.d.ts +4 -0
- package/dist/detectors/outside-announced-list.d.ts.map +1 -0
- package/dist/detectors/outside-announced-list.js +24 -0
- package/dist/detectors/outside-announced-list.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts +7 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +136 -229
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +4 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +26 -7
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/place-run.d.ts.map +1 -1
- package/dist/detectors/place-run.js +10 -6
- package/dist/detectors/place-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +9 -0
- package/dist/detectors/placeholder-text.d.ts.map +1 -0
- package/dist/detectors/placeholder-text.js +18 -0
- package/dist/detectors/placeholder-text.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +3 -0
- package/dist/detectors/quote-around.d.ts.map +1 -0
- package/dist/detectors/quote-around.js +8 -0
- package/dist/detectors/quote-around.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +9 -0
- package/dist/detectors/ra-nuki.d.ts.map +1 -0
- package/dist/detectors/ra-nuki.js +30 -0
- package/dist/detectors/ra-nuki.js.map +1 -0
- package/dist/detectors/register.d.ts +11 -3
- package/dist/detectors/register.d.ts.map +1 -1
- package/dist/detectors/register.js +28 -9
- package/dist/detectors/register.js.map +1 -1
- package/dist/detectors/requirement-modal.d.ts +5 -0
- package/dist/detectors/requirement-modal.d.ts.map +1 -0
- package/dist/detectors/requirement-modal.js +54 -0
- package/dist/detectors/requirement-modal.js.map +1 -0
- package/dist/detectors/requirement-smell.d.ts +4 -0
- package/dist/detectors/requirement-smell.d.ts.map +1 -0
- package/dist/detectors/requirement-smell.js +41 -0
- package/dist/detectors/requirement-smell.js.map +1 -0
- package/dist/detectors/roman-numeral.d.ts +2 -0
- package/dist/detectors/roman-numeral.d.ts.map +1 -1
- package/dist/detectors/roman-numeral.js +2 -0
- package/dist/detectors/roman-numeral.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +17 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +13 -7
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +13 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/signals.d.ts +8 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +67 -46
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/space-before-punctuation.d.ts +8 -0
- package/dist/detectors/space-before-punctuation.d.ts.map +1 -0
- package/dist/detectors/space-before-punctuation.js +24 -0
- package/dist/detectors/space-before-punctuation.js.map +1 -0
- package/dist/detectors/spelling-variety.d.ts +23 -0
- package/dist/detectors/spelling-variety.d.ts.map +1 -0
- package/dist/detectors/spelling-variety.js +59 -0
- package/dist/detectors/spelling-variety.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +6 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +39 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -3
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +19 -6
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-comparison.d.ts +20 -0
- package/dist/detectors/superlative-comparison.d.ts.map +1 -0
- package/dist/detectors/superlative-comparison.js +32 -0
- package/dist/detectors/superlative-comparison.js.map +1 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +8 -5
- package/dist/detectors/superlative-name.js.map +1 -1
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +9 -4
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/token-column.d.ts +46 -0
- package/dist/detectors/token-column.d.ts.map +1 -0
- package/dist/detectors/token-column.js +95 -0
- package/dist/detectors/token-column.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts +22 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -0
- package/dist/detectors/unbalanced-bracket.js +119 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -0
- package/dist/detectors/url-run-on.d.ts +9 -0
- package/dist/detectors/url-run-on.d.ts.map +1 -0
- package/dist/detectors/url-run-on.js +24 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- package/dist/detectors/vague-figure-pointer.d.ts +10 -0
- package/dist/detectors/vague-figure-pointer.d.ts.map +1 -0
- package/dist/detectors/vague-figure-pointer.js +46 -0
- package/dist/detectors/vague-figure-pointer.js.map +1 -0
- package/dist/detectors/word-list.d.ts +2 -0
- package/dist/detectors/word-list.d.ts.map +1 -1
- package/dist/detectors/word-list.js +4 -1
- package/dist/detectors/word-list.js.map +1 -1
- package/dist/document-sections.d.ts +13 -0
- package/dist/document-sections.d.ts.map +1 -0
- package/dist/document-sections.js +32 -0
- package/dist/document-sections.js.map +1 -0
- package/dist/document.d.ts +20 -7
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +140 -125
- package/dist/document.js.map +1 -1
- package/dist/email-parts.d.ts +28 -0
- package/dist/email-parts.d.ts.map +1 -0
- package/dist/email-parts.js +230 -0
- package/dist/email-parts.js.map +1 -0
- package/dist/eval.d.ts +2 -1
- package/dist/eval.d.ts.map +1 -1
- package/dist/eval.js +16 -4
- package/dist/eval.js.map +1 -1
- package/dist/extension/document-view.d.ts +7 -0
- package/dist/extension/document-view.d.ts.map +1 -0
- package/dist/extension/document-view.js +91 -0
- package/dist/extension/document-view.js.map +1 -0
- package/dist/extension/failure-text.d.ts +5 -0
- package/dist/extension/failure-text.d.ts.map +1 -0
- package/dist/extension/failure-text.js +33 -0
- package/dist/extension/failure-text.js.map +1 -0
- package/dist/extension/import-default.d.ts +7 -0
- package/dist/extension/import-default.d.ts.map +1 -0
- package/dist/extension/import-default.js +21 -0
- package/dist/extension/import-default.js.map +1 -0
- package/dist/extension/load.d.ts +28 -0
- package/dist/extension/load.d.ts.map +1 -0
- package/dist/extension/load.js +51 -0
- package/dist/extension/load.js.map +1 -0
- package/dist/extension/module-detector.d.ts +21 -0
- package/dist/extension/module-detector.d.ts.map +1 -0
- package/dist/extension/module-detector.js +49 -0
- package/dist/extension/module-detector.js.map +1 -0
- package/dist/extension/plugin-load.d.ts +9 -0
- package/dist/extension/plugin-load.d.ts.map +1 -0
- package/dist/extension/plugin-load.js +68 -0
- package/dist/extension/plugin-load.js.map +1 -0
- package/dist/extension/plugin-name.d.ts +8 -0
- package/dist/extension/plugin-name.d.ts.map +1 -0
- package/dist/extension/plugin-name.js +22 -0
- package/dist/extension/plugin-name.js.map +1 -0
- package/dist/extension/plugin-parse.d.ts +41 -0
- package/dist/extension/plugin-parse.d.ts.map +1 -0
- package/dist/extension/plugin-parse.js +156 -0
- package/dist/extension/plugin-parse.js.map +1 -0
- package/dist/extension/problem-text.d.ts +5 -0
- package/dist/extension/problem-text.d.ts.map +1 -0
- package/dist/extension/problem-text.js +74 -0
- package/dist/extension/problem-text.js.map +1 -0
- package/dist/extension/real-path.d.ts +3 -0
- package/dist/extension/real-path.d.ts.map +1 -0
- package/dist/extension/real-path.js +8 -0
- package/dist/extension/real-path.js.map +1 -0
- package/dist/extension/returned-findings.d.ts +17 -0
- package/dist/extension/returned-findings.d.ts.map +1 -0
- package/dist/extension/returned-findings.js +48 -0
- package/dist/extension/returned-findings.js.map +1 -0
- package/dist/extension/rule-export.d.ts +13 -0
- package/dist/extension/rule-export.d.ts.map +1 -0
- package/dist/extension/rule-export.js +16 -0
- package/dist/extension/rule-export.js.map +1 -0
- package/dist/feedback/draft.d.ts +2 -0
- package/dist/feedback/draft.d.ts.map +1 -1
- package/dist/feedback/draft.js +3 -0
- package/dist/feedback/draft.js.map +1 -1
- package/dist/figure-references.d.ts +39 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +113 -0
- package/dist/figure-references.js.map +1 -0
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +4 -0
- package/dist/files.js.map +1 -1
- package/dist/finding-order.d.ts +9 -0
- package/dist/finding-order.d.ts.map +1 -0
- package/dist/finding-order.js +3 -0
- package/dist/finding-order.js.map +1 -0
- package/dist/fix-plan/mode.d.ts +21 -0
- package/dist/fix-plan/mode.d.ts.map +1 -0
- package/dist/fix-plan/mode.js +16 -0
- package/dist/fix-plan/mode.js.map +1 -0
- package/dist/fix-plan/plan.d.ts +77 -0
- package/dist/fix-plan/plan.d.ts.map +1 -0
- package/dist/fix-plan/plan.js +100 -0
- package/dist/fix-plan/plan.js.map +1 -0
- package/dist/fix-plan/render.d.ts +6 -0
- package/dist/fix-plan/render.d.ts.map +1 -0
- package/dist/fix-plan/render.js +101 -0
- package/dist/fix-plan/render.js.map +1 -0
- package/dist/fix-plan/text.d.ts +35 -0
- package/dist/fix-plan/text.d.ts.map +1 -0
- package/dist/fix-plan/text.js +95 -0
- package/dist/fix-plan/text.js.map +1 -0
- package/dist/heading-label.d.ts +22 -0
- package/dist/heading-label.d.ts.map +1 -0
- package/dist/heading-label.js +50 -0
- package/dist/heading-label.js.map +1 -0
- package/dist/in-page-nav.d.ts +4 -1
- package/dist/in-page-nav.d.ts.map +1 -1
- package/dist/in-page-nav.js +53 -18
- package/dist/in-page-nav.js.map +1 -1
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/language-sample.d.ts +2 -0
- package/dist/language-sample.d.ts.map +1 -0
- package/dist/language-sample.js +41 -0
- package/dist/language-sample.js.map +1 -0
- package/dist/levels.d.ts +5 -1
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +9 -0
- package/dist/levels.js.map +1 -1
- package/dist/line-paragraphs.d.ts +8 -0
- package/dist/line-paragraphs.d.ts.map +1 -1
- package/dist/line-paragraphs.js +33 -10
- package/dist/line-paragraphs.js.map +1 -1
- package/dist/link-line.d.ts +8 -0
- package/dist/link-line.d.ts.map +1 -0
- package/dist/link-line.js +12 -0
- package/dist/link-line.js.map +1 -0
- package/dist/long-vowel.d.ts +38 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +78 -0
- package/dist/long-vowel.js.map +1 -0
- package/dist/markdown-node.d.ts +19 -0
- package/dist/markdown-node.d.ts.map +1 -0
- package/dist/markdown-node.js +6 -0
- package/dist/markdown-node.js.map +1 -0
- package/dist/markdown-read.d.ts +17 -0
- package/dist/markdown-read.d.ts.map +1 -0
- package/dist/markdown-read.js +37 -0
- package/dist/markdown-read.js.map +1 -0
- package/dist/markup.d.ts +22 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +182 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.js +8 -5
- package/dist/mask.js.map +1 -1
- package/dist/name-variants.d.ts +25 -0
- package/dist/name-variants.d.ts.map +1 -0
- package/dist/name-variants.js +181 -0
- package/dist/name-variants.js.map +1 -0
- package/dist/node-version.d.ts +7 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +19 -0
- package/dist/node-version.js.map +1 -0
- package/dist/not-run.d.ts +14 -0
- package/dist/not-run.d.ts.map +1 -0
- package/dist/not-run.js +12 -0
- package/dist/not-run.js.map +1 -0
- package/dist/number-name.d.ts +21 -5
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +119 -17
- package/dist/number-name.js.map +1 -1
- package/dist/orthography.d.ts +10 -1
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +42 -16
- package/dist/orthography.js.map +1 -1
- package/dist/outline/render.d.ts +18 -0
- package/dist/outline/render.d.ts.map +1 -0
- package/dist/outline/render.js +60 -0
- package/dist/outline/render.js.map +1 -0
- package/dist/outline/shape.d.ts +26 -0
- package/dist/outline/shape.d.ts.map +1 -0
- package/dist/outline/shape.js +37 -0
- package/dist/outline/shape.js.map +1 -0
- package/dist/outline/text.d.ts +21 -0
- package/dist/outline/text.d.ts.map +1 -0
- package/dist/outline/text.js +30 -0
- package/dist/outline/text.js.map +1 -0
- package/dist/page-furniture.d.ts +5 -2
- package/dist/page-furniture.d.ts.map +1 -1
- package/dist/page-furniture.js +8 -2
- package/dist/page-furniture.js.map +1 -1
- package/dist/plain-source.d.ts +1 -0
- package/dist/plain-source.d.ts.map +1 -1
- package/dist/plain-source.js +2 -1
- package/dist/plain-source.js.map +1 -1
- package/dist/plugin.d.ts +138 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/for-file.d.ts.map +1 -1
- package/dist/profile/for-file.js +3 -1
- package/dist/profile/for-file.js.map +1 -1
- package/dist/quoted-span.d.ts.map +1 -1
- package/dist/quoted-span.js +8 -3
- package/dist/quoted-span.js.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +8 -0
- package/dist/reasons.js.map +1 -1
- package/dist/reference-lists.d.ts +3 -0
- package/dist/reference-lists.d.ts.map +1 -0
- package/dist/reference-lists.js +75 -0
- package/dist/reference-lists.js.map +1 -0
- package/dist/render/compact.d.ts +3 -1
- package/dist/render/compact.d.ts.map +1 -1
- package/dist/render/compact.js +8 -2
- package/dist/render/compact.js.map +1 -1
- package/dist/render/explain.d.ts +9 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +54 -13
- package/dist/render/explain.js.map +1 -1
- package/dist/render/friendly.d.ts.map +1 -1
- package/dist/render/friendly.js +19 -9
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/options.d.ts +7 -0
- package/dist/render/options.d.ts.map +1 -0
- package/dist/render/options.js +50 -0
- package/dist/render/options.js.map +1 -0
- package/dist/render/rules-json.d.ts +4 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +110 -16
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.d.ts +4 -0
- package/dist/render/rules-table.d.ts.map +1 -0
- package/dist/render/rules-table.js +70 -0
- package/dist/render/rules-table.js.map +1 -0
- package/dist/render/sarif.js +4 -4
- package/dist/render/sarif.js.map +1 -1
- package/dist/render/semantic.js +3 -3
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/severity-name.d.ts +6 -0
- package/dist/render/severity-name.d.ts.map +1 -0
- package/dist/render/severity-name.js +7 -0
- package/dist/render/severity-name.js.map +1 -0
- package/dist/render/suppressions.d.ts +3 -0
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +20 -1
- package/dist/render/suppressions.js.map +1 -1
- package/dist/render/text.d.ts +7 -2
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +15 -4
- package/dist/render/text.js.map +1 -1
- package/dist/resolve-genre.d.ts +1 -1
- package/dist/resolve-genre.d.ts.map +1 -1
- package/dist/resolve-genre.js +4 -1
- package/dist/resolve-genre.js.map +1 -1
- package/dist/rule-genres.d.ts +24 -0
- package/dist/rule-genres.d.ts.map +1 -0
- package/dist/rule-genres.js +11 -0
- package/dist/rule-genres.js.map +1 -0
- package/dist/rule-guide.d.ts +73 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +95 -0
- package/dist/rule-guide.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +87 -33
- package/dist/rule-load.js.map +1 -1
- package/dist/rule-options.d.ts +50 -0
- package/dist/rule-options.d.ts.map +1 -0
- package/dist/rule-options.js +106 -0
- package/dist/rule-options.js.map +1 -0
- package/dist/run-semantic.d.ts.map +1 -1
- package/dist/run-semantic.js +2 -1
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +18 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +80 -19
- package/dist/run.js.map +1 -1
- package/dist/sentence-shape.d.ts.map +1 -1
- package/dist/sentence-shape.js +4 -4
- package/dist/sentence-shape.js.map +1 -1
- package/dist/setting-problems.d.ts +2 -1
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +8 -1
- package/dist/setting-problems.js.map +1 -1
- package/dist/spacing-minority.d.ts +16 -0
- package/dist/spacing-minority.d.ts.map +1 -0
- package/dist/spacing-minority.js +23 -0
- package/dist/spacing-minority.js.map +1 -0
- package/dist/span-cut.d.ts +6 -0
- package/dist/span-cut.d.ts.map +1 -0
- package/dist/span-cut.js +22 -0
- package/dist/span-cut.js.map +1 -0
- package/dist/stet-block.d.ts +5 -0
- package/dist/stet-block.d.ts.map +1 -0
- package/dist/stet-block.js +59 -0
- package/dist/stet-block.js.map +1 -0
- package/dist/stet.d.ts +4 -0
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +31 -11
- package/dist/stet.js.map +1 -1
- package/dist/structure/aside-depth.d.ts +21 -0
- package/dist/structure/aside-depth.d.ts.map +1 -0
- package/dist/structure/aside-depth.js +65 -0
- package/dist/structure/aside-depth.js.map +1 -0
- package/dist/structure/build.d.ts +5 -1
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +29 -17
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/closed-pairs.d.ts +8 -0
- package/dist/structure/closed-pairs.d.ts.map +1 -0
- package/dist/structure/closed-pairs.js +22 -0
- package/dist/structure/closed-pairs.js.map +1 -0
- package/dist/structure/date-range.d.ts +31 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +77 -0
- package/dist/structure/date-range.js.map +1 -0
- package/dist/structure/definition-use.d.ts +32 -0
- package/dist/structure/definition-use.d.ts.map +1 -0
- package/dist/structure/definition-use.js +102 -0
- package/dist/structure/definition-use.js.map +1 -0
- package/dist/structure/known-mentions.d.ts +18 -0
- package/dist/structure/known-mentions.d.ts.map +1 -0
- package/dist/structure/known-mentions.js +78 -0
- package/dist/structure/known-mentions.js.map +1 -0
- package/dist/structure/lazy-tree.d.ts +8 -0
- package/dist/structure/lazy-tree.d.ts.map +1 -0
- package/dist/structure/lazy-tree.js +14 -0
- package/dist/structure/lazy-tree.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +28 -0
- package/dist/structure/modal-conflict.d.ts.map +1 -0
- package/dist/structure/modal-conflict.js +74 -0
- package/dist/structure/modal-conflict.js.map +1 -0
- package/dist/structure/numbered-clauses.d.ts +4 -0
- package/dist/structure/numbered-clauses.d.ts.map +1 -0
- package/dist/structure/numbered-clauses.js +9 -0
- package/dist/structure/numbered-clauses.js.map +1 -0
- package/dist/structure/numbering.d.ts +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +11 -6
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/of.d.ts +3 -1
- package/dist/structure/of.d.ts.map +1 -1
- package/dist/structure/of.js +5 -1
- package/dist/structure/of.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +16 -0
- package/dist/structure/percent-sum.d.ts.map +1 -0
- package/dist/structure/percent-sum.js +104 -0
- package/dist/structure/percent-sum.js.map +1 -0
- package/dist/structure/quoted-number.d.ts +8 -0
- package/dist/structure/quoted-number.d.ts.map +1 -0
- package/dist/structure/quoted-number.js +34 -0
- package/dist/structure/quoted-number.js.map +1 -0
- package/dist/structure/relative-find.d.ts.map +1 -1
- package/dist/structure/relative-find.js +34 -46
- package/dist/structure/relative-find.js.map +1 -1
- package/dist/structure/relative-resolve.d.ts.map +1 -1
- package/dist/structure/relative-resolve.js +76 -30
- package/dist/structure/relative-resolve.js.map +1 -1
- package/dist/structure/runs.d.ts +2 -0
- package/dist/structure/runs.d.ts.map +1 -1
- package/dist/structure/runs.js +2 -2
- package/dist/structure/runs.js.map +1 -1
- package/dist/structure/sexp.d.ts +1 -1
- package/dist/structure/sexp.d.ts.map +1 -1
- package/dist/structure/sexp.js +18 -6
- package/dist/structure/sexp.js.map +1 -1
- package/dist/structure/total.d.ts +3 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +2 -2
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/universal.d.ts +14 -2
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +24 -3
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/wrapped-tail.d.ts +14 -7
- package/dist/structure/wrapped-tail.d.ts.map +1 -1
- package/dist/structure/wrapped-tail.js +33 -8
- package/dist/structure/wrapped-tail.js.map +1 -1
- package/dist/style-load.d.ts +4 -0
- package/dist/style-load.d.ts.map +1 -0
- package/dist/style-load.js +28 -0
- package/dist/style-load.js.map +1 -0
- package/dist/style-parse.d.ts +25 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +88 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +23 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +85 -0
- package/dist/subheading-line.js.map +1 -0
- package/dist/tag-coverage.d.ts +8 -0
- package/dist/tag-coverage.d.ts.map +1 -0
- package/dist/tag-coverage.js +7 -0
- package/dist/tag-coverage.js.map +1 -0
- package/dist/template-syntax.d.ts +17 -0
- package/dist/template-syntax.d.ts.map +1 -0
- package/dist/template-syntax.js +140 -0
- package/dist/template-syntax.js.map +1 -0
- package/dist/text-above.d.ts +19 -0
- package/dist/text-above.d.ts.map +1 -0
- package/dist/text-above.js +43 -0
- package/dist/text-above.js.map +1 -0
- package/dist/text-figures.d.ts +10 -0
- package/dist/text-figures.d.ts.map +1 -0
- package/dist/text-figures.js +131 -0
- package/dist/text-figures.js.map +1 -0
- package/dist/trailing-aside.d.ts +2 -0
- package/dist/trailing-aside.d.ts.map +1 -0
- package/dist/trailing-aside.js +53 -0
- package/dist/trailing-aside.js.map +1 -0
- package/dist/tree-walk.d.ts +18 -0
- package/dist/tree-walk.d.ts.map +1 -0
- package/dist/tree-walk.js +45 -0
- package/dist/tree-walk.js.map +1 -0
- package/genres.yaml +68 -0
- package/package.json +9 -3
- package/reference-headings.yaml +17 -0
- package/rules/acronym-expansion-conflict.yaml +82 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +47 -0
- package/rules/agreement-slip.yaml +14 -1
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +57 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +82 -0
- package/rules/assistant-residue.yaml +82 -0
- package/rules/bold-density.yaml +59 -0
- package/rules/bold-label-list.yaml +81 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +58 -0
- package/rules/colon-lead-in.yaml +83 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +88 -0
- package/rules/cushion-phrase-density.yaml +53 -1
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +54 -1
- package/rules/date-order.yaml +34 -1
- package/rules/date-range-reversed.yaml +46 -0
- package/rules/date-weekday-mismatch.yaml +17 -1
- package/rules/double-keigo.yaml +16 -0
- package/rules/double-negative.yaml +51 -0
- package/rules/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +18 -2
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/duplicate-heading.yaml +78 -0
- package/rules/emoji-density.yaml +28 -2
- package/rules/empty-conclusion.yaml +28 -0
- package/rules/empty-intensifier.yaml +44 -0
- package/rules/empty-section.yaml +74 -0
- package/rules/excessive-hedging.yaml +49 -2
- package/rules/expletive-construction.yaml +19 -0
- package/rules/fullwidth-alnum-consistency.yaml +53 -0
- package/rules/hankaku-kana.yaml +41 -0
- package/rules/heading-echo.yaml +31 -0
- package/rules/heading-level-skip.yaml +78 -0
- package/rules/hiragana-fukushi.yaml +16 -0
- package/rules/image-alt-text.yaml +54 -0
- package/rules/internal-jargon.yaml +21 -0
- package/rules/invisible-character.yaml +63 -0
- package/rules/katakana-long-vowel.yaml +99 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +30 -4
- package/rules/max-kanji-continuous.yaml +17 -0
- package/rules/max-paragraph-length.yaml +34 -0
- package/rules/max-sentence-length.yaml +58 -0
- package/rules/modal-conflict.yaml +106 -0
- package/rules/name-variant.yaml +88 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +17 -0
- package/rules/no-em-dash.yaml +49 -0
- package/rules/no-mixed-desumasu.yaml +28 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/nominalization.yaml +89 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/outside-announced-list.yaml +80 -0
- package/rules/oxford-comma-consistency.yaml +18 -0
- package/rules/padded-intro.yaml +44 -0
- package/rules/paragraph-length-variance.yaml +73 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +28 -0
- package/rules/proper-noun-density.yaml +37 -2
- package/rules/ra-nuki.yaml +43 -0
- package/rules/repeated-conjunction.yaml +47 -0
- package/rules/repeated-sentence-head.yaml +23 -0
- package/rules/required-sections.yaml +49 -0
- package/rules/requirement-modal.yaml +94 -0
- package/rules/requirement-smell.yaml +70 -0
- package/rules/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +143 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +113 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +51 -0
- package/rules/space-before-punctuation.yaml +41 -0
- package/rules/spelling-consistency.yaml +47 -0
- package/rules/stock-transition.yaml +86 -0
- package/rules/stray-space.yaml +18 -0
- package/rules/taigen-dome-in-prose.yaml +33 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +38 -1
- package/rules/unbalanced-bracket.yaml +56 -0
- package/rules/undefined-acronym.yaml +23 -0
- package/rules/unfilled-placeholder.yaml +50 -0
- package/rules/unqualified-superlative.yaml +20 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/unused-definition.yaml +75 -0
- package/rules/url-run-on.yaml +45 -0
- package/rules/use-before-definition.yaml +77 -0
- package/rules/vague-figure-reference.yaml +66 -0
- package/skills/chaff/SKILL.md +171 -1
- package/src/acronym-expansions.ts +106 -0
- package/src/announced-count.ts +190 -0
- package/src/announced-list.ts +120 -0
- package/src/api.ts +154 -0
- package/src/bare-url.ts +35 -0
- package/src/baseline.ts +17 -1
- package/src/body-section.ts +7 -0
- package/src/calendar-number.ts +18 -4
- package/src/cli-args.ts +6 -0
- package/src/cli-text.ts +14 -15
- package/src/cli.ts +93 -92
- package/src/closing-paragraph.ts +24 -0
- package/src/commands/compare.ts +73 -0
- package/src/commands/document-commands.ts +19 -0
- package/src/commands/eval.ts +22 -10
- package/src/commands/facts.ts +33 -0
- package/src/commands/feedback.ts +45 -7
- package/src/commands/fix-plan.ts +53 -0
- package/src/commands/outline.ts +49 -0
- package/src/commands/read-document.ts +24 -0
- package/src/commands/suppressions.ts +19 -0
- package/src/commands/test.ts +3 -5
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +89 -0
- package/src/compare/distinct.ts +13 -0
- package/src/compare/extract.ts +80 -0
- package/src/compare/fact-key.ts +31 -0
- package/src/compare/fact-text.ts +87 -0
- package/src/compare/facts-render.ts +63 -0
- package/src/compare/facts-text.ts +41 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +80 -0
- package/src/compare/proper-nouns.ts +65 -0
- package/src/compare/render.ts +102 -0
- package/src/compare/spans.ts +17 -0
- package/src/compare/text-atoms.ts +96 -0
- package/src/compare/text.ts +121 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +30 -0
- package/src/config/option-problems.ts +72 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +55 -0
- package/src/config/warnings.ts +13 -0
- package/src/config/write.ts +18 -4
- package/src/custom/bounded-match.ts +58 -0
- package/src/custom/load.ts +23 -0
- package/src/custom/module-path.ts +23 -0
- package/src/custom/parse.ts +323 -0
- package/src/custom/problems.ts +111 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect-language.ts +1 -1
- package/src/detect.ts +35 -2
- package/src/detectors/acronym-context.ts +16 -4
- package/src/detectors/ai-phrasing.ts +141 -0
- package/src/detectors/announced-count.ts +25 -0
- package/src/detectors/bold-label.ts +55 -0
- package/src/detectors/broken-link.ts +90 -0
- package/src/detectors/cited-name.ts +6 -5
- package/src/detectors/cited-title.ts +96 -0
- package/src/detectors/concrete-evidence.ts +3 -2
- package/src/detectors/contrast-frame.ts +54 -0
- package/src/detectors/custom.ts +89 -0
- package/src/detectors/dangling-figure.ts +26 -0
- package/src/detectors/definition-use.ts +41 -0
- package/src/detectors/doubled-punctuation.ts +52 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/duplicate-heading.ts +47 -0
- package/src/detectors/empty-section.ts +21 -0
- package/src/detectors/enumerated-runs.ts +13 -4
- package/src/detectors/fullwidth-alnum.ts +118 -0
- package/src/detectors/gram-furniture.ts +30 -0
- package/src/detectors/gram-place.ts +9 -5
- package/src/detectors/gram-windows.ts +31 -0
- package/src/detectors/hankaku-kana.ts +38 -0
- package/src/detectors/heading-case.ts +30 -2
- package/src/detectors/heading-code-words.ts +35 -0
- package/src/detectors/heading-echo.ts +8 -4
- package/src/detectors/heading-level-skip.ts +19 -0
- package/src/detectors/image-alt-text.ts +11 -0
- package/src/detectors/index.ts +79 -1
- package/src/detectors/invisible-character.ts +190 -0
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/lexicon-match.ts +41 -2
- package/src/detectors/lexicon.ts +40 -13
- package/src/detectors/list-item.ts +122 -0
- package/src/detectors/list-items.ts +163 -0
- package/src/detectors/list-lead-in.ts +33 -0
- package/src/detectors/list-sentence.ts +198 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +82 -0
- package/src/detectors/markup-finding.ts +39 -0
- package/src/detectors/modal-conflict.ts +26 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/name-variant.ts +15 -0
- package/src/detectors/nominalization.ts +73 -0
- package/src/detectors/orthography.ts +97 -41
- package/src/detectors/outside-announced-list.ts +25 -0
- package/src/detectors/oxford-comma.ts +179 -283
- package/src/detectors/phrase-match.ts +27 -7
- package/src/detectors/place-run.ts +7 -4
- package/src/detectors/placeholder-text.ts +27 -0
- package/src/detectors/quote-around.ts +9 -0
- package/src/detectors/ra-nuki.ts +38 -0
- package/src/detectors/register.ts +37 -10
- package/src/detectors/requirement-modal.ts +67 -0
- package/src/detectors/requirement-smell.ts +52 -0
- package/src/detectors/roman-numeral.ts +3 -0
- package/src/detectors/sentence-ending.ts +14 -7
- package/src/detectors/sentence-length.ts +16 -5
- package/src/detectors/signals.ts +80 -46
- package/src/detectors/space-before-punctuation.ts +32 -0
- package/src/detectors/spelling-variety.ts +81 -0
- package/src/detectors/structure-tree.ts +47 -1
- package/src/detectors/structure.ts +20 -7
- package/src/detectors/superlative-comparison.ts +47 -0
- package/src/detectors/superlative-name.ts +7 -4
- package/src/detectors/superlative-scope.ts +8 -3
- package/src/detectors/token-column.ts +149 -0
- package/src/detectors/unbalanced-bracket.ts +153 -0
- package/src/detectors/url-run-on.ts +33 -0
- package/src/detectors/vague-figure-pointer.ts +58 -0
- package/src/detectors/word-list.ts +6 -1
- package/src/document-sections.ts +46 -0
- package/src/document.ts +188 -173
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/extension/document-view.ts +109 -0
- package/src/extension/failure-text.ts +46 -0
- package/src/extension/import-default.ts +13 -0
- package/src/extension/load.ts +97 -0
- package/src/extension/module-detector.ts +61 -0
- package/src/extension/plugin-load.ts +82 -0
- package/src/extension/plugin-name.ts +26 -0
- package/src/extension/plugin-parse.ts +229 -0
- package/src/extension/problem-text.ts +103 -0
- package/src/extension/real-path.ts +10 -0
- package/src/extension/returned-findings.ts +62 -0
- package/src/extension/rule-export.ts +23 -0
- package/src/feedback/draft.ts +6 -0
- package/src/figure-references.ts +173 -0
- package/src/files.ts +5 -0
- package/src/finding-order.ts +3 -0
- package/src/fix-plan/mode.ts +34 -0
- package/src/fix-plan/plan.ts +181 -0
- package/src/fix-plan/render.ts +128 -0
- package/src/fix-plan/text.ts +133 -0
- package/src/heading-label.ts +55 -0
- package/src/in-page-nav.ts +48 -19
- package/src/joined-view.ts +1 -0
- package/src/language-sample.ts +48 -0
- package/src/levels.ts +14 -1
- package/src/line-paragraphs.ts +52 -9
- package/src/link-line.ts +13 -0
- package/src/long-vowel.ts +109 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +212 -0
- package/src/mask.ts +8 -8
- package/src/name-variants.ts +217 -0
- package/src/node-version.ts +22 -0
- package/src/not-run.ts +16 -0
- package/src/number-name.ts +151 -24
- package/src/orthography.ts +50 -14
- package/src/outline/render.ts +85 -0
- package/src/outline/shape.ts +72 -0
- package/src/outline/text.ts +50 -0
- package/src/page-furniture.ts +11 -2
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +120 -3
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +9 -3
- package/src/reasons.ts +12 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/compact.ts +13 -3
- package/src/render/explain.ts +75 -14
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +140 -18
- package/src/render/rules-table.ts +91 -0
- package/src/render/sarif.ts +4 -4
- package/src/render/semantic.ts +3 -3
- package/src/render/severity-name.ts +10 -0
- package/src/render/suppressions.ts +30 -2
- package/src/render/text.ts +21 -7
- package/src/resolve-genre.ts +4 -1
- package/src/rule-genres.ts +25 -0
- package/src/rule-guide.ts +173 -0
- package/src/rule-load.ts +91 -34
- package/src/rule-options.ts +131 -0
- package/src/run-semantic.ts +2 -1
- package/src/run.ts +105 -22
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +9 -1
- package/src/spacing-minority.ts +27 -0
- package/src/span-cut.ts +28 -0
- package/src/stet-block.ts +60 -0
- package/src/stet.ts +41 -15
- package/src/structure/aside-depth.ts +67 -0
- package/src/structure/build.ts +38 -19
- package/src/structure/closed-pairs.ts +20 -0
- package/src/structure/date-range.ts +117 -0
- package/src/structure/definition-use.ts +130 -0
- package/src/structure/known-mentions.ts +96 -0
- package/src/structure/lazy-tree.ts +15 -0
- package/src/structure/modal-conflict.ts +86 -0
- package/src/structure/numbered-clauses.ts +11 -0
- package/src/structure/numbering.ts +9 -5
- package/src/structure/of.ts +11 -3
- package/src/structure/percent-sum.ts +135 -0
- package/src/structure/quoted-number.ts +36 -0
- package/src/structure/relative-find.ts +34 -47
- package/src/structure/relative-resolve.ts +77 -30
- package/src/structure/runs.ts +2 -2
- package/src/structure/sexp.ts +17 -5
- package/src/structure/total.ts +2 -2
- package/src/structure/universal.ts +33 -5
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +112 -0
- package/src/subheading-line.ts +106 -0
- package/src/tag-coverage.ts +13 -0
- package/src/template-syntax.ts +164 -0
- package/src/text-above.ts +49 -0
- package/src/text-figures.ts +147 -0
- package/src/trailing-aside.ts +50 -0
- package/src/tree-walk.ts +48 -0
- package/styles/bunkacho.yaml +25 -0
- package/styles/ieice.yaml +30 -0
- package/styles/jis-z8301-2011.yaml +28 -0
- package/styles/jis-z8301-2019.yaml +31 -0
- package/styles/koyobun.yaml +35 -0
- package/dist/legal-address.d.ts +0 -2
- package/dist/legal-address.d.ts.map +0 -1
- package/dist/legal-address.js +0 -16
- package/dist/legal-address.js.map +0 -1
package/src/run.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DETECTORS } from "./detectors/index.ts";
|
|
2
|
-
import { resolve } from "./levels.ts";
|
|
3
|
-
import type { AdapterNeeds, Finding, Level, ProseDocument, RuleDefinition } from "./plugin.ts";
|
|
2
|
+
import { resolve, severityAt } from "./levels.ts";
|
|
3
|
+
import type { AdapterNeeds, Detector, DetectorOptions, Finding, Level, ProseDocument, RuleDefinition } from "./plugin.ts";
|
|
4
4
|
import { lineStarts, placeOf } from "./position.ts";
|
|
5
5
|
import { REASONS, type Reasons } from "./reasons.ts";
|
|
6
6
|
import { joinWords } from "./detectors/word-list.ts";
|
|
@@ -11,8 +11,20 @@ import { maskSpans } from "./mask.ts";
|
|
|
11
11
|
import { textOutline } from "./page-furniture.ts";
|
|
12
12
|
import { uiLanguageOf } from "./ui.ts";
|
|
13
13
|
import { presetLevels } from "./genre-load.ts";
|
|
14
|
+
import { bodySectionOf } from "./body-section.ts";
|
|
15
|
+
import { optionValues, settleOptions, type OptionLayer } from "./rule-options.ts";
|
|
16
|
+
import { byPosition } from "./finding-order.ts";
|
|
17
|
+
import { PatternTimeout } from "./custom/bounded-match.ts";
|
|
18
|
+
import { PluginRuleFailure } from "./extension/module-detector.ts";
|
|
19
|
+
import { failureReason } from "./extension/failure-text.ts";
|
|
20
|
+
import { tagCoverage } from "./tag-coverage.ts";
|
|
14
21
|
|
|
15
|
-
export type Skipped = {
|
|
22
|
+
export type Skipped = {
|
|
23
|
+
readonly rule: string;
|
|
24
|
+
readonly why: string;
|
|
25
|
+
/** Off only because it is experimental: --experimental (or chaff.yaml's experimental) would run it. */
|
|
26
|
+
readonly offUntilExperimental?: true;
|
|
27
|
+
};
|
|
16
28
|
|
|
17
29
|
export type RunResult = {
|
|
18
30
|
readonly findings: readonly Finding[];
|
|
@@ -37,9 +49,10 @@ const levelFor = (rule: RuleDefinition, settings: Settings, experimental: boolea
|
|
|
37
49
|
};
|
|
38
50
|
|
|
39
51
|
/** Why a rule at off did not run: chaff.yaml turned it off, the genre's preset did, or it is experimental. */
|
|
40
|
-
const
|
|
41
|
-
if (settings[rule.id] !== undefined) return reasons.turnedOff;
|
|
42
|
-
|
|
52
|
+
const offSkip = (rule: RuleDefinition, settings: Settings, preset: Settings, genre: string, reasons: Reasons): Skipped => {
|
|
53
|
+
if (settings[rule.id] !== undefined) return { rule: rule.id, why: reasons.turnedOff };
|
|
54
|
+
if (preset[rule.id] !== undefined) return { rule: rule.id, why: reasons.presetOff(genre) };
|
|
55
|
+
return { rule: rule.id, why: reasons.experimental, offUntilExperimental: true };
|
|
43
56
|
};
|
|
44
57
|
|
|
45
58
|
const reasonsFor = (doc: ProseDocument): Reasons => REASONS[uiLanguageOf(doc.language)];
|
|
@@ -68,7 +81,7 @@ const treeProblem = (doc: ProseDocument): string | undefined => {
|
|
|
68
81
|
|
|
69
82
|
/** 木が読んだのと同じ本文。Markdown はコードを覆ったもの、.txt はページの飾りだけを覆ったもの(.txt の字下げはコードではない)。 */
|
|
70
83
|
const textTheTreeRead = (doc: ProseDocument): string =>
|
|
71
|
-
isMarkdownPath(doc.path) ? (doc.prose ?? doc.source) : maskSpans(doc.source, textOutline(doc.source).opaque);
|
|
84
|
+
isMarkdownPath(doc.path) ? (doc.prose ?? doc.source) : maskSpans(doc.source, textOutline(doc.source, doc.replyQuotes).opaque);
|
|
72
85
|
|
|
73
86
|
const unreadByDocument = new WeakMap<ProseDocument, Unread | undefined>();
|
|
74
87
|
|
|
@@ -78,6 +91,15 @@ const unreadOf = (doc: ProseDocument): Unread | undefined => {
|
|
|
78
91
|
return unreadByDocument.get(doc);
|
|
79
92
|
};
|
|
80
93
|
|
|
94
|
+
/** 見出しを読む rule の要求。表題より下の見出しが無い文書では、本題の前を測れない。0 件を「前置きが短い」に見せない。 */
|
|
95
|
+
/** 記法を読む rule の要求(markdown)。.txt には見出しの記法も画像もリンクの記法も無いので、0 件を「問題なし」に見せない。 */
|
|
96
|
+
const DOCUMENT_NEEDS: ReadonlySet<string> = new Set(["headings", "markdown"]);
|
|
97
|
+
|
|
98
|
+
const documentNeed = (rule: RuleDefinition, doc: ProseDocument): string | undefined => {
|
|
99
|
+
if (rule.requires.includes("markdown") && !isMarkdownPath(doc.path)) return reasonsFor(doc).notMarkdown;
|
|
100
|
+
return rule.requires.includes("headings") && bodySectionOf(doc.sections) === undefined ? reasonsFor(doc).noHeadings : undefined;
|
|
101
|
+
};
|
|
102
|
+
|
|
81
103
|
/** 知らない要求は満たされていないものとして扱う。黙って無視すると、要求なしで動いてしまう。 */
|
|
82
104
|
const has = (capabilities: ProseDocument["capabilities"], need: string): boolean => {
|
|
83
105
|
if (need === "pos") return capabilities.pos;
|
|
@@ -90,14 +112,18 @@ const has = (capabilities: ProseDocument["capabilities"], need: string): boolean
|
|
|
90
112
|
*
|
|
91
113
|
* `capabilities.pos: true` と言いながら token を返さないアダプタでも、rule は
|
|
92
114
|
* `sentence.tokens ?? []` を見るので**例外にならず、指摘 0 件で終わる**。
|
|
93
|
-
* 0
|
|
115
|
+
* 0 件は「問題なし」と見分けがつかない。一部の文にだけ token が無いとき(解析器が読めなかった段落)も、その段落の 0 件が同じく保証に見える。
|
|
94
116
|
*/
|
|
95
|
-
const
|
|
117
|
+
const tagReason = (doc: ProseDocument): string | undefined => {
|
|
118
|
+
const coverage = tagCoverage(doc.sentences);
|
|
119
|
+
if (coverage === "all") return undefined;
|
|
120
|
+
return coverage === "none" ? reasonsFor(doc).noTags : reasonsFor(doc).unreadTags;
|
|
121
|
+
};
|
|
96
122
|
|
|
97
123
|
/** 要求を満たさない rule は動かせない。満たさないまま動かすと「指摘 0 件」が保証に見える。 */
|
|
98
124
|
const unmet = (rule: RuleDefinition, doc: ProseDocument): string | undefined => {
|
|
99
125
|
if (rule.languages !== undefined && !rule.languages.includes(doc.language)) return reasonsFor(doc).otherLanguage(doc.language);
|
|
100
|
-
const missing = rule.requires.filter((need) => !TREE_NEEDS.has(need)).find((need) => !has(doc.capabilities, need));
|
|
126
|
+
const missing = rule.requires.filter((need) => !TREE_NEEDS.has(need) && !DOCUMENT_NEEDS.has(need)).find((need) => !has(doc.capabilities, need));
|
|
101
127
|
if (missing !== undefined) return reasonsFor(doc).noCapability(missing);
|
|
102
128
|
return undefined;
|
|
103
129
|
};
|
|
@@ -107,7 +133,7 @@ const unmet = (rule: RuleDefinition, doc: ProseDocument): string | undefined =>
|
|
|
107
133
|
* 先に聞くと、止めている rule まで「アダプタが品詞を返さなかった」と、違う理由で出る。
|
|
108
134
|
*/
|
|
109
135
|
const untagged = (rule: RuleDefinition, doc: ProseDocument): string | undefined =>
|
|
110
|
-
rule.requires.some((need) => need === "pos" || need === "lemma")
|
|
136
|
+
rule.requires.some((need) => need === "pos" || need === "lemma") ? tagReason(doc) : undefined;
|
|
111
137
|
|
|
112
138
|
const forGenre = (rules: readonly RuleDefinition[], genre: string): RuleDefinition[] =>
|
|
113
139
|
rules.filter((rule) => rule.use_for.some((target) => genre.startsWith(target)));
|
|
@@ -119,12 +145,34 @@ export const wantsTags = (rule: RuleDefinition): boolean => [...rule.requires, .
|
|
|
119
145
|
* 解析器の初期化に払う代金を決める。動く rule が 1 本も要求しないなら読み込まない。
|
|
120
146
|
* capabilities は「払えばできる」の宣言なので、ここでは見ない。
|
|
121
147
|
*/
|
|
122
|
-
export const neededBy = (rules: readonly RuleDefinition[], settings: Settings, experimental: boolean, genre: string, language: string): AdapterNeeds =>
|
|
123
|
-
|
|
148
|
+
export const neededBy = (rules: readonly RuleDefinition[], settings: Settings, experimental: boolean, genre: string, language: string): AdapterNeeds => {
|
|
149
|
+
const running = forGenre(rules, genre)
|
|
124
150
|
.filter((rule) => rule.layer !== "L4" && levelFor(rule, settings, experimental, presetLevels(genre)) !== "off")
|
|
125
|
-
.filter((rule) => rule.languages === undefined || rule.languages.includes(language))
|
|
126
|
-
|
|
127
|
-
}
|
|
151
|
+
.filter((rule) => rule.languages === undefined || rule.languages.includes(language));
|
|
152
|
+
return { pos: running.some(wantsTags), features: tokenFeaturesOf(running) };
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/** The token features the rules read (RuleDefinition.token_features), each once. */
|
|
156
|
+
export const tokenFeaturesOf = (rules: readonly RuleDefinition[]): string[] => [...new Set(rules.flatMap((rule) => rule.token_features ?? []))];
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A detector's findings, or why the rule did not run: a team's pattern stopped at its time limit (bounded-match.ts), or a
|
|
160
|
+
* plugin's detector that threw or returned something else than findings (module-detector.ts). Other errors are chaff's
|
|
161
|
+
* bugs and propagate.
|
|
162
|
+
*/
|
|
163
|
+
const runDetector = (
|
|
164
|
+
detector: Detector,
|
|
165
|
+
doc: ProseDocument,
|
|
166
|
+
options: DetectorOptions,
|
|
167
|
+
): { readonly findings: readonly Finding[] } | { readonly notRun: string } => {
|
|
168
|
+
try {
|
|
169
|
+
return { findings: detector(doc, options) };
|
|
170
|
+
} catch (error) {
|
|
171
|
+
if (error instanceof PatternTimeout) return { notRun: reasonsFor(doc).patternTimeout(error.budget_ms) };
|
|
172
|
+
if (error instanceof PluginRuleFailure) return { notRun: failureReason(error.origin, error.failure, uiLanguageOf(doc.language)) };
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
128
176
|
|
|
129
177
|
const place = (starts: readonly number[], finding: Finding): Finding => {
|
|
130
178
|
const offset = finding.values["offset"];
|
|
@@ -160,6 +208,31 @@ export type Limits = Readonly<Record<string, number>>;
|
|
|
160
208
|
|
|
161
209
|
const limitFor = (rule: RuleDefinition, level: Level, genre: string, limits: Limits): number => limits[rule.id] ?? resolve(rule, level, genre).limit;
|
|
162
210
|
|
|
211
|
+
/** 文書と違う言語で書いた文の上限。chaff.yaml の数値は文書の言語の単位で書いたものなので、ここには効かせない。 */
|
|
212
|
+
const embeddedLimitsFor = (rule: RuleDefinition, level: Level, genre: string, embedded: readonly string[]): Record<string, number> =>
|
|
213
|
+
Object.fromEntries(
|
|
214
|
+
embedded.flatMap((language) => {
|
|
215
|
+
const tables = rule.other_languages?.[language];
|
|
216
|
+
return tables === undefined ? [] : [[language, resolve({ ...rule, ...tables }, level, genre).limit] as const];
|
|
217
|
+
}),
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const embeddedLanguagesOf = (doc: ProseDocument): string[] => [
|
|
221
|
+
...new Set(doc.sentences.flatMap((sentence) => (sentence.embeddedLanguage === undefined ? [] : [sentence.embeddedLanguage.id]))),
|
|
222
|
+
];
|
|
223
|
+
|
|
224
|
+
/** What a run is set to: the levels chaff.yaml names, whether experimental rules run, the genre, and the numbers and options set. */
|
|
225
|
+
export type RunContext = {
|
|
226
|
+
readonly settings: Settings;
|
|
227
|
+
readonly experimental: boolean;
|
|
228
|
+
readonly genre: string;
|
|
229
|
+
readonly limits?: Limits;
|
|
230
|
+
/** Where rule options come from, strongest first (chaff.yaml). An option no layer sets is at its default. */
|
|
231
|
+
readonly optionLayers?: readonly OptionLayer[];
|
|
232
|
+
/** The detectors loaded from the code chaff.yaml names, by rule id. They come before chaff's own table. */
|
|
233
|
+
readonly detectors?: Readonly<Record<string, Detector>>;
|
|
234
|
+
};
|
|
235
|
+
|
|
163
236
|
export const runRules = (
|
|
164
237
|
doc: ProseDocument,
|
|
165
238
|
rules: readonly RuleDefinition[],
|
|
@@ -167,10 +240,14 @@ export const runRules = (
|
|
|
167
240
|
experimental: boolean,
|
|
168
241
|
genre: string,
|
|
169
242
|
limits: Limits = {},
|
|
170
|
-
): RunResult => {
|
|
243
|
+
): RunResult => runRulesWith(doc, rules, { settings, experimental, genre, limits });
|
|
244
|
+
|
|
245
|
+
export const runRulesWith = (doc: ProseDocument, rules: readonly RuleDefinition[], context: RunContext): RunResult => {
|
|
246
|
+
const { settings, experimental, genre, limits = {}, optionLayers = [], detectors = {} } = context;
|
|
171
247
|
const preset = presetLevels(genre);
|
|
172
248
|
const starts = lineStarts(doc.source);
|
|
173
249
|
const applicable = forGenre(rules, genre);
|
|
250
|
+
const embedded = embeddedLanguagesOf(doc);
|
|
174
251
|
const experimentalOn = applicable.filter((rule) => rule.status === "experimental" && levelFor(rule, settings, experimental, preset) !== "off");
|
|
175
252
|
const forced = experimentalOn.filter((rule) => settings[rule.id] !== undefined).map((rule) => rule.id);
|
|
176
253
|
const presetOn = experimentalOn.filter((rule) => settings[rule.id] === undefined && preset[rule.id] !== undefined).map((rule) => rule.id);
|
|
@@ -183,17 +260,18 @@ export const runRules = (
|
|
|
183
260
|
const blocked = unmet(rule, doc);
|
|
184
261
|
if (blocked !== undefined) return { findings: acc.findings, skipped: [...acc.skipped, { rule: rule.id, why: blocked }] };
|
|
185
262
|
const level = levelFor(rule, settings, experimental, preset);
|
|
186
|
-
if (level === "off")
|
|
187
|
-
return { findings: acc.findings, skipped: [...acc.skipped, { rule: rule.id, why: offReason(rule, settings, preset, genre, reasonsFor(doc)) }] };
|
|
263
|
+
if (level === "off") return { findings: acc.findings, skipped: [...acc.skipped, offSkip(rule, settings, preset, genre, reasonsFor(doc))] };
|
|
188
264
|
const noTags = untagged(rule, doc);
|
|
189
265
|
if (noTags !== undefined) return { findings: acc.findings, skipped: [...acc.skipped, { rule: rule.id, why: noTags }] };
|
|
190
266
|
// 木は capability ではなく、adapter が structure を持つかで決まる。持たない言語で動かすと「参照先が無い」が 0 件に見える。
|
|
191
267
|
// 段階を見た後で聞く。doc.structure は触れたときに木を作るので、止めている rule のために作らない。
|
|
192
268
|
const noTree = treeNeed(rule, doc);
|
|
193
269
|
if (noTree !== undefined) return { findings: acc.findings, skipped: [...acc.skipped, { rule: rule.id, why: noTree }] };
|
|
270
|
+
const noDocumentNeed = documentNeed(rule, doc);
|
|
271
|
+
if (noDocumentNeed !== undefined) return { findings: acc.findings, skipped: [...acc.skipped, { rule: rule.id, why: noDocumentNeed }] };
|
|
194
272
|
// 複合シグナルは二段目で扱う。一段目では「検出器が無い」と言わせない。
|
|
195
273
|
if (rule.from.length > 0) return acc;
|
|
196
|
-
const detector = DETECTORS[rule.how_to_find];
|
|
274
|
+
const detector = detectors[rule.id] ?? DETECTORS[rule.how_to_find];
|
|
197
275
|
if (detector === undefined)
|
|
198
276
|
return { findings: acc.findings, skipped: [...acc.skipped, { rule: rule.id, why: reasonsFor(doc).noDetector(rule.how_to_find) }] };
|
|
199
277
|
// 語彙表を要求する rule で、その言語に語彙表が無ければ動かせない。黙って通さない。
|
|
@@ -205,8 +283,13 @@ export const runRules = (
|
|
|
205
283
|
lexicon: rule.word_list === undefined ? undefined : doc.lexicons[rule.word_list],
|
|
206
284
|
where: rule.where,
|
|
207
285
|
fullSentence: rule.full_sentence,
|
|
286
|
+
embeddedLimits: embeddedLimitsFor(rule, level, genre, embedded),
|
|
287
|
+
...(rule.options === undefined ? {} : { settings: optionValues(settleOptions(rule.id, rule.options, optionLayers)) }),
|
|
288
|
+
...(rule.custom === undefined ? {} : { custom: rule.custom }),
|
|
208
289
|
};
|
|
209
|
-
const
|
|
290
|
+
const ran = runDetector(detector, doc, options);
|
|
291
|
+
if ("notRun" in ran) return { findings: acc.findings, skipped: [...acc.skipped, { rule: rule.id, why: ran.notRun }] };
|
|
292
|
+
const found = ran.findings.map((finding) => place(starts, { ...finding, rule: rule.id, severity: severityAt(rule, level, genre) }));
|
|
210
293
|
return { findings: [...acc.findings, ...found], skipped: acc.skipped };
|
|
211
294
|
},
|
|
212
295
|
{ findings: [], skipped: [] },
|
|
@@ -217,5 +300,5 @@ export const runRules = (
|
|
|
217
300
|
compositeOf(rule, outcome.findings, limitFor(rule, levelFor(rule, settings, experimental, preset), genre, limits), starts, doc.language),
|
|
218
301
|
);
|
|
219
302
|
const all = [...outcome.findings, ...composites];
|
|
220
|
-
return { ...outcome, findings: all.toSorted(
|
|
303
|
+
return { ...outcome, findings: all.toSorted(byPosition), forcedExperimental: forced, presetExperimental: presetOn };
|
|
221
304
|
};
|
package/src/sentence-shape.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Sentence, Token } from "./plugin.ts";
|
|
2
|
+
import { ownEnd } from "./trailing-aside.ts";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 「これは文か」の判定を 1 箇所に置く。
|
|
@@ -21,13 +22,11 @@ const SKIP = new Set(["PUNCT", "PART", "SYM"]);
|
|
|
21
22
|
* 「これを最優先制約とする(§17)。」の述語は「とする」であって「17」ではない。
|
|
22
23
|
* 仕様書は相互参照を括弧で添えるので、これを数えると文末が全部そこになる。
|
|
23
24
|
*/
|
|
24
|
-
const TRAILING = /[((][^((]*[))][\s。.!?!?]*$/u;
|
|
25
|
-
|
|
26
25
|
const beforeTrailing = (sentence: Sentence): readonly Token[] => {
|
|
27
26
|
const tokens = sentence.tokens ?? [];
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const cut = sentence.span.start +
|
|
27
|
+
const end = ownEnd(sentence.text);
|
|
28
|
+
if (end === sentence.text.length) return tokens;
|
|
29
|
+
const cut = sentence.span.start + end;
|
|
31
30
|
const kept = tokens.filter((token) => token.span.end <= cut);
|
|
32
31
|
// 括弧を外したら何も残らない文は、括弧そのものが中身。そのまま見る。
|
|
33
32
|
return kept.length === 0 ? tokens : kept;
|
package/src/setting-problems.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Config } from "./config/load.ts";
|
|
2
2
|
import type { CliText } from "./cli-text.ts";
|
|
3
|
+
import type { UiLanguage } from "./ui.ts";
|
|
4
|
+
import { styleProblems } from "./config/style.ts";
|
|
5
|
+
import { loadStyles } from "./style-load.ts";
|
|
6
|
+
import { customRuleProblems } from "./custom/problems.ts";
|
|
7
|
+
import { extensionProblems } from "./extension/problem-text.ts";
|
|
3
8
|
import { GENRES } from "./genre.ts";
|
|
4
9
|
import { unknownGenres, writtenGenres } from "./genre-check.ts";
|
|
5
10
|
import { loadProfiles } from "./profile/load.ts";
|
|
@@ -18,7 +23,10 @@ const profileProblems = (command: string, config: Config, text: CliText): string
|
|
|
18
23
|
};
|
|
19
24
|
|
|
20
25
|
/** Settings that name something chaff does not have. Each would silently check less than was asked, so the run stops on them. */
|
|
21
|
-
export const settingProblems = (command: string, genreFlag: string | undefined, config: Config, text: CliText): string[] => [
|
|
26
|
+
export const settingProblems = (command: string, genreFlag: string | undefined, config: Config, text: CliText, ui: UiLanguage = "en"): string[] => [
|
|
22
27
|
...genreProblems(command, genreFlag, config, text),
|
|
23
28
|
...profileProblems(command, config, text),
|
|
29
|
+
...styleProblems(config, [...loadStyles(), ...(config.extensions?.styles ?? [])], ui),
|
|
30
|
+
...customRuleProblems(config, ui),
|
|
31
|
+
...extensionProblems(config, ui),
|
|
24
32
|
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { minorityStyle } from "./orthography.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 少ないほうがこの割合を超えると、書き損じではなく、書き方が二通りある文書と読む。1 箇所ずつ「違う」と指すと、
|
|
5
|
+
* 半々に近い文書でどちらかの側に立つことになる。そのときは 1 件にまとめて、両方の数を言う。
|
|
6
|
+
*/
|
|
7
|
+
const MIXED_SHARE = 0.2;
|
|
8
|
+
|
|
9
|
+
/** 割合が大きくても、これより少なければ 1 箇所ずつ言う。3 箇所のうち 1 箇所なら、その 1 箇所を見せるほうが早い。 */
|
|
10
|
+
const MIN_MIXED = 5;
|
|
11
|
+
|
|
12
|
+
/** each は少ないほうを 1 箇所ずつ、mixed は文書に書き方が二通りあることを 1 件で。first は少ないほうの最初の箇所。 */
|
|
13
|
+
export type MinorityReport<T> =
|
|
14
|
+
| { readonly mode: "each"; readonly odd: readonly T[] }
|
|
15
|
+
| { readonly mode: "mixed"; readonly first: T; readonly odd: number; readonly spaced: number; readonly touching: number };
|
|
16
|
+
|
|
17
|
+
/** 一つの種類の境目から、何をどう言うか。混ざっていない、または少ないほうが limit に届かなければ言わない。 */
|
|
18
|
+
export const minorityReport = <T extends { readonly spaced: boolean }>(ofKind: readonly T[], limit: number): MinorityReport<T> | undefined => {
|
|
19
|
+
const minority = minorityStyle(ofKind);
|
|
20
|
+
if (minority === undefined) return undefined;
|
|
21
|
+
const odd = ofKind.filter((entry) => entry.spaced === minority);
|
|
22
|
+
const first = odd[0];
|
|
23
|
+
if (first === undefined || odd.length < limit) return undefined;
|
|
24
|
+
if (odd.length < MIN_MIXED || odd.length <= ofKind.length * MIXED_SHARE) return { mode: "each", odd };
|
|
25
|
+
const spaced = ofKind.filter((entry) => entry.spaced).length;
|
|
26
|
+
return { mode: "mixed", first, odd: odd.length, spaced, touching: ofKind.length - spaced };
|
|
27
|
+
};
|
package/src/span-cut.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Span } from "./plugin.ts";
|
|
2
|
+
import { mergeSpans } from "./span-merge.ts";
|
|
3
|
+
import { firstEndingAfter } from "./soft-break.ts";
|
|
4
|
+
|
|
5
|
+
const piecesOutside = (span: Span, sortedCuts: readonly Span[]): Span[] => {
|
|
6
|
+
const overlapping = sortedCuts
|
|
7
|
+
.slice(firstEndingAfter(sortedCuts, span.start), firstEndingAfter(sortedCuts, span.end) + 1)
|
|
8
|
+
.filter((cut) => cut.start < span.end);
|
|
9
|
+
const { pieces, cursor } = overlapping.reduce<{ pieces: Span[]; cursor: number }>(
|
|
10
|
+
(acc, cut) => ({
|
|
11
|
+
pieces: cut.start > acc.cursor ? [...acc.pieces, { start: acc.cursor, end: cut.start }] : acc.pieces,
|
|
12
|
+
cursor: Math.max(acc.cursor, cut.end),
|
|
13
|
+
}),
|
|
14
|
+
{ pieces: [], cursor: span.start },
|
|
15
|
+
);
|
|
16
|
+
return cursor < span.end ? [...pieces, { start: cursor, end: span.end }] : pieces;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** The parts of each span that no cut covers, in order. Cuts may overlap one another and come in any order. */
|
|
20
|
+
export const cutSpans = (spans: readonly Span[], cuts: readonly Span[]): Span[] => {
|
|
21
|
+
if (cuts.length === 0) return [...spans];
|
|
22
|
+
const sortedCuts = mergeSpans(cuts, true);
|
|
23
|
+
return spans.flatMap((span) => piecesOutside(span, sortedCuts));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** cutSpans, less the pieces of `source` that hold only white space. */
|
|
27
|
+
export const cutTextSpans = (spans: readonly Span[], cuts: readonly Span[], source: string): Span[] =>
|
|
28
|
+
cuts.length === 0 ? [...spans] : cutSpans(spans, cuts).filter((piece) => source.slice(piece.start, piece.end).trim() !== "");
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { spanOf, type MarkdownNode } from "./markdown-node.ts";
|
|
2
|
+
import type { Span } from "./plugin.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Where a `<!-- stet: … -->` (scope next) stops: the end of the block right after the comment, as the Markdown parser
|
|
6
|
+
* reads it — a paragraph, a heading, a whole list, a table, a code block, a quote. Inside a list item, the item's next
|
|
7
|
+
* block. Plain text reads the same way: its paragraphs are the runs between blank lines.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Containers whose children are blocks. Anywhere else, an HTML comment sits inside a paragraph or a heading. */
|
|
11
|
+
const BLOCK_CONTAINERS: ReadonlySet<string> = new Set(["root", "listItem", "blockquote"]);
|
|
12
|
+
|
|
13
|
+
type Holder = { readonly parent: MarkdownNode; readonly index: number };
|
|
14
|
+
|
|
15
|
+
/** The child holding `offset`, or -1. Binary search: siblings are in source order, and a document can hold thousands of stets. */
|
|
16
|
+
const childHolding = (children: readonly MarkdownNode[], offset: number): number => {
|
|
17
|
+
let low = 0;
|
|
18
|
+
let high = children.length - 1;
|
|
19
|
+
while (low <= high) {
|
|
20
|
+
const middle = (low + high) >> 1;
|
|
21
|
+
const span = spanOf(children[middle] ?? { type: "" });
|
|
22
|
+
if (span === undefined) return -1;
|
|
23
|
+
if (offset < span.start) high = middle - 1;
|
|
24
|
+
else if (offset >= span.end) low = middle + 1;
|
|
25
|
+
else return middle;
|
|
26
|
+
}
|
|
27
|
+
return -1;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** The deepest node holding `offset`, as its parent and its place among the parent's children. A loop: quotes nest without limit. */
|
|
31
|
+
const holderOf = (root: MarkdownNode, offset: number): Holder | undefined => {
|
|
32
|
+
let found: Holder | undefined;
|
|
33
|
+
let parent: MarkdownNode | undefined = root;
|
|
34
|
+
while (parent !== undefined) {
|
|
35
|
+
const children: readonly MarkdownNode[] = parent.children ?? [];
|
|
36
|
+
const index = childHolding(children, offset);
|
|
37
|
+
if (index !== -1) found = { parent, index };
|
|
38
|
+
parent = children[index];
|
|
39
|
+
}
|
|
40
|
+
return found;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** The node a stet covers: the next block when the comment stands alone, else the block the comment is part of. */
|
|
44
|
+
const coveredNode = (source: string, holder: Holder, comment: Span): MarkdownNode | undefined => {
|
|
45
|
+
const siblings = holder.parent.children ?? [];
|
|
46
|
+
const node = siblings[holder.index];
|
|
47
|
+
if (node === undefined) return undefined;
|
|
48
|
+
if (!BLOCK_CONTAINERS.has(holder.parent.type)) return holder.parent;
|
|
49
|
+
const span = spanOf(node);
|
|
50
|
+
const alone = span !== undefined && source.slice(span.start, span.end).trim() === source.slice(comment.start, comment.end);
|
|
51
|
+
return alone ? siblings[holder.index + 1] : node;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** The last line a `stet` (scope next) covers, for the comment at `comment` in a document parsed as `root`. */
|
|
55
|
+
export const stetBlockEnd = (source: string, root: MarkdownNode, comment: Span, lineAt: (offset: number) => number): number => {
|
|
56
|
+
const holder = holderOf(root, comment.start);
|
|
57
|
+
const covered = holder === undefined ? undefined : coveredNode(source, holder, comment);
|
|
58
|
+
const end = covered === undefined ? undefined : spanOf(covered)?.end;
|
|
59
|
+
return lineAt(end ?? comment.end);
|
|
60
|
+
};
|
package/src/stet.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { Finding, Span } from "./plugin.ts";
|
|
2
|
+
import { RULE_ID } from "./extension/plugin-name.ts";
|
|
3
|
+
import { stetBlockEnd } from "./stet-block.ts";
|
|
4
|
+
import { lineStarts, placeOf } from "./position.ts";
|
|
5
|
+
import { parse } from "./markdown-read.ts";
|
|
2
6
|
|
|
3
7
|
export type Suppression = {
|
|
4
8
|
readonly rules: readonly string[];
|
|
5
9
|
readonly reason: string | undefined;
|
|
6
10
|
readonly line: number;
|
|
11
|
+
/** The last line a `stet` (scope next) covers: the end of the block right below the comment. Other scopes: the comment's last line. */
|
|
12
|
+
readonly blockEnd: number;
|
|
7
13
|
readonly scope: "next" | "section" | "file";
|
|
8
14
|
};
|
|
9
15
|
|
|
@@ -23,10 +29,6 @@ const SCOPE: Readonly<Record<string, Suppression["scope"]>> = { stet: "next", "s
|
|
|
23
29
|
/** 理由は em dash のあと。書かなくてもよいが、書かないと chaff suppressions に並ぶ。 */
|
|
24
30
|
const REASON_MARK = "\u2014";
|
|
25
31
|
|
|
26
|
-
const RULE_ID = /^[a-z][a-z0-9-]*$/u;
|
|
27
|
-
|
|
28
|
-
const lineOf = (source: string, offset: number): number => source.slice(0, offset).split("\n").length;
|
|
29
|
-
|
|
30
32
|
const splitBody = (body: string): { rules: string[]; reason: string | undefined } => {
|
|
31
33
|
const at = body.indexOf(REASON_MARK);
|
|
32
34
|
const head = at === -1 ? body : body.slice(0, at);
|
|
@@ -43,37 +45,61 @@ const splitBody = (body: string): { rules: string[]; reason: string | undefined
|
|
|
43
45
|
};
|
|
44
46
|
};
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const scopeOf = (match: RegExpMatchArray): Suppression["scope"] => SCOPE[match[1] ?? "stet"] ?? "next";
|
|
49
|
+
|
|
50
|
+
/** 1-based line of an offset, from a table built once: a document can hold thousands of stets. */
|
|
51
|
+
const lineFinder = (source: string): ((offset: number) => number) => {
|
|
52
|
+
const starts = lineStarts(source);
|
|
53
|
+
return (offset) => placeOf(starts, offset).line;
|
|
54
|
+
};
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
const
|
|
56
|
+
export const parseSuppressions = (source: string): Suppression[] => {
|
|
57
|
+
const matches = [...source.matchAll(PATTERN)];
|
|
58
|
+
const lineAt = lineFinder(source);
|
|
59
|
+
// Only a plain stet needs the tree, to find the block it stops at; a stet-file alone does not pay for a parse.
|
|
60
|
+
const root = matches.some((match) => scopeOf(match) === "next") ? parse(source) : undefined;
|
|
61
|
+
return matches.map((match) => {
|
|
62
|
+
const comment = { start: match.index, end: match.index + match[0].length };
|
|
63
|
+
const scope = scopeOf(match);
|
|
64
|
+
return {
|
|
65
|
+
...splitBody(match[2] ?? ""),
|
|
66
|
+
line: lineAt(match.index),
|
|
67
|
+
blockEnd: root !== undefined && scope === "next" ? stetBlockEnd(source, root, comment, lineAt) : lineAt(comment.end),
|
|
68
|
+
scope,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
};
|
|
55
72
|
|
|
73
|
+
/** stet が効く範囲。next は直後の塊(段落・見出し・箇条書き・表)の終わりまで、section は次の見出しまで、file は全体。 */
|
|
56
74
|
const covers = (suppression: Suppression, finding: Finding, sectionEnds: readonly number[], lastLine: number): boolean => {
|
|
57
75
|
if (!suppression.rules.includes(finding.rule)) return false;
|
|
58
76
|
if (suppression.scope === "file") return true;
|
|
59
77
|
// 抑制は「この先の箇所」に対して書く。遡って効くと、意図せず黙る範囲が広がる。
|
|
60
78
|
if (finding.line < suppression.line) return false;
|
|
61
|
-
if (suppression.scope === "next") return finding.line
|
|
79
|
+
if (suppression.scope === "next") return finding.line <= suppression.blockEnd;
|
|
62
80
|
return finding.line <= (sectionEnds.find((line) => line > suppression.line) ?? lastLine);
|
|
63
81
|
};
|
|
64
82
|
|
|
65
83
|
export type Suppressed = { readonly finding: Finding; readonly suppression: Suppression };
|
|
66
84
|
|
|
67
|
-
export type Applied = {
|
|
85
|
+
export type Applied = {
|
|
86
|
+
readonly kept: readonly Finding[];
|
|
87
|
+
readonly suppressed: readonly Suppressed[];
|
|
88
|
+
readonly unusedReasonless: readonly Suppression[];
|
|
89
|
+
/** Every rule a stet in the document names, whether or not it silenced anything. */
|
|
90
|
+
readonly named: readonly string[];
|
|
91
|
+
};
|
|
68
92
|
|
|
69
93
|
export const applySuppressions = (source: string, findings: readonly Finding[], sections: readonly Span[]): Applied => {
|
|
70
94
|
const suppressions = parseSuppressions(source);
|
|
71
|
-
const
|
|
95
|
+
const lineAt = lineFinder(source);
|
|
96
|
+
const sectionEnds = sections.map((span) => lineAt(span.end));
|
|
72
97
|
const lastLine = source.split("\n").length;
|
|
73
98
|
const matched = findings.map((finding) => ({ finding, suppression: suppressions.find((entry) => covers(entry, finding, sectionEnds, lastLine)) }));
|
|
74
99
|
return {
|
|
75
100
|
kept: matched.filter((entry) => entry.suppression === undefined).map((entry) => entry.finding),
|
|
76
101
|
suppressed: matched.flatMap((entry) => (entry.suppression === undefined ? [] : [{ finding: entry.finding, suppression: entry.suppression }])),
|
|
77
102
|
unusedReasonless: suppressions.filter((entry) => entry.reason === undefined),
|
|
103
|
+
named: [...new Set(suppressions.flatMap((entry) => entry.rules))],
|
|
78
104
|
};
|
|
79
105
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { RelativeVocabulary } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
type Aside = RelativeVocabulary["aside"];
|
|
4
|
+
|
|
5
|
+
/** 文字と、その位置(UTF-16 の単位で)。絵文字のような 2 単位の文字も 1 文字として読む。 */
|
|
6
|
+
export const characters = (text: string): { readonly char: string; readonly at: number }[] => {
|
|
7
|
+
const found: { char: string; at: number }[] = [];
|
|
8
|
+
let at = 0;
|
|
9
|
+
for (const char of text) {
|
|
10
|
+
found.push({ char, at });
|
|
11
|
+
at += char.length;
|
|
12
|
+
}
|
|
13
|
+
return found;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** at の位置で開いたままの括弧書きの開きの位置。text の頭から at まで読む。 */
|
|
17
|
+
export const openAsidesAt = (text: string, at: number, aside: Aside): number[] => {
|
|
18
|
+
const opens: number[] = [];
|
|
19
|
+
if (aside === undefined) return opens;
|
|
20
|
+
characters(text.slice(0, at)).forEach(({ char, at: position }) => {
|
|
21
|
+
if (char === aside.open) opens.push(position);
|
|
22
|
+
if (char === aside.close) opens.pop();
|
|
23
|
+
});
|
|
24
|
+
return opens;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** at で開いたままの括弧書きの数(depth)と、一番内側の開きの位置(innermost)。 */
|
|
28
|
+
export type AsideDepth = { readonly depth: (at: number) => number; readonly innermost: (at: number) => number | undefined };
|
|
29
|
+
|
|
30
|
+
/** 文字の切れ目でない位置(2 単位の文字の途中)の印。 */
|
|
31
|
+
const UNREAD = -2;
|
|
32
|
+
const NO_OPEN = -1;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 本文を一度だけ読み、文字の切れ目ごとに openAsidesAt の答えを覚える。参照ごとに頭から読み直すと、参照の数と行の長さの積になる。
|
|
36
|
+
* 覚えていない位置(2 単位の文字の途中)は openAsidesAt で読む。
|
|
37
|
+
*/
|
|
38
|
+
export const asideDepth = (text: string, aside: Aside): AsideDepth => {
|
|
39
|
+
if (aside === undefined) return { depth: () => 0, innermost: () => undefined };
|
|
40
|
+
const depths = new Int32Array(text.length + 1).fill(UNREAD);
|
|
41
|
+
const innermosts = new Int32Array(text.length + 1).fill(UNREAD);
|
|
42
|
+
const opens: number[] = [];
|
|
43
|
+
depths[0] = 0;
|
|
44
|
+
innermosts[0] = NO_OPEN;
|
|
45
|
+
characters(text).forEach(({ char, at }) => {
|
|
46
|
+
if (char === aside.open) opens.push(at);
|
|
47
|
+
if (char === aside.close) opens.pop();
|
|
48
|
+
depths[at + char.length] = opens.length;
|
|
49
|
+
innermosts[at + char.length] = opens.at(-1) ?? NO_OPEN;
|
|
50
|
+
});
|
|
51
|
+
// text.slice(0, at) が切る位置。負の数は後ろから数え、本文の外は端に寄せる。文字の途中なら覚えていない。
|
|
52
|
+
const cut = (at: number): number => {
|
|
53
|
+
const whole = Math.trunc(Number.isNaN(at) ? 0 : at);
|
|
54
|
+
return whole < 0 ? Math.max(text.length + whole, 0) : Math.min(whole, text.length);
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
depth: (at) => {
|
|
58
|
+
const depth = depths[cut(at)] ?? UNREAD;
|
|
59
|
+
return depth === UNREAD ? openAsidesAt(text, at, aside).length : depth;
|
|
60
|
+
},
|
|
61
|
+
innermost: (at) => {
|
|
62
|
+
const open = innermosts[cut(at)] ?? UNREAD;
|
|
63
|
+
if (open === UNREAD) return openAsidesAt(text, at, aside).at(-1);
|
|
64
|
+
return open === NO_OPEN ? undefined : open;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
};
|