paperlint 16.8.0 → 17.1.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/CLAUDE.md +10 -2
- package/CONTRIBUTING.md +1 -1
- package/README.md +17 -14
- package/dist/adapters/latex/abstract.d.ts +7 -1
- package/dist/adapters/latex/abstract.d.ts.map +1 -1
- package/dist/adapters/latex/abstract.js +19 -4
- package/dist/adapters/latex/abstract.js.map +1 -1
- package/dist/adapters/latex/captions.d.ts +6 -5
- package/dist/adapters/latex/captions.d.ts.map +1 -1
- package/dist/adapters/latex/captions.js +14 -30
- package/dist/adapters/latex/captions.js.map +1 -1
- package/dist/adapters/latex/index.d.ts +1 -1
- package/dist/adapters/latex/index.d.ts.map +1 -1
- package/dist/adapters/latex/index.js +5 -2
- package/dist/adapters/latex/index.js.map +1 -1
- package/dist/adapters/latex/prose.d.ts +6 -0
- package/dist/adapters/latex/prose.d.ts.map +1 -1
- package/dist/adapters/latex/prose.js +18 -12
- package/dist/adapters/latex/prose.js.map +1 -1
- package/dist/cli.d.ts +6 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -8
- package/dist/cli.js.map +1 -1
- package/dist/domain/register.d.ts +23 -1
- package/dist/domain/register.d.ts.map +1 -1
- package/dist/domain/register.js +37 -14
- package/dist/domain/register.js.map +1 -1
- package/dist/domain/term-definitions.d.ts +48 -0
- package/dist/domain/term-definitions.d.ts.map +1 -0
- package/dist/domain/term-definitions.js +228 -0
- package/dist/domain/term-definitions.js.map +1 -0
- package/dist/domain/tex-document.d.ts +11 -0
- package/dist/domain/tex-document.d.ts.map +1 -1
- package/dist/domain/tex-document.js.map +1 -1
- package/dist/eslint-rules/review-frontmatter.js +5 -5
- package/dist/eslint-rules/review-frontmatter.schema.json +15 -8
- package/dist/eslint-rules/sibling-frontmatter.d.ts.map +1 -1
- package/dist/folder-venue-rule.d.ts +1 -1
- package/dist/folder-venue-rule.d.ts.map +1 -1
- package/dist/folder-venue-rule.js +4 -2
- package/dist/folder-venue-rule.js.map +1 -1
- package/dist/hooks-notice.d.ts +3 -3
- package/dist/hooks-notice.d.ts.map +1 -1
- package/dist/hooks-notice.js +41 -8
- package/dist/hooks-notice.js.map +1 -1
- package/dist/link-skills.d.ts +5 -0
- package/dist/link-skills.d.ts.map +1 -1
- package/dist/link-skills.js +7 -0
- package/dist/link-skills.js.map +1 -1
- package/dist/ports/latex.d.ts +11 -1
- package/dist/ports/latex.d.ts.map +1 -1
- package/dist/presets.d.ts +21 -2
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +66 -17
- package/dist/presets.js.map +1 -1
- package/dist/readability.d.ts +12 -2
- package/dist/readability.d.ts.map +1 -1
- package/dist/readability.js +76 -3
- package/dist/readability.js.map +1 -1
- package/dist/register-bands.d.ts +16 -5
- package/dist/register-bands.d.ts.map +1 -1
- package/dist/register-bands.js +56 -17
- package/dist/register-bands.js.map +1 -1
- package/dist/skills/argument-arc/scripts/headings-core.d.ts +12 -0
- package/dist/skills/argument-arc/scripts/headings.d.ts +2 -0
- package/dist/skills/cold-read-diff/scripts/cold-read-core.d.ts +12 -0
- package/dist/skills/cold-read-diff/scripts/readers.d.ts +2 -1
- package/dist/term-definition-rules.d.ts +26 -0
- package/dist/term-definition-rules.d.ts.map +1 -0
- package/dist/term-definition-rules.js +137 -0
- package/dist/term-definition-rules.js.map +1 -0
- package/dist/tex-paper.d.ts +6 -0
- package/dist/tex-paper.d.ts.map +1 -1
- package/dist/tex-paper.js +10 -0
- package/dist/tex-paper.js.map +1 -1
- package/dist/tex-requirements.d.ts +2 -0
- package/dist/tex-requirements.d.ts.map +1 -1
- package/dist/tex-requirements.js +9 -0
- package/dist/tex-requirements.js.map +1 -1
- package/dist/tex-venue-rules.d.ts +3 -2
- package/dist/tex-venue-rules.d.ts.map +1 -1
- package/dist/tex-venue-rules.js +3 -2
- package/dist/tex-venue-rules.js.map +1 -1
- package/docs/configuration.md +2 -2
- package/{skills/paper-pipeline/references → docs/design}/acceptance-gate.md +50 -53
- package/docs/design/paper-pipeline-history.md +217 -0
- package/docs/design/skill-provenance.md +132 -0
- package/docs/design/study-modes.md +1 -1
- package/docs/design/verify-citations-history.md +135 -0
- package/docs/design/writing-exemplars.md +19 -0
- package/docs/install.md +7 -4
- package/docs/layout.md +5 -4
- package/docs/optional-rules.md +4 -0
- package/docs/osf-artifact.md +54 -0
- package/docs/pipeline.md +171 -0
- package/docs/render.md +82 -0
- package/docs/rules/paper/folder-venue-leftover.md +10 -7
- package/docs/rules/tex/contrast-frames.md +1 -2
- package/docs/rules/tex/max-caption-words.md +82 -0
- package/docs/rules/tex/max-paragraph-words.md +2 -2
- package/docs/rules/tex/negated-sentences.md +96 -0
- package/docs/rules/tex/term-before-definition.md +103 -0
- package/docs/rules/tex/term-defined-twice.md +62 -0
- package/docs/rules/tex/venue-leftover.md +13 -1
- package/docs/rules.md +23 -18
- package/docs/skills.md +16 -21
- package/docs/submission.md +14 -0
- package/docs/texlive-install-decision.md +1 -1
- package/docs/toolchain.md +11 -11
- package/eslint-rules/review-frontmatter.schema.json +15 -8
- package/eslint-rules/review-frontmatter.test.mjs +8 -5
- package/eslint-rules/review-frontmatter.ts +5 -5
- package/eslint.config.mjs +1 -5
- package/hooks/paper-status-gates.sh +21 -4
- package/hooks/paper-status-gates.test.ts +51 -0
- package/lib/skill-checks.test.mjs +2 -6
- package/lib/skill-trigger-cases.mjs +12 -97
- package/lib/skill-trigger-cases.test.ts +0 -6
- package/package.json +3 -1
- package/presets/acm-sigconf.md +1 -1
- package/presets/agenticdev.jsonc +5 -2
- package/presets/agenticdev.md +4 -2
- package/presets/aidc.jsonc +14 -1
- package/presets/aidc.md +3 -2
- package/presets/aisec.jsonc +9 -3
- package/presets/aisec.md +4 -1
- package/presets/ase.jsonc +145 -0
- package/presets/ase.md +178 -0
- package/presets/ccs.jsonc +87 -0
- package/presets/ccs.md +184 -0
- package/presets/icse.jsonc +100 -0
- package/presets/icse.md +126 -0
- package/presets/ieee-conference.md +1 -1
- package/presets/sp.jsonc +152 -0
- package/presets/sp.md +160 -0
- package/presets/venue-profile.schema.json +22 -3
- package/scripts/harness-api.frozen.json +0 -4
- package/scripts/pipeline.ts +481 -0
- package/skills/CLAUDE.md +2 -2
- package/skills/CLAUDE.md.spec.ts +26 -1
- package/skills/analyze-sibling-paper/SKILL.md +2 -20
- package/skills/analyze-sibling-paper/SKILL.md.spec.ts +9 -19
- package/skills/argument-arc/SKILL.md +32 -18
- package/skills/argument-arc/SKILL.md.spec.ts +43 -17
- package/skills/argument-arc/scripts/headings-core.js +46 -0
- package/skills/argument-arc/scripts/headings-core.ts +65 -0
- package/skills/argument-arc/scripts/headings.js +15 -0
- package/skills/argument-arc/scripts/headings.test.ts +105 -0
- package/skills/argument-arc/scripts/headings.ts +20 -0
- package/skills/build-benchmark/SKILL.md +1 -12
- package/skills/build-benchmark/SKILL.md.spec.ts +15 -11
- package/skills/build-label-page/SKILL.md.spec.ts +11 -0
- package/skills/camera-ready/SKILL.md +1 -8
- package/skills/camera-ready/SKILL.md.spec.ts +8 -7
- package/skills/cold-read-diff/SKILL.md +36 -25
- package/skills/cold-read-diff/SKILL.md.spec.ts +44 -24
- package/skills/cold-read-diff/scripts/cold-read-core.js +63 -6
- package/skills/cold-read-diff/scripts/cold-read-core.ts +81 -6
- package/skills/cold-read-diff/scripts/cold-read.js +1 -1
- package/skills/cold-read-diff/scripts/cold-read.test.ts +66 -0
- package/skills/cold-read-diff/scripts/cold-read.ts +1 -1
- package/skills/cold-read-diff/scripts/readers.js +2 -1
- package/skills/cold-read-diff/scripts/readers.ts +2 -1
- package/skills/draft-paper/SKILL.md +16 -29
- package/skills/draft-paper/SKILL.md.spec.ts +27 -28
- package/skills/extend-paper/SKILL.md +7 -16
- package/skills/extend-paper/SKILL.md.spec.ts +18 -15
- package/skills/find-venue/SKILL.md +11 -24
- package/skills/find-venue/SKILL.md.spec.ts +19 -23
- package/skills/harden-paper/SKILL.md +62 -290
- package/skills/harden-paper/SKILL.md.spec.ts +82 -304
- package/skills/harden-paper/harden-paper.harness.mjs +1 -2
- package/skills/jobs.ts +25 -0
- package/skills/label-agent-runs/SKILL.md.spec.ts +10 -0
- package/skills/map-prior-work/SKILL.md +5 -4
- package/skills/map-prior-work/SKILL.md.spec.ts +13 -3
- package/skills/paper-pipeline/SKILL.md +80 -278
- package/skills/paper-pipeline/SKILL.md.spec.ts +130 -276
- package/skills/paper-pipeline/description-language.eval.mjs +0 -22
- package/skills/paper-pipeline/framing-vs-vocabulary.eval.mjs +0 -29
- package/skills/paper-pipeline/paper-pipeline.harness.mjs +0 -16
- package/skills/paper-pipeline/pipeline-firing.eval.mjs +7 -29
- package/skills/paper-pipeline/pipeline-language.eval.mjs +0 -52
- package/skills/paper-pipeline/references/artifact-checklist.md +6 -1
- package/skills/paper-pipeline/references/body-vs-appendix.md +3 -4
- package/skills/paper-pipeline/references/pipeline-status-template.md +8 -10
- package/skills/paper-pipeline/references/review-ratchet.md +4 -7
- package/skills/paper-pipeline/references/venue-bar.md +1 -2
- package/skills/paper-pipeline/references/writing-craft.md +21 -281
- package/skills/paper-status/SKILL.md +17 -20
- package/skills/paper-status/SKILL.md.spec.ts +23 -19
- package/skills/pc-panel-review/SKILL.md +66 -93
- package/skills/pc-panel-review/SKILL.md.spec.ts +75 -92
- package/skills/plan-paper-timeline/SKILL.md +7 -29
- package/skills/plan-paper-timeline/SKILL.md.spec.ts +16 -28
- package/skills/plan-paper-timeline/plan-paper-timeline.effects.harness.mjs +2 -2
- package/skills/render-paper/check-render.sh +2 -2
- package/skills/render-paper/render-paper.harness.mjs +4 -20
- package/skills/research-ideate/SKILL.md +15 -32
- package/skills/research-ideate/SKILL.md.spec.ts +25 -31
- package/skills/rewrite-unclear/SKILL.md +15 -14
- package/skills/rewrite-unclear/SKILL.md.spec.ts +24 -15
- package/skills/rewrite-unclear/rewrite-unclear.eval.ts +2 -3
- package/skills/run-agent-grid/SKILL.md +3 -3
- package/skills/run-agent-grid/SKILL.md.spec.ts +10 -2
- package/skills/study-accepted-papers/SKILL.md +5 -5
- package/skills/study-accepted-papers/SKILL.md.spec.ts +27 -4
- package/skills/submit-paper/SKILL.md +37 -31
- package/skills/submit-paper/SKILL.md.spec.ts +46 -30
- package/skills/submit-paper/check-deanon.sh +1 -1
- package/skills/tighten-paper/SKILL.md +43 -68
- package/skills/tighten-paper/SKILL.md.spec.ts +51 -67
- package/skills/verify-citations/SKILL.md +18 -112
- package/skills/verify-citations/SKILL.md.spec.ts +27 -114
- package/src/adapters/latex/abstract.test.ts +42 -0
- package/src/adapters/latex/abstract.ts +23 -6
- package/src/adapters/latex/captions.test.ts +36 -38
- package/src/adapters/latex/captions.ts +16 -33
- package/src/adapters/latex/index.test.ts +11 -0
- package/src/adapters/latex/index.ts +5 -2
- package/src/adapters/latex/prose.ts +23 -11
- package/src/cli.ts +26 -5
- package/src/domain/register.test.ts +65 -0
- package/src/domain/register.ts +72 -16
- package/src/domain/term-definitions.test.ts +240 -0
- package/src/domain/term-definitions.ts +329 -0
- package/src/domain/tex-document.ts +12 -0
- package/src/domain/venue-name.test.ts +4 -4
- package/src/folder-venue-rule.test.ts +23 -2
- package/src/folder-venue-rule.ts +8 -8
- package/src/hooks-notice.test.ts +127 -0
- package/src/hooks-notice.ts +50 -10
- package/src/link-skills.ts +9 -0
- package/src/new-paper.test.ts +2 -2
- package/src/paper-settings-commands.test.ts +1 -1
- package/src/ports/latex.ts +11 -0
- package/src/preset-card-rule.test.ts +4 -0
- package/src/presets.test.ts +141 -4
- package/src/presets.ts +113 -22
- package/src/readability.test.ts +92 -0
- package/src/readability.ts +113 -5
- package/src/register-bands.test.ts +81 -1
- package/src/register-bands.ts +88 -23
- package/src/rule-cases.test.ts +122 -2
- package/src/term-definition-rules.test.ts +150 -0
- package/src/term-definition-rules.ts +189 -0
- package/src/tex-paper.test.ts +18 -1
- package/src/tex-paper.ts +11 -0
- package/src/tex-requirements.ts +15 -0
- package/src/tex-venue-rules.test.ts +45 -1
- package/src/tex-venue-rules.ts +8 -3
- package/src/venue-rules.test.ts +2 -2
- package/templates/paper/PIPELINE-STATUS.md +19 -19
- package/dist/paper-prose.d.ts +0 -17
- package/dist/paper-prose.d.ts.map +0 -1
- package/dist/paper-prose.js +0 -46
- package/dist/paper-prose.js.map +0 -1
- package/skills/grade-paper-writing/SKILL.md +0 -494
- package/skills/grade-paper-writing/SKILL.md.spec.ts +0 -501
- package/skills/grade-paper-writing/__snapshots__/prose-lint.test.ts.snap +0 -84
- package/skills/grade-paper-writing/fixtures/control_gopen.txt +0 -1
- package/skills/grade-paper-writing/fixtures/control_human_paper.txt +0 -1
- package/skills/grade-paper-writing/fixtures/rewrite.txt +0 -1
- package/skills/grade-paper-writing/fixtures/specimen.txt +0 -1
- package/skills/grade-paper-writing/fixtures/structure-checks.md +0 -22
- package/skills/grade-paper-writing/grade-paper-writing.eval.mjs +0 -19
- package/skills/grade-paper-writing/grade-paper-writing.harness.mjs +0 -23
- package/skills/grade-paper-writing/prose-lint.mjs +0 -602
- package/skills/grade-paper-writing/prose-lint.test.ts +0 -413
- package/skills/osf-artifact-upload/SKILL.md +0 -58
- package/skills/osf-artifact-upload/SKILL.md.spec.ts +0 -65
- package/skills/osf-artifact-upload/osf-artifact-upload.eval.mjs +0 -22
- package/skills/osf-artifact-upload/osf-artifact-upload.harness.ts +0 -102
- package/skills/paper-adversarial-review/SKILL.md +0 -100
- package/skills/paper-adversarial-review/SKILL.md.spec.ts +0 -107
- package/skills/paper-adversarial-review/paper-adversarial-review.eval.mjs +0 -19
- package/skills/paper-adversarial-review/paper-adversarial-review.harness.mjs +0 -24
- package/skills/paper-pipeline/grade-paper-writing-ablation.eval.mjs +0 -1274
- package/skills/paper-pipeline/references/credit-criteria.md +0 -69
- package/skills/paper-pipeline/references/occupancy-2026-08-06-probe/README.md +0 -35
- package/skills/paper-pipeline/references/occupancy-2026-08-06-probe/run_retext.mjs +0 -24
- package/skills/paper-pipeline/references/occupancy-2026-08-06-probe/sentences.txt +0 -11
- package/skills/paper-pipeline/references/occupancy-2026-08-06-probe/test_sentences.py +0 -25
- package/skills/paper-pipeline/references/occupancy-2026-08-06-prose-checkers.md +0 -538
- package/skills/paper-pipeline/references/occupancy-2026-08-06-reproducible-tooling.md +0 -431
- package/skills/paper-pipeline/references/occupancy-2026-08-06-staleness-and-orchestration.md +0 -592
- package/skills/paper-pipeline/repro/2026-08-08-parent-replication.mjs +0 -92
- package/skills/render-paper/SKILL.md +0 -123
- package/skills/render-paper/SKILL.md.spec.ts +0 -130
- package/skills/render-paper/render-paper.eval.mjs +0 -19
- package/skills/submission-portal/SKILL.md +0 -129
- package/skills/submission-portal/SKILL.md.spec.ts +0 -134
- package/skills/submission-portal/submission-portal.eval.mjs +0 -15
- package/skills/submission-portal/submission-portal.test.ts +0 -12
- package/skills/sweep-design-space/SKILL.md +0 -232
- package/skills/sweep-design-space/SKILL.md.spec.ts +0 -248
- package/skills/sweep-design-space/sweep-design-space.eval.mjs +0 -19
- package/skills/sweep-design-space/sweep-design-space.harness.mjs +0 -23
- package/src/paper-prose.test.ts +0 -78
- package/src/paper-prose.ts +0 -67
package/src/register-bands.ts
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* is reported where it stands
|
|
9
9
|
* tex/relation-markers warn words naming how a sentence relates to the one before (because,
|
|
10
10
|
* therefore, however, for example …) outside the band
|
|
11
|
+
* tex/negated-sentences off the share of the body's sentences that hold a negator (not, no,
|
|
12
|
+
* never, without …) outside the band — a percent of sentences, not
|
|
13
|
+
* a rate per words; off until a project turns it on
|
|
11
14
|
*
|
|
12
15
|
* ── WHY ──────────────────────────────────────────────────────────────────────────
|
|
13
16
|
* Reviewers called a paper "too informal" and "a blogpost". Its text differed from the accepted
|
|
@@ -28,10 +31,14 @@ import {
|
|
|
28
31
|
bodySentences,
|
|
29
32
|
claimEmphasis,
|
|
30
33
|
contrastFrames,
|
|
34
|
+
negatedSentences,
|
|
35
|
+
negationBandOf,
|
|
31
36
|
rateOf,
|
|
32
37
|
relationMarkers,
|
|
38
|
+
shareOf,
|
|
33
39
|
wordsOf,
|
|
34
40
|
type Band,
|
|
41
|
+
type BodySentence,
|
|
35
42
|
type Occurrence,
|
|
36
43
|
type RegisterAnchor,
|
|
37
44
|
type RegisterMeasureName,
|
|
@@ -52,13 +59,21 @@ import type { VenueRuleDeps } from "./venue-rules.ts";
|
|
|
52
59
|
/** What the three rules read: the preset store, the LaTeX reader, and the paper's files as the build recorded them. */
|
|
53
60
|
export interface RegisterBandDeps extends VenueRuleDeps, ProseDeps {}
|
|
54
61
|
|
|
55
|
-
|
|
62
|
+
/** The band rules on by default: each a rate per 10,000 words. */
|
|
63
|
+
export type WordBandRuleName =
|
|
56
64
|
"contrast-frames" | "claim-emphasis" | "relation-markers";
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
export type RegisterBandRuleName = WordBandRuleName | "negated-sentences";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* What one body measures for one rule: its words and sentences, the occurrences, their rate as the
|
|
70
|
+
* rule reads it (per 10,000 words, or a percent of sentences), where the body starts.
|
|
71
|
+
*/
|
|
59
72
|
export interface BodyMeasure {
|
|
60
73
|
readonly words: number;
|
|
74
|
+
readonly sentences: number;
|
|
61
75
|
readonly occurrences: readonly Occurrence[];
|
|
76
|
+
readonly rate: number;
|
|
62
77
|
readonly at: Span | null;
|
|
63
78
|
}
|
|
64
79
|
|
|
@@ -82,7 +97,8 @@ function dataOf(
|
|
|
82
97
|
return {
|
|
83
98
|
count: m.occurrences.length,
|
|
84
99
|
words: m.words,
|
|
85
|
-
|
|
100
|
+
sentences: m.sentences,
|
|
101
|
+
rate: fixed(m.rate),
|
|
86
102
|
venue,
|
|
87
103
|
min: fixed(band.min),
|
|
88
104
|
max: fixed(band.max),
|
|
@@ -108,7 +124,7 @@ export function judgeBand(
|
|
|
108
124
|
each: boolean,
|
|
109
125
|
): readonly Located[] {
|
|
110
126
|
if (band === null || m.words < MIN_WORDS) return [];
|
|
111
|
-
const standing = standingOf(
|
|
127
|
+
const standing = standingOf(m.rate, band);
|
|
112
128
|
if (standing === "within") return [];
|
|
113
129
|
const data = dataOf(m, band, venue);
|
|
114
130
|
const whole: Located = { messageId: standing, data, at: m.at };
|
|
@@ -125,29 +141,44 @@ export function judgeBand(
|
|
|
125
141
|
const AGAINST =
|
|
126
142
|
"{{rate}} per 10,000 words; {{venue}}'s {{anchors}} anchor papers measure {{anchorMin}}–{{anchorMax}}, and this rule warns outside {{min}}–{{max}}";
|
|
127
143
|
|
|
128
|
-
/** The
|
|
144
|
+
/** The band words of the share of sentences: a percent, and where the anchors put it. */
|
|
145
|
+
const AGAINST_SHARE =
|
|
146
|
+
"{{rate}}% of its {{sentences}} sentences; {{venue}}'s {{anchors}} anchor papers measure {{anchorMin}}–{{anchorMax}}%, and this rule warns outside {{min}}–{{max}}%";
|
|
147
|
+
|
|
148
|
+
/** The body as the measures read it: its sentences, and the phrases emphasised in it (read on demand). */
|
|
129
149
|
interface Body {
|
|
130
|
-
readonly
|
|
150
|
+
readonly sentences: readonly BodySentence[];
|
|
131
151
|
readonly emphasis: () => readonly Emphasis[];
|
|
132
152
|
}
|
|
133
153
|
|
|
134
154
|
/** What each rule counts, how it reads the paper, and what it says. */
|
|
135
155
|
interface Measure {
|
|
136
|
-
readonly name: RegisterMeasureName;
|
|
137
156
|
readonly description: string;
|
|
138
157
|
/** Above the band, report every occurrence where it stands. */
|
|
139
158
|
readonly each: boolean;
|
|
140
159
|
readonly count: (body: Body) => readonly Occurrence[];
|
|
160
|
+
/** The occurrences as a rate: per 10,000 words, or a percent of sentences. */
|
|
161
|
+
readonly rate: (count: number, words: number, sentences: number) => number;
|
|
162
|
+
/** The band the preset's anchors set for it; null when they set none. */
|
|
163
|
+
readonly band: (anchors: readonly RegisterAnchor[]) => Band | null;
|
|
141
164
|
readonly messages: Readonly<Record<string, string>>;
|
|
142
165
|
}
|
|
143
166
|
|
|
167
|
+
/** A measure per 10,000 words, its band the anchors' counts of `name`. */
|
|
168
|
+
const perWords = (
|
|
169
|
+
name: RegisterMeasureName,
|
|
170
|
+
): Pick<Measure, "rate" | "band"> => ({
|
|
171
|
+
rate: (count, words) => rateOf(count, words),
|
|
172
|
+
band: (anchors) => bandOf(anchors, name),
|
|
173
|
+
});
|
|
174
|
+
|
|
144
175
|
const MEASURES: Readonly<Record<RegisterBandRuleName, Measure>> = {
|
|
145
176
|
"contrast-frames": {
|
|
146
|
-
|
|
177
|
+
...perWords("contrast_frames"),
|
|
147
178
|
description:
|
|
148
179
|
"contrast frames («X, not Y», «rather than», «instead of») stay within the rate the venue's accepted papers show",
|
|
149
180
|
each: true,
|
|
150
|
-
count: (b) => contrastFrames(
|
|
181
|
+
count: (b) => contrastFrames(b.sentences),
|
|
151
182
|
messages: {
|
|
152
183
|
above: `{{count}} contrast frames («X, not Y», «not X but Y», «rather than», «instead of», «as opposed to») — ${AGAINST}. First: {{examples}}. Say what the thing is and why, with the evidence; keep a frame only where a reader would otherwise assume the rejected alternative`,
|
|
153
184
|
below: `{{count}} contrast frames — ${AGAINST}. A rewrite may have dropped relations the argument needs: check that each claim still says what it is set against`,
|
|
@@ -155,7 +186,7 @@ const MEASURES: Readonly<Record<RegisterBandRuleName, Measure>> = {
|
|
|
155
186
|
},
|
|
156
187
|
},
|
|
157
188
|
"claim-emphasis": {
|
|
158
|
-
|
|
189
|
+
...perWords("claim_emphasis"),
|
|
159
190
|
description:
|
|
160
191
|
"claims set in bold inside a sentence stay within the rate the venue's accepted papers show",
|
|
161
192
|
each: true,
|
|
@@ -167,16 +198,28 @@ const MEASURES: Readonly<Record<RegisterBandRuleName, Measure>> = {
|
|
|
167
198
|
},
|
|
168
199
|
},
|
|
169
200
|
"relation-markers": {
|
|
170
|
-
|
|
201
|
+
...perWords("relation_markers"),
|
|
171
202
|
description:
|
|
172
203
|
"words that name how a sentence relates to the one before (because, therefore, however, for example) stay within the rate the venue's accepted papers show",
|
|
173
204
|
each: false,
|
|
174
|
-
count: (b) => relationMarkers(
|
|
205
|
+
count: (b) => relationMarkers(b.sentences),
|
|
175
206
|
messages: {
|
|
176
207
|
below: `{{count}} words name how a sentence relates to the one before (because, therefore, however, in contrast, for example, that is …) — ${AGAINST}. Where two sentences stand side by side, say whether the second is the cause, the consequence, an example or a limit of the first`,
|
|
177
208
|
above: `{{count}} relation markers — ${AGAINST}. First: {{examples}}`,
|
|
178
209
|
},
|
|
179
210
|
},
|
|
211
|
+
"negated-sentences": {
|
|
212
|
+
description:
|
|
213
|
+
"the share of the body's sentences that hold a negator (not, no, never, without, cannot …) stays within the share the venue's accepted papers show. Off until a project turns it on",
|
|
214
|
+
each: false,
|
|
215
|
+
count: (b) => negatedSentences(b.sentences),
|
|
216
|
+
rate: (count, _words, sentences) => shareOf(count, sentences),
|
|
217
|
+
band: negationBandOf,
|
|
218
|
+
messages: {
|
|
219
|
+
above: `{{count}} sentences hold a negator (not, no, never, without, cannot …) — ${AGAINST_SHARE}. First: {{examples}}. Say what a thing is and does; keep a negation where a reader would otherwise assume the opposite`,
|
|
220
|
+
below: `{{count}} sentences hold a negator — ${AGAINST_SHARE}`,
|
|
221
|
+
},
|
|
222
|
+
},
|
|
180
223
|
};
|
|
181
224
|
|
|
182
225
|
/** What a body measures for a rule: its words, its occurrences, and where it starts. */
|
|
@@ -187,16 +230,30 @@ export function measureBody(
|
|
|
187
230
|
): BodyMeasure {
|
|
188
231
|
const passages = latex.bodyProse(src);
|
|
189
232
|
const [first] = passages;
|
|
190
|
-
const body
|
|
233
|
+
const body = bodyOf(passages, src, latex);
|
|
234
|
+
const words = wordsOf(body.sentences);
|
|
235
|
+
const occurrences = MEASURES[rule].count(body);
|
|
191
236
|
return {
|
|
192
|
-
words
|
|
193
|
-
|
|
237
|
+
words,
|
|
238
|
+
sentences: body.sentences.length,
|
|
239
|
+
occurrences,
|
|
240
|
+
rate: MEASURES[rule].rate(occurrences.length, words, body.sentences.length),
|
|
194
241
|
at: first === undefined ? null : startOf(first),
|
|
195
242
|
};
|
|
196
243
|
}
|
|
197
244
|
|
|
245
|
+
/** The body as the measures read it. */
|
|
246
|
+
const bodyOf = (
|
|
247
|
+
passages: readonly Passage[],
|
|
248
|
+
src: string,
|
|
249
|
+
latex: LatexReader,
|
|
250
|
+
): Body => ({
|
|
251
|
+
sentences: bodySentences(passages),
|
|
252
|
+
emphasis: () => latex.bodyEmphasis(src),
|
|
253
|
+
});
|
|
254
|
+
|
|
198
255
|
/** Which rule counts each measure an anchor records. */
|
|
199
|
-
const RULE_OF: Readonly<Record<RegisterMeasureName,
|
|
256
|
+
const RULE_OF: Readonly<Record<RegisterMeasureName, WordBandRuleName>> = {
|
|
200
257
|
contrast_frames: "contrast-frames",
|
|
201
258
|
claim_emphasis: "claim-emphasis",
|
|
202
259
|
relation_markers: "relation-markers",
|
|
@@ -211,18 +268,21 @@ export function anchorOf(
|
|
|
211
268
|
src: string,
|
|
212
269
|
latex: LatexReader,
|
|
213
270
|
): RegisterAnchor {
|
|
214
|
-
const
|
|
215
|
-
const body: Body = { passages, emphasis: () => latex.bodyEmphasis(src) };
|
|
271
|
+
const body = bodyOf(latex.bodyProse(src), src, latex);
|
|
216
272
|
const count = (m: RegisterMeasureName): number =>
|
|
217
273
|
MEASURES[RULE_OF[m]].count(body).length;
|
|
218
274
|
return {
|
|
219
275
|
paper,
|
|
220
|
-
words: wordsOf(
|
|
276
|
+
words: wordsOf(body.sentences),
|
|
221
277
|
counts: {
|
|
222
278
|
contrast_frames: count("contrast_frames"),
|
|
223
279
|
claim_emphasis: count("claim_emphasis"),
|
|
224
280
|
relation_markers: count("relation_markers"),
|
|
225
281
|
},
|
|
282
|
+
negation: {
|
|
283
|
+
sentences: body.sentences.length,
|
|
284
|
+
negated: negatedSentences(body.sentences).length,
|
|
285
|
+
},
|
|
226
286
|
};
|
|
227
287
|
}
|
|
228
288
|
|
|
@@ -235,7 +295,7 @@ function judgePaper(
|
|
|
235
295
|
const p = paperPreset(dirname(context.filename), deps);
|
|
236
296
|
if (p.kind !== "resolved") return;
|
|
237
297
|
const measure = MEASURES[name];
|
|
238
|
-
const band =
|
|
298
|
+
const band = measure.band(p.preset.registerAnchors);
|
|
239
299
|
if (band === null) return;
|
|
240
300
|
const sc = context.sourceCode;
|
|
241
301
|
const paper = readPaper(context.filename, sc.raw ?? sc.text, deps);
|
|
@@ -268,7 +328,7 @@ function rule(
|
|
|
268
328
|
};
|
|
269
329
|
}
|
|
270
330
|
|
|
271
|
-
/** The
|
|
331
|
+
/** The four rules, as rules of the `tex` plugin. */
|
|
272
332
|
export function registerBandRules(
|
|
273
333
|
deps: RegisterBandDeps,
|
|
274
334
|
): Readonly<Record<RegisterBandRuleName, TexRuleModule>> {
|
|
@@ -276,12 +336,17 @@ export function registerBandRules(
|
|
|
276
336
|
"contrast-frames": rule("contrast-frames", deps),
|
|
277
337
|
"claim-emphasis": rule("claim-emphasis", deps),
|
|
278
338
|
"relation-markers": rule("relation-markers", deps),
|
|
339
|
+
"negated-sentences": rule("negated-sentences", deps),
|
|
279
340
|
};
|
|
280
341
|
}
|
|
281
342
|
|
|
282
|
-
/**
|
|
343
|
+
/**
|
|
344
|
+
* The level each rule is on at in paperlint's own config, for every `paper.tex`. `tex/negated-sentences`
|
|
345
|
+
* is not here: a writing measure added after the default set was fixed to what the venue decides,
|
|
346
|
+
* it ships off.
|
|
347
|
+
*/
|
|
283
348
|
export const REGISTER_BAND_RULE_LEVELS: Readonly<
|
|
284
|
-
Record<`tex/${
|
|
349
|
+
Record<`tex/${WordBandRuleName}`, "warn">
|
|
285
350
|
> = {
|
|
286
351
|
"tex/contrast-frames": "warn",
|
|
287
352
|
"tex/claim-emphasis": "warn",
|
package/src/rule-cases.test.ts
CHANGED
|
@@ -192,6 +192,33 @@ const MAX_PARAGRAPH_WORDS_ON: Readonly<Record<string, string>> = {
|
|
|
192
192
|
}),
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
+
/** `tex/term-before-definition` and `tex/term-defined-twice` are off by default; a paper turns them on. */
|
|
196
|
+
const TERMS_ON: Readonly<Record<string, string>> = {
|
|
197
|
+
[`${P}/paperlint.json`]: JSON.stringify({
|
|
198
|
+
extends: null,
|
|
199
|
+
rules: {
|
|
200
|
+
"tex/term-before-definition": "warn",
|
|
201
|
+
"tex/term-defined-twice": "warn",
|
|
202
|
+
},
|
|
203
|
+
}),
|
|
204
|
+
};
|
|
205
|
+
/** A body that defines «gate» once, and uses it only after. */
|
|
206
|
+
const GATE_DEFINED =
|
|
207
|
+
"A \\emph{gate} is a check that blocks a call. The gate holds.";
|
|
208
|
+
|
|
209
|
+
/** `tex/max-caption-words` is off by default; a paper turns it on. */
|
|
210
|
+
const CAPTIONS_ON: Readonly<Record<string, string>> = {
|
|
211
|
+
[`${P}/paperlint.json`]: JSON.stringify({
|
|
212
|
+
extends: null,
|
|
213
|
+
rules: { "tex/max-caption-words": "warn" },
|
|
214
|
+
}),
|
|
215
|
+
};
|
|
216
|
+
/** A figure whose caption is `n` words, opening on line 4 of the paper. */
|
|
217
|
+
const captioned = (n: number): string =>
|
|
218
|
+
tex(
|
|
219
|
+
`Text.\n\\begin{figure}\n\\caption{${Array.from({ length: n }, () => "word").join(" ")}}\n\\end{figure}`,
|
|
220
|
+
);
|
|
221
|
+
|
|
195
222
|
/** `tex/max-paragraph-numbers` and `tex/max-sentence-words` are off by default too. */
|
|
196
223
|
const CEILINGS_ON: Readonly<Record<string, string>> = {
|
|
197
224
|
[`${P}/paperlint.json`]: JSON.stringify({
|
|
@@ -260,7 +287,8 @@ const STATEMENT_TITLE = "LLM Usage Statement";
|
|
|
260
287
|
* A double-blind venue on the IEEE template: the class options it requires, the section it requires
|
|
261
288
|
* last, and one accepted paper of 10,000 words for the register bands. Its rates (contrast frames 4,
|
|
262
289
|
* claims in bold 4, relation markers 64 per 10,000 words), widened by two Poisson standard
|
|
263
|
-
* deviations, set the bands 0–8, 0–8 and 48–80
|
|
290
|
+
* deviations, set the bands 0–8, 0–8 and 48–80; its 50 negated sentences of 500, 10%, set
|
|
291
|
+
* tex/negated-sentences' band at 7.2–12.8%.
|
|
264
292
|
*/
|
|
265
293
|
const BLINDCONF = venuePreset("BlindConf", {
|
|
266
294
|
extends: "paperlint:ieee-conference",
|
|
@@ -275,6 +303,8 @@ const BLINDCONF = venuePreset("BlindConf", {
|
|
|
275
303
|
contrast_frames: 4,
|
|
276
304
|
claim_emphasis: 4,
|
|
277
305
|
relation_markers: 64,
|
|
306
|
+
sentences: 500,
|
|
307
|
+
negated_sentences: 50,
|
|
278
308
|
},
|
|
279
309
|
],
|
|
280
310
|
},
|
|
@@ -450,6 +480,15 @@ const blind = (body: string, cls = IEEE) =>
|
|
|
450
480
|
tex(`\\section{Introduction}\n${body}\n${STATEMENT}`, cls),
|
|
451
481
|
BLIND_PAPER,
|
|
452
482
|
);
|
|
483
|
+
/** A BlindConf paper that turns `tex/negated-sentences` on, which is off by default. */
|
|
484
|
+
const blindNegation = (body: string) =>
|
|
485
|
+
paper(tex(`\\section{Introduction}\n${body}\n${STATEMENT}`, IEEE), {
|
|
486
|
+
...BLIND_PAPER,
|
|
487
|
+
[`${P}/paperlint.json`]: JSON.stringify({
|
|
488
|
+
...BLIND,
|
|
489
|
+
rules: { "tex/negated-sentences": "warn" },
|
|
490
|
+
}),
|
|
491
|
+
});
|
|
453
492
|
|
|
454
493
|
// ── a paper that declares a talk: a preset of its own over ExampleConf, and synthetic media ──────
|
|
455
494
|
|
|
@@ -1008,7 +1047,7 @@ const CASES: Readonly<Record<string, RuleCases>> = {
|
|
|
1008
1047
|
reports: {
|
|
1009
1048
|
tree: paper(tex("x"), {
|
|
1010
1049
|
[`${P}/reviews/r1.md`]:
|
|
1011
|
-
"---\nfindings:\n - id: 1\n status:
|
|
1050
|
+
"---\nfindings:\n - id: 1\n status: done\n---\n# Review\n",
|
|
1012
1051
|
}),
|
|
1013
1052
|
file: `${P}/reviews/r1.md`,
|
|
1014
1053
|
severity: 2,
|
|
@@ -1312,6 +1351,38 @@ const CASES: Readonly<Record<string, RuleCases>> = {
|
|
|
1312
1351
|
},
|
|
1313
1352
|
silent: paper(tex(longSentence(55)), CEILINGS_ON),
|
|
1314
1353
|
},
|
|
1354
|
+
// Captions: off by default; a 41-word caption is one sentence over 40, under the caption's 100.
|
|
1355
|
+
"tex/max-caption-words": {
|
|
1356
|
+
reports: {
|
|
1357
|
+
tree: paper(captioned(41), CAPTIONS_ON),
|
|
1358
|
+
file: TEX_FILE,
|
|
1359
|
+
severity: 1,
|
|
1360
|
+
line: 5,
|
|
1361
|
+
},
|
|
1362
|
+
silent: paper(captioned(40), CAPTIONS_ON),
|
|
1363
|
+
},
|
|
1364
|
+
// A term against its definition: off by default, on in these cases' paperlint.json.
|
|
1365
|
+
"tex/term-before-definition": {
|
|
1366
|
+
reports: {
|
|
1367
|
+
tree: paper(tex(`A gate runs first.\n\n${GATE_DEFINED}`), TERMS_ON),
|
|
1368
|
+
file: TEX_FILE,
|
|
1369
|
+
severity: 1,
|
|
1370
|
+
line: 3,
|
|
1371
|
+
},
|
|
1372
|
+
silent: paper(tex(GATE_DEFINED), TERMS_ON),
|
|
1373
|
+
},
|
|
1374
|
+
"tex/term-defined-twice": {
|
|
1375
|
+
reports: {
|
|
1376
|
+
tree: paper(
|
|
1377
|
+
tex(`${GATE_DEFINED}\n\nAgain, a \\emph{gate} blocks.`),
|
|
1378
|
+
TERMS_ON,
|
|
1379
|
+
),
|
|
1380
|
+
file: TEX_FILE,
|
|
1381
|
+
severity: 1,
|
|
1382
|
+
line: 5,
|
|
1383
|
+
},
|
|
1384
|
+
silent: paper(tex(GATE_DEFINED), TERMS_ON),
|
|
1385
|
+
},
|
|
1315
1386
|
// The three register bands judge a body against the anchor of BlindConf's preset; the body opens
|
|
1316
1387
|
// on line 3, right after the \\section, where the finding about the whole body stands.
|
|
1317
1388
|
"tex/contrast-frames": {
|
|
@@ -1338,6 +1409,19 @@ const CASES: Readonly<Record<string, RuleCases>> = {
|
|
|
1338
1409
|
reports: { tree: blind(FORMAL), file: TEX_FILE, severity: 1, line: 3 },
|
|
1339
1410
|
silent: blind(LINKED),
|
|
1340
1411
|
},
|
|
1412
|
+
// Off by default; on in this paper's paperlint.json. FORMAL holds no negator (0%, below 7.2%);
|
|
1413
|
+
// 25 negated sentences of 225 are 11.1%, inside the band.
|
|
1414
|
+
"tex/negated-sentences": {
|
|
1415
|
+
reports: {
|
|
1416
|
+
tree: blindNegation(FORMAL),
|
|
1417
|
+
file: TEX_FILE,
|
|
1418
|
+
severity: 1,
|
|
1419
|
+
line: 3,
|
|
1420
|
+
},
|
|
1421
|
+
silent: blindNegation(
|
|
1422
|
+
formalWith(25, "The rule does not count this sentence twice."),
|
|
1423
|
+
),
|
|
1424
|
+
},
|
|
1341
1425
|
"bib/reachable-entry": {
|
|
1342
1426
|
reports: {
|
|
1343
1427
|
tree: inlineBuilt("@book{a,\n title = {A},\n year = {2026}\n}"),
|
|
@@ -1558,6 +1642,42 @@ describe("the other two ceilings are off by default", () => {
|
|
|
1558
1642
|
});
|
|
1559
1643
|
});
|
|
1560
1644
|
|
|
1645
|
+
describe("tex/max-caption-words is off by default", () => {
|
|
1646
|
+
it("a 120-word caption produces nothing until the paper turns the rule on", async () => {
|
|
1647
|
+
const ids = async (tree: Record<string, string>) =>
|
|
1648
|
+
(await lintTree(tree)).map((m) => m.ruleId);
|
|
1649
|
+
expect(await ids(paper(captioned(120)))).not.toContain(
|
|
1650
|
+
"tex/max-caption-words",
|
|
1651
|
+
);
|
|
1652
|
+
expect(await ids(paper(captioned(120), CAPTIONS_ON))).toContain(
|
|
1653
|
+
"tex/max-caption-words",
|
|
1654
|
+
);
|
|
1655
|
+
});
|
|
1656
|
+
});
|
|
1657
|
+
|
|
1658
|
+
describe("tex/negated-sentences is off by default", () => {
|
|
1659
|
+
it("a body with no negator against BlindConf's band produces nothing until the paper turns it on", async () => {
|
|
1660
|
+
const ids = async (tree: Record<string, string>) =>
|
|
1661
|
+
(await lintTree(tree)).map((m) => m.ruleId);
|
|
1662
|
+
expect(await ids(blind(FORMAL))).not.toContain("tex/negated-sentences");
|
|
1663
|
+
expect(await ids(blindNegation(FORMAL))).toContain("tex/negated-sentences");
|
|
1664
|
+
});
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
describe("the term rules are off by default", () => {
|
|
1668
|
+
it("a use before its definition and a second definition produce nothing until the paper turns them on", async () => {
|
|
1669
|
+
const ids = async (tree: Record<string, string>) =>
|
|
1670
|
+
(await lintTree(tree)).map((m) => m.ruleId);
|
|
1671
|
+
const body = `A gate runs first.\n\n${GATE_DEFINED}\n\nAgain, a \\emph{gate} blocks.`;
|
|
1672
|
+
const off = await ids(paper(tex(body)));
|
|
1673
|
+
expect(off).not.toContain("tex/term-before-definition");
|
|
1674
|
+
expect(off).not.toContain("tex/term-defined-twice");
|
|
1675
|
+
const on = await ids(paper(tex(body), TERMS_ON));
|
|
1676
|
+
expect(on).toContain("tex/term-before-definition");
|
|
1677
|
+
expect(on).toContain("tex/term-defined-twice");
|
|
1678
|
+
});
|
|
1679
|
+
});
|
|
1680
|
+
|
|
1561
1681
|
describe("study/declare-sample is off by default", () => {
|
|
1562
1682
|
it("is silent on an empty prereg.json until the paper turns it on", async () => {
|
|
1563
1683
|
const study = {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two term rules as ESLint calls them, on a paper directory in a temp folder: what each reports,
|
|
3
|
+
* with its message filled, where the definition it names stands, and what the options change.
|
|
4
|
+
*/
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { describe, expect, it } from "vitest";
|
|
7
|
+
import { latexReader } from "./adapters/latex/index.ts";
|
|
8
|
+
import { nodeFiles } from "./adapters/node/index.ts";
|
|
9
|
+
import { sourcesCodec } from "./adapters/sources-record/index.ts";
|
|
10
|
+
import { DEFAULT_TERM_OPTIONS } from "./domain/term-definitions.ts";
|
|
11
|
+
import { findingText } from "./tex-paper.ts";
|
|
12
|
+
import {
|
|
13
|
+
termDefinitionRules,
|
|
14
|
+
termOptionsOf,
|
|
15
|
+
type TermRuleName,
|
|
16
|
+
} from "./term-definition-rules.ts";
|
|
17
|
+
import { useTempDir } from "../test/support.ts";
|
|
18
|
+
|
|
19
|
+
const DEPS = { files: nodeFiles, latex: latexReader, codec: sourcesCodec };
|
|
20
|
+
|
|
21
|
+
/** What `name` reports on `src` as the paper.tex of a fresh folder: each as `line: message`. */
|
|
22
|
+
const reported = (
|
|
23
|
+
name: TermRuleName,
|
|
24
|
+
src: string,
|
|
25
|
+
options: readonly unknown[] = [],
|
|
26
|
+
raw = true,
|
|
27
|
+
): readonly string[] => {
|
|
28
|
+
const dir = useTempDir("paperlint-term-rules-");
|
|
29
|
+
const seen: string[] = [];
|
|
30
|
+
const rule = termDefinitionRules(DEPS)[name];
|
|
31
|
+
const messages = rule.meta.messages;
|
|
32
|
+
rule
|
|
33
|
+
.create({
|
|
34
|
+
filename: join(dir, "paper.tex"),
|
|
35
|
+
options,
|
|
36
|
+
sourceCode: {
|
|
37
|
+
text: src,
|
|
38
|
+
...(raw ? { raw: src } : {}),
|
|
39
|
+
getLocFromIndex: (i: number) => ({
|
|
40
|
+
line: src.slice(0, i).split("\n").length,
|
|
41
|
+
column: 0,
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
report: (d) => {
|
|
45
|
+
const text =
|
|
46
|
+
"messageId" in d
|
|
47
|
+
? findingText(messages, {
|
|
48
|
+
messageId: d.messageId,
|
|
49
|
+
data: d.data ?? {},
|
|
50
|
+
at: null,
|
|
51
|
+
})
|
|
52
|
+
: d.message;
|
|
53
|
+
seen.push(`${String(d.loc.start.line)}: ${text}`);
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
.root?.();
|
|
57
|
+
return seen;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const doc = (body: string): string =>
|
|
61
|
+
`\\documentclass{article}\n\\begin{document}\n${body}\n\\end{document}\n`;
|
|
62
|
+
|
|
63
|
+
describe("tex/term-before-definition", () => {
|
|
64
|
+
it("🔴 at the first earlier use: the term, the command, where it is defined, how many uses come before", () => {
|
|
65
|
+
expect(
|
|
66
|
+
reported(
|
|
67
|
+
"term-before-definition",
|
|
68
|
+
doc("A gate runs.\nEvery gate blocks.\n\nA \\emph{gate} is a check."),
|
|
69
|
+
),
|
|
70
|
+
).toEqual([
|
|
71
|
+
"3: «gate» is used here before its definition (\\emph at paper.tex:6; 2 earlier use(s) outside the abstract). Move the definition to this first use, or say here in plain words what it means.",
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("🔴 on a body that sets no term with the commands, it says it checks nothing — at the body's start", () => {
|
|
76
|
+
expect(
|
|
77
|
+
reported(
|
|
78
|
+
"term-before-definition",
|
|
79
|
+
doc("A gate runs. A \\textit{gate} is a check."),
|
|
80
|
+
),
|
|
81
|
+
).toEqual([
|
|
82
|
+
"3: this rule is on, and no term in the body is set with \\emph: it checks nothing in this paper. Mark each definition with \\emph, or turn the rule off.",
|
|
83
|
+
]);
|
|
84
|
+
expect(
|
|
85
|
+
reported("term-before-definition", doc(""), [
|
|
86
|
+
{ commands: ["textit", "em"] },
|
|
87
|
+
]),
|
|
88
|
+
).toEqual([
|
|
89
|
+
"1: this rule is on, and no term in the body is set with \\textit, \\em: it checks nothing in this paper. Mark each definition with \\textit, or turn the rule off.",
|
|
90
|
+
]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("the options name the commands and the longest phrase read as a definition", () => {
|
|
94
|
+
expect(
|
|
95
|
+
reported(
|
|
96
|
+
"term-before-definition",
|
|
97
|
+
doc("A gate runs. A \\textit{gate} is a check."),
|
|
98
|
+
[{ commands: ["textit"], maxWords: 1 }],
|
|
99
|
+
),
|
|
100
|
+
).toEqual([
|
|
101
|
+
"3: «gate» is used here before its definition (\\textit at paper.tex:3; 1 earlier use(s) outside the abstract). Move the definition to this first use, or say here in plain words what it means.",
|
|
102
|
+
]);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("reads the paper's text when the language gives no raw source", () => {
|
|
106
|
+
expect(
|
|
107
|
+
reported(
|
|
108
|
+
"term-before-definition",
|
|
109
|
+
doc("A \\emph{gate} is a check."),
|
|
110
|
+
[],
|
|
111
|
+
false,
|
|
112
|
+
),
|
|
113
|
+
).toEqual([]);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe("tex/term-defined-twice", () => {
|
|
118
|
+
it("🔴 at each later definition, naming where the first one stands", () => {
|
|
119
|
+
expect(
|
|
120
|
+
reported(
|
|
121
|
+
"term-defined-twice",
|
|
122
|
+
doc("A \\emph{gate} is a check.\n\nA \\emph{gate}, again, blocks."),
|
|
123
|
+
),
|
|
124
|
+
).toEqual([
|
|
125
|
+
"5: «gate» is set as a definition again; it was first defined at paper.tex:3. Keep one definition and set later mentions in roman, or point back to the first one.",
|
|
126
|
+
]);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("silent on a body that defines each term once", () => {
|
|
130
|
+
expect(
|
|
131
|
+
reported("term-defined-twice", doc("A \\emph{gate} is a check.")),
|
|
132
|
+
).toEqual([]);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe("termOptionsOf — the options, and the defaults for what they leave out", () => {
|
|
137
|
+
it("no options, an empty list or a missing field: the defaults", () => {
|
|
138
|
+
expect([
|
|
139
|
+
termOptionsOf(undefined),
|
|
140
|
+
termOptionsOf([]),
|
|
141
|
+
termOptionsOf([{ commands: [] }]),
|
|
142
|
+
termOptionsOf([{ maxWords: 2 }]),
|
|
143
|
+
]).toEqual([
|
|
144
|
+
DEFAULT_TERM_OPTIONS,
|
|
145
|
+
DEFAULT_TERM_OPTIONS,
|
|
146
|
+
DEFAULT_TERM_OPTIONS,
|
|
147
|
+
{ commands: ["emph"], maxWords: 2 },
|
|
148
|
+
]);
|
|
149
|
+
});
|
|
150
|
+
});
|