paperlint 18.2.2 → 18.3.1
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/dist/readability.d.ts +12 -9
- package/dist/readability.d.ts.map +1 -1
- package/dist/readability.js +3 -3
- package/dist/readability.js.map +1 -1
- package/dist/skills/pc-panel-review/scripts/prior-reviews-core.d.ts +19 -0
- package/dist/skills/pc-panel-review/scripts/prior-reviews.d.ts +2 -0
- package/docs/optional-rules.md +2 -2
- package/docs/rules/tex/max-paragraph-numbers.md +13 -7
- package/docs/rules/tex/max-paragraph-words.md +17 -28
- package/docs/rules.md +2 -2
- package/package.json +1 -1
- package/scripts/grow-real-papers/archive.test.ts +294 -0
- package/scripts/grow-real-papers/archive.ts +287 -0
- package/scripts/grow-real-papers/collect.test.ts +329 -0
- package/scripts/grow-real-papers/collect.ts +316 -0
- package/scripts/grow-real-papers/http.test.ts +95 -0
- package/scripts/grow-real-papers/http.ts +76 -0
- package/scripts/grow-real-papers/main.test.ts +295 -0
- package/scripts/grow-real-papers/main.ts +221 -0
- package/scripts/grow-real-papers/paper.test.ts +305 -0
- package/scripts/grow-real-papers/paper.ts +241 -0
- package/scripts/grow-real-papers/rules.test.ts +222 -0
- package/scripts/grow-real-papers/rules.ts +250 -0
- package/scripts/grow-real-papers/sources.test.ts +275 -0
- package/scripts/grow-real-papers/sources.ts +239 -0
- package/scripts/grow-real-papers/testkit.ts +79 -0
- package/skills/pc-panel-review/SKILL.md +18 -11
- package/skills/pc-panel-review/SKILL.md.spec.ts +17 -10
- package/skills/pc-panel-review/scripts/prior-reviews-core.js +44 -0
- package/skills/pc-panel-review/scripts/prior-reviews-core.ts +66 -0
- package/skills/pc-panel-review/scripts/prior-reviews.js +14 -0
- package/skills/pc-panel-review/scripts/prior-reviews.test.ts +206 -0
- package/skills/pc-panel-review/scripts/prior-reviews.ts +19 -0
- package/src/readability.test.ts +44 -41
- package/src/readability.ts +12 -9
- package/src/rule-cases.test.ts +6 -6
package/dist/readability.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THE PARAGRAPH CEILING — `tex/max-paragraph-words`, a rule of the `tex` plugin over the body's
|
|
3
|
-
* prose: a paragraph runs past `max` words (default
|
|
3
|
+
* prose: a paragraph runs past `max` words (default 250).
|
|
4
4
|
*
|
|
5
5
|
* ── OFF BY DEFAULT ───────────────────────────────────────────────────────────────
|
|
6
6
|
* No call for papers states a paragraph limit, so no venue is a source for the number. The rule is
|
|
7
7
|
* registered and silent until a project turns it on in its `rules`, as `tex/heading-case` is. The
|
|
8
8
|
* name and the `max` option follow ESLint's own `max-lines`, `max-len`, `max-statements`.
|
|
9
9
|
*
|
|
10
|
-
* ── WHERE
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* ── WHERE 250 COMES FROM ─────────────────────────────────────────────────────────
|
|
11
|
+
* The 99th percentile of paragraph length over the accepted real papers in
|
|
12
|
+
* `fixtures/real-papers/accepted/` (96 papers with at least 2,500 body words, 7,994 paragraphs,
|
|
13
|
+
* measured with this rule's counter): p99 is 252, so 250 leaves about 1% of accepted paragraphs
|
|
14
|
+
* over it. The author chose it on 2026-11-20. It rests on what 99% of accepted paragraphs pass, not
|
|
15
|
+
* on reviewer evidence: a pilot on ICLR 2025 presentation scores found no link between long
|
|
16
|
+
* paragraphs and the score (inconclusive). The measurement is on the rule's page. A paragraph is
|
|
17
|
+
* at most `max` words; 250 is allowed.
|
|
15
18
|
*
|
|
16
19
|
* ── WHAT IT READS ────────────────────────────────────────────────────────────────
|
|
17
20
|
* The body's prose through the `LatexReader` port (`bodyProse`): paragraphs, list items and
|
|
@@ -25,9 +28,9 @@ import type { Caption, Passage } from "./domain/tex-document.ts";
|
|
|
25
28
|
import { type ProseDeps } from "./tex-paper.ts";
|
|
26
29
|
import { type Located, type TexRuleModule } from "./tex-venue-rules.ts";
|
|
27
30
|
/** The ceiling when the config sets none: the largest paragraph that does not fire. */
|
|
28
|
-
export declare const DEFAULT_MAX_PARAGRAPH_WORDS =
|
|
29
|
-
/** The numbers ceiling when the config sets none:
|
|
30
|
-
export declare const DEFAULT_MAX_PARAGRAPH_NUMBERS =
|
|
31
|
+
export declare const DEFAULT_MAX_PARAGRAPH_WORDS = 250;
|
|
32
|
+
/** The numbers ceiling when the config sets none: an eleventh number fires. */
|
|
33
|
+
export declare const DEFAULT_MAX_PARAGRAPH_NUMBERS = 10;
|
|
31
34
|
/** The sentence ceiling when the config sets none: a 56th word fires. */
|
|
32
35
|
export declare const DEFAULT_MAX_SENTENCE_WORDS = 55;
|
|
33
36
|
/** The caption ceiling when the config sets none: a 101st word fires. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readability.d.ts","sourceRoot":"","sources":["../src/readability.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"readability.d.ts","sourceRoot":"","sources":["../src/readability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAWjE,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B,uFAAuF;AACvF,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,+EAA+E;AAC/E,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,iFAAiF;AACjF,eAAO,MAAM,kCAAkC,KAAK,CAAC;AASrD,sDAAsD;AACtD,eAAO,MAAM,mBAAmB,GAC9B,UAAU,SAAS,OAAO,EAAE,EAC5B,KAAK,MAAM,KACV,SAAS,OAAO,EAiBf,CAAC;AAEL,uGAAuG;AACvG,wBAAgB,KAAK,CACnB,OAAO,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,EACvC,QAAQ,GAAE,MAAoC,GAC7C,MAAM,CAER;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,OAAO,KAAG,MAC+B,CAAC;AAEvE,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,GAChC,UAAU,SAAS,OAAO,EAAE,EAC5B,KAAK,MAAM,KACV,SAAS,OAAO,EAoBf,CAAC;AAEL,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,GAC7B,UAAU,SAAS,OAAO,EAAE,EAC5B,KAAK,MAAM,KACV,SAAS,OAAO,EAOZ,CAAC;AAER;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,SAAS,OAAO,EAAE,EAC5B,KAAK,MAAM,EACX,aAAa,MAAM,KAClB,SAAS,OAAO,EAIf,CAAC;AAoEL,eAAO,MAAM,mBAAmB,GAAI,MAAM,SAAS,KAAG,aAiBpD,CAAC;AAsDH,2GAA2G;AAC3G,eAAO,MAAM,qBAAqB,GAAI,MAAM,SAAS,KAAG,aASrD,CAAC;AAEJ,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,GAAI,MAAM,SAAS,KAAG,aASvD,CAAC;AAEJ,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,GAAI,MAAM,SAAS,KAAG,aASpD,CAAC"}
|
package/dist/readability.js
CHANGED
|
@@ -7,9 +7,9 @@ import { startOf } from "./register.js";
|
|
|
7
7
|
import { readPaper, reportInPaper } from "./tex-paper.js";
|
|
8
8
|
import { ruleDocsUrl, } from "./tex-venue-rules.js";
|
|
9
9
|
/** The ceiling when the config sets none: the largest paragraph that does not fire. */
|
|
10
|
-
export const DEFAULT_MAX_PARAGRAPH_WORDS =
|
|
11
|
-
/** The numbers ceiling when the config sets none:
|
|
12
|
-
export const DEFAULT_MAX_PARAGRAPH_NUMBERS =
|
|
10
|
+
export const DEFAULT_MAX_PARAGRAPH_WORDS = 250;
|
|
11
|
+
/** The numbers ceiling when the config sets none: an eleventh number fires. */
|
|
12
|
+
export const DEFAULT_MAX_PARAGRAPH_NUMBERS = 10;
|
|
13
13
|
/** The sentence ceiling when the config sets none: a 56th word fires. */
|
|
14
14
|
export const DEFAULT_MAX_SENTENCE_WORDS = 55;
|
|
15
15
|
/** The caption ceiling when the config sets none: a 101st word fires. */
|
package/dist/readability.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readability.js","sourceRoot":"","sources":["../src/readability.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readability.js","sourceRoot":"","sources":["../src/readability.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EACL,aAAa,EACb,OAAO,GAER,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EACL,WAAW,GAGZ,MAAM,sBAAsB,CAAC;AAE9B,uFAAuF;AACvF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEhD,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,yEAAyE;AACzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,iFAAiF;AACjF,MAAM,CAAC,MAAM,kCAAkC,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AC1B,EACD,IAAI,CACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Files } from "#src/ports/files";
|
|
2
|
+
/** What the command prints, and its exit code. */
|
|
3
|
+
export interface SeatVerdict {
|
|
4
|
+
readonly code: number;
|
|
5
|
+
readonly line: string;
|
|
6
|
+
}
|
|
7
|
+
/** The seat's verdict for the paper in `dir`. */
|
|
8
|
+
export declare function seatVerdict(dir: string, deps: {
|
|
9
|
+
readonly files: Files;
|
|
10
|
+
}): SeatVerdict;
|
|
11
|
+
/** Where the command writes. */
|
|
12
|
+
export interface Output {
|
|
13
|
+
readonly out: (s: string) => void;
|
|
14
|
+
readonly err: (s: string) => void;
|
|
15
|
+
}
|
|
16
|
+
/** Run the command on `argv`; the exit code. */
|
|
17
|
+
export declare function main(argv: readonly string[], deps: {
|
|
18
|
+
readonly files: Files;
|
|
19
|
+
}, { out, err }: Output): number;
|
package/docs/optional-rules.md
CHANGED
|
@@ -33,8 +33,8 @@ writing, not a number the venue states.
|
|
|
33
33
|
| [`tex/claim-emphasis`](rules/tex/claim-emphasis.md) | claims set in bold inside a sentence outside that band |
|
|
34
34
|
| [`tex/relation-markers`](rules/tex/relation-markers.md) | words naming how a sentence relates to the one before (_because_, _however_ …) outside that band |
|
|
35
35
|
| [`tex/negated-sentences`](rules/tex/negated-sentences.md) | negated sentences outside that band |
|
|
36
|
-
| [`tex/max-paragraph-words`](rules/tex/max-paragraph-words.md) | a paragraph over
|
|
37
|
-
| [`tex/max-paragraph-numbers`](rules/tex/max-paragraph-numbers.md) | a paragraph holding more than
|
|
36
|
+
| [`tex/max-paragraph-words`](rules/tex/max-paragraph-words.md) | a paragraph over 250 words |
|
|
37
|
+
| [`tex/max-paragraph-numbers`](rules/tex/max-paragraph-numbers.md) | a paragraph holding more than 10 numbers |
|
|
38
38
|
| [`tex/max-sentence-words`](rules/tex/max-sentence-words.md) | a sentence over 55 words |
|
|
39
39
|
| [`tex/max-caption-words`](rules/tex/max-caption-words.md) | a caption over 100 words, or a caption sentence over 40 |
|
|
40
40
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## What it catches
|
|
6
6
|
|
|
7
|
-
A paragraph of the body with more than `max` numbers (default
|
|
7
|
+
A paragraph of the body with more than `max` numbers (default 10, so an eleventh fires). It reports once per paragraph, at its start, with the count and the paragraph's first words.
|
|
8
8
|
|
|
9
9
|
## How it counts
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ so no venue preset carries the number. In the root `paperlint.json`, or in one p
|
|
|
22
22
|
|
|
23
23
|
```json
|
|
24
24
|
{
|
|
25
|
-
"rules": { "tex/max-paragraph-numbers": ["warn", { "max":
|
|
25
|
+
"rules": { "tex/max-paragraph-numbers": ["warn", { "max": 10 }] }
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -32,19 +32,25 @@ See [optional rules](../../optional-rules.md).
|
|
|
32
32
|
|
|
33
33
|
A paragraph with many figures reads as a table written in prose; the reader cannot hold them.
|
|
34
34
|
|
|
35
|
-
The default is
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
The default is the 99th percentile per unit over the accepted real papers in
|
|
36
|
+
`fixtures/real-papers/accepted/` (96 papers with at least 2,500 body words, 7,994 paragraphs,
|
|
37
|
+
measured with this rule's counter). The author chose it on 2026-11-20.
|
|
38
|
+
|
|
39
|
+
| unit | accepted p95 | p99 | p99.9 | old default | default | units over the old default | papers quiet at the old default |
|
|
40
|
+
| --------------------- | -----------: | --: | ----: | ----------: | ------: | -------------------------: | ------------------------------: |
|
|
41
|
+
| numbers per paragraph | 5 | 10 | 19 | 8 | 10 | 1.66% | 49/96 |
|
|
42
|
+
|
|
43
|
+
A pilot on ICLR 2025 reviewer presentation scores (30 papers per side) found no link between numbers per paragraph and the score (inconclusive; Cliff's delta for the share of sentences over 55 words -0.12, CI [-0.39, +0.18]), so the default rests on what 99% of accepted units pass, not on reviewer evidence.
|
|
38
44
|
|
|
39
45
|
## Examples
|
|
40
46
|
|
|
41
47
|
```latex
|
|
42
|
-
In 2023 we saw 1, 2, 3, 4, 5, 6, 7, 8 and
|
|
48
|
+
In 2023 we saw 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11 cases ... % fires: eleven numbers
|
|
43
49
|
```
|
|
44
50
|
|
|
45
51
|
## Options / preset fields
|
|
46
52
|
|
|
47
|
-
`{ "max":
|
|
53
|
+
`{ "max": 10 }` — an integer, the largest value that does not fire. No preset field.
|
|
48
54
|
|
|
49
55
|
## What it does not check
|
|
50
56
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## What it catches
|
|
6
6
|
|
|
7
|
-
A paragraph of the body longer than `max` words (default
|
|
7
|
+
A paragraph of the body longer than `max` words (default 250; 250 itself is allowed). It reports once
|
|
8
8
|
per paragraph, at its start, with the word count and the paragraph's first words.
|
|
9
9
|
|
|
10
10
|
Words are counted as [`tex/register`](register.md) counts them: a citation, a cross-reference or
|
|
@@ -19,7 +19,7 @@ limit, so no venue preset can carry the number; it is a project's own choice. In
|
|
|
19
19
|
|
|
20
20
|
```json
|
|
21
21
|
{
|
|
22
|
-
"rules": { "tex/max-paragraph-words": ["warn", { "max":
|
|
22
|
+
"rules": { "tex/max-paragraph-words": ["warn", { "max": 250 }] }
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -29,45 +29,34 @@ or in one paper's own `paperlint.json`, for that paper alone. See
|
|
|
29
29
|
## Why
|
|
30
30
|
|
|
31
31
|
A reader sees a paragraph's length before reading a word. A page-long block is skimmed past, and what
|
|
32
|
-
the argument turns on in the middle of it is lost.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| `rr-dataset-quality-acsac24` (ACSAC 2024) | IEEE two-column | 117 | 50 | 209 | 262 | 431 | 12 |
|
|
44
|
-
| `leaking-queries-acsac25` (ACSAC 2025) | IEEE two-column | 99 | 87 | 170 | 213 | 213 | 11 |
|
|
45
|
-
| pooled, the five IEEE papers | IEEE two-column | 608 | 63 | 154 | 214 | 431 | 38 |
|
|
46
|
-
| `agenticdev-acm26` (AgenticDev '26) | ACM sigconf | 43 | 90 | 194 | 282 | 282 | 9 |
|
|
47
|
-
| pooled, all six | | 651 | 63 | 157 | 214 | 431 | 47 |
|
|
48
|
-
|
|
49
|
-
150 sits at the pooled 95th percentile of the five IEEE papers (154), so it is **not quiet on
|
|
50
|
-
accepted papers**: about one paragraph in twenty of an accepted paper is over it. That is why the
|
|
51
|
-
rule is off by default and why accepted papers are not in the rule's baseline. The one ACM paper has
|
|
52
|
-
a longer median (90 words against 63); one paper cannot set a ceiling, so a project that wants its
|
|
53
|
-
own number sets `max`.
|
|
32
|
+
the argument turns on in the middle of it is lost.
|
|
33
|
+
|
|
34
|
+
The default is the 99th percentile per unit over the accepted real papers in
|
|
35
|
+
`fixtures/real-papers/accepted/` (96 papers with at least 2,500 body words, 7,994 paragraphs,
|
|
36
|
+
measured with this rule's counter). The author chose it on 2026-11-20.
|
|
37
|
+
|
|
38
|
+
| unit | accepted p95 | p99 | p99.9 | old default | default | units over the old default | papers quiet at the old default |
|
|
39
|
+
| --------------- | -----------: | --: | ----: | ----------: | ------: | -------------------------: | ------------------------------: |
|
|
40
|
+
| paragraph words | 184 | 252 | 344 | 150 | 250 | 10.02% | 0/96 |
|
|
41
|
+
|
|
42
|
+
A pilot on ICLR 2025 reviewer presentation scores (30 papers per side) found no link between long sentences or paragraphs and the score (inconclusive; Cliff's delta for the share of sentences over 55 words -0.12, CI [-0.39, +0.18]), so the default rests on what 99% of accepted units pass, not on reviewer evidence.
|
|
54
43
|
|
|
55
44
|
## Examples
|
|
56
45
|
|
|
57
46
|
```latex
|
|
58
|
-
A paragraph of
|
|
59
|
-
the dataset, its size and its limits all in one block ... % fires: over
|
|
47
|
+
A paragraph of three hundred words that states the method, the three baselines, the metric,
|
|
48
|
+
the dataset, its size and its limits all in one block ... % fires: over 250 words
|
|
60
49
|
|
|
61
50
|
The method has three parts. % passes
|
|
62
51
|
```
|
|
63
52
|
|
|
64
53
|
## Options / preset fields
|
|
65
54
|
|
|
66
|
-
`{ "max":
|
|
55
|
+
`{ "max": 250 }` — an integer, the largest paragraph that does not fire. No preset field.
|
|
67
56
|
|
|
68
57
|
## What it does not check
|
|
69
58
|
|
|
70
|
-
How wide the column is. The wall a reader meets is in the rendered PDF, where
|
|
59
|
+
How wide the column is. The wall a reader meets is in the rendered PDF, where 250 words fill more of
|
|
71
60
|
a narrow two-column page than of a one-column one; the rule counts words, not lines. A paragraph that
|
|
72
61
|
is a list in disguise is counted as written. A sentence is split where `tex/register` splits it.
|
|
73
62
|
|
package/docs/rules.md
CHANGED
|
@@ -49,8 +49,8 @@ reads and when it fails. Errors fail `paperlint lint`; warnings print and do not
|
|
|
49
49
|
| [`tex/claim-emphasis`](rules/tex/claim-emphasis.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes → `paperlint.json` | claims set in bold inside a sentence (six words or more, or holding a number; not a term, not a label opening a paragraph) per 10,000 words fall outside the preset's band (AIDC: 0–17.8); above it, each is reported too — [page](rules/tex/claim-emphasis.md) |
|
|
50
50
|
| [`tex/relation-markers`](rules/tex/relation-markers.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes → `paperlint.json` | words that name how a sentence relates to the one before (_because_, _therefore_, _however_, _for example_ …) per 10,000 words fall outside the preset's band (AIDC: 25.4–135.0) — the floor that catches relations left to infer — [page](rules/tex/relation-markers.md) |
|
|
51
51
|
| [`tex/negated-sentences`](rules/tex/negated-sentences.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes → `paperlint.json` | the share of body sentences holding a negator (_not_, _no_, _never_, _without_ …) falls outside the preset's band (AIDC: 2.9–21.7%, from five accepted ACSAC papers); _X, not Y_ is counted here and by `tex/contrast-frames` — [page](rules/tex/negated-sentences.md) |
|
|
52
|
-
| [`tex/max-paragraph-words`](rules/tex/max-paragraph-words.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes | a paragraph of the body runs past `max` words (default
|
|
53
|
-
| [`tex/max-paragraph-numbers`](rules/tex/max-paragraph-numbers.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes | a paragraph of the body holds more than `max` numbers (default
|
|
52
|
+
| [`tex/max-paragraph-words`](rules/tex/max-paragraph-words.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes | a paragraph of the body runs past `max` words (default 250, the accepted papers' 99th percentile) — a wall of text; no call for papers states a limit — [page](rules/tex/max-paragraph-words.md) |
|
|
53
|
+
| [`tex/max-paragraph-numbers`](rules/tex/max-paragraph-numbers.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes | a paragraph of the body holds more than `max` numbers (default 10, the accepted papers' 99th percentile) — a table written in prose — [page](rules/tex/max-paragraph-numbers.md) |
|
|
54
54
|
| [`tex/max-sentence-words`](rules/tex/max-sentence-words.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes | a sentence of the body runs past `max` words (default 55) — [page](rules/tex/max-sentence-words.md) |
|
|
55
55
|
| [`tex/max-caption-words`](rules/tex/max-caption-words.md) | opt-in: `paperlint:writing` | `paper.tex` and the files it includes | a caption runs past `max` words (default 100), or one of its sentences past `maxSentence` (default 40) — [page](rules/tex/max-caption-words.md) |
|
|
56
56
|
| [`tex/term-before-definition`](rules/tex/term-before-definition.md) | optional; off until a project turns it on | `paper.tex` and the files it includes | a term the body defines (an `\emph` phrase of 1–4 words, by default) is used before that definition; reported once, at the first earlier use — [page](rules/tex/term-before-definition.md) |
|
package/package.json
CHANGED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The source archive: reading the e-print, choosing what a paper keeps and where, and the record
|
|
3
|
+
* of what was staged. The archives are built in memory by `testkit.ts`.
|
|
4
|
+
*/
|
|
5
|
+
import { gzipSync } from "node:zlib";
|
|
6
|
+
import { describe, expect, test } from "vitest";
|
|
7
|
+
import {
|
|
8
|
+
jsonOf,
|
|
9
|
+
recordOf,
|
|
10
|
+
sha256,
|
|
11
|
+
stagingPlan,
|
|
12
|
+
toplevelOf,
|
|
13
|
+
unpack,
|
|
14
|
+
untar,
|
|
15
|
+
} from "./archive.ts";
|
|
16
|
+
import { file, mainTex, tar, tarGz, text } from "./testkit.ts";
|
|
17
|
+
|
|
18
|
+
const paths = (fs: readonly { path: string }[]) => fs.map((f) => f.path);
|
|
19
|
+
|
|
20
|
+
describe("unpack", () => {
|
|
21
|
+
test("keeps regular files at safe paths, under their long names", () => {
|
|
22
|
+
const files = untar(
|
|
23
|
+
tar([
|
|
24
|
+
{ name: "./main.tex", body: "m" },
|
|
25
|
+
{ name: "sec.tex", prefix: "ACL2026", body: "s" },
|
|
26
|
+
{
|
|
27
|
+
name: "././@LongLink",
|
|
28
|
+
type: "L",
|
|
29
|
+
body: `${"d/".repeat(60)}long.tex\0`,
|
|
30
|
+
},
|
|
31
|
+
{ name: "truncated", body: "l" },
|
|
32
|
+
{
|
|
33
|
+
name: "PaxHeader/short.bib",
|
|
34
|
+
type: "x",
|
|
35
|
+
body: "30 path=pax/named.bib\n",
|
|
36
|
+
},
|
|
37
|
+
{ name: "short.bib", body: "p" },
|
|
38
|
+
{ name: "PaxHeader/nul.sty", type: "x", body: "20 mtime=1700000000\n" },
|
|
39
|
+
{ name: "nul.sty", type: "\0", body: "n" },
|
|
40
|
+
{ name: "../escape.tex", body: "e" },
|
|
41
|
+
{ name: "/abs.tex", body: "a" },
|
|
42
|
+
{ name: "./", body: "" },
|
|
43
|
+
{ name: "link.tex", type: "2" },
|
|
44
|
+
{ name: "figs", type: "5" },
|
|
45
|
+
]),
|
|
46
|
+
);
|
|
47
|
+
// Guards: prefix and long names applied; links, directories and paths that leave the archive dropped.
|
|
48
|
+
expect(paths(files)).toEqual([
|
|
49
|
+
"main.tex",
|
|
50
|
+
"ACL2026/sec.tex",
|
|
51
|
+
`${"d/".repeat(60)}long.tex`,
|
|
52
|
+
"pax/named.bib",
|
|
53
|
+
"nul.sty",
|
|
54
|
+
]);
|
|
55
|
+
// Guards: a stream cut before the end-of-archive blocks still ends.
|
|
56
|
+
expect(
|
|
57
|
+
untar(tar([{ name: "a.tex", body: "a" }]).subarray(0, 1024)),
|
|
58
|
+
).toEqual([{ path: "a.tex", bytes: Buffer.from("a") }]);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("a gzipped tar, a lone gzipped .tex, a PDF and a broken gzip", () => {
|
|
62
|
+
const archive = unpack(tarGz([{ name: "x/main.tex", body: "t" }]));
|
|
63
|
+
// Guards: a tar's files.
|
|
64
|
+
expect(archive.ok && paths(archive.files)).toEqual(["x/main.tex"]);
|
|
65
|
+
// Guards: one gzipped file is the main file.
|
|
66
|
+
expect(unpack(gzipSync(Buffer.from("tex")))).toEqual({
|
|
67
|
+
ok: true,
|
|
68
|
+
files: [{ path: "main.tex", bytes: Buffer.from("tex") }],
|
|
69
|
+
});
|
|
70
|
+
// Guards: a PDF-only submission is rejected by name.
|
|
71
|
+
expect(unpack(Buffer.from("%PDF-1.5"))).toEqual({
|
|
72
|
+
ok: false,
|
|
73
|
+
reason: "no source: not gzip (PDF-only submission)",
|
|
74
|
+
});
|
|
75
|
+
// Guards: gzip magic over garbage is rejected, not thrown.
|
|
76
|
+
expect(unpack(Buffer.from([0x1f, 0x8b, 1, 2, 3]))).toEqual({
|
|
77
|
+
ok: false,
|
|
78
|
+
reason: "unreadable source: Error: unknown compression method",
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe("unpack — a tar this reader does not take", () => {
|
|
84
|
+
test("a tar without the ustar mark (old V7 format) is rejected, not staged as one .tex", () => {
|
|
85
|
+
const v7 = Buffer.from(
|
|
86
|
+
tar([{ name: "main.tex", body: "\\begin{document}" }]),
|
|
87
|
+
);
|
|
88
|
+
v7.fill(0, 257, 263);
|
|
89
|
+
expect(unpack(gzipSync(v7))).toEqual({
|
|
90
|
+
ok: false,
|
|
91
|
+
reason: "unreadable source: binary data, not a ustar tar",
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe("the top-level file", () => {
|
|
97
|
+
test.each([
|
|
98
|
+
[
|
|
99
|
+
"00README.json names it",
|
|
100
|
+
[
|
|
101
|
+
file(
|
|
102
|
+
"00README.json",
|
|
103
|
+
'{"sources":[{"usage":"toplevel","filename":"ACL2026/main.tex"}]}',
|
|
104
|
+
),
|
|
105
|
+
],
|
|
106
|
+
"ACL2026/main.tex",
|
|
107
|
+
],
|
|
108
|
+
[
|
|
109
|
+
"00README.json without a toplevel",
|
|
110
|
+
[file("00README.json", '{"sources":[{"filename":"a.tex"}]}')],
|
|
111
|
+
null,
|
|
112
|
+
],
|
|
113
|
+
["00README.json that is not JSON", [file("00README.json", "{")], null],
|
|
114
|
+
[
|
|
115
|
+
"a legacy 00README.XXX",
|
|
116
|
+
[file("00README.XXX", "sub/ms.tex toplevelfile\n")],
|
|
117
|
+
"sub/ms.tex",
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"a legacy 00README without one",
|
|
121
|
+
[file("00README.XXX", "nostamp\n")],
|
|
122
|
+
null,
|
|
123
|
+
],
|
|
124
|
+
["no 00README", [file("main.tex", "")], null],
|
|
125
|
+
])("%s", (_, files, named) => {
|
|
126
|
+
// Guards: what arXiv compiles first, as its own README says.
|
|
127
|
+
expect(toplevelOf(files)).toBe(named);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("jsonOf: JSON, or undefined", () => {
|
|
131
|
+
// Guards: both halves of the parse.
|
|
132
|
+
expect([jsonOf("[1]"), jsonOf("{")]).toEqual([[1], undefined]);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe("the staging plan", () => {
|
|
137
|
+
test("a main file in a subfolder is staged from the archive root, every input kept", () => {
|
|
138
|
+
// The defect the code review found in the 2026-11-20 run: staging from the main file's folder
|
|
139
|
+
// dropped `sections/intro.tex`, which arXiv resolves from the root.
|
|
140
|
+
const files = [
|
|
141
|
+
file(
|
|
142
|
+
"00README.json",
|
|
143
|
+
'{"sources":[{"usage":"toplevel","filename":"ACL2026/main.tex"}]}',
|
|
144
|
+
),
|
|
145
|
+
file("ACL2026/main.tex", mainTex("\\input{sections/intro}")),
|
|
146
|
+
file("ACL2026/main.bbl", "bbl"),
|
|
147
|
+
file("sections/intro.tex", "Intro."),
|
|
148
|
+
file("acl.sty", "sty"),
|
|
149
|
+
file("figs/plot.pdf", "pdf"),
|
|
150
|
+
];
|
|
151
|
+
const plan = stagingPlan(files);
|
|
152
|
+
// Guards: every text file at its path from the root; only the main file and its .bbl renamed.
|
|
153
|
+
expect(plan.ok && { ...plan, staged: paths(plan.staged) }).toEqual({
|
|
154
|
+
ok: true,
|
|
155
|
+
main: "ACL2026/main.tex",
|
|
156
|
+
mainText: mainTex("\\input{sections/intro}"),
|
|
157
|
+
mainCandidates: 1,
|
|
158
|
+
staged: ["paper.tex", "paper.bbl", "sections/intro.tex", "acl.sty"],
|
|
159
|
+
renames: [
|
|
160
|
+
"ACL2026/main.tex to paper.tex",
|
|
161
|
+
"ACL2026/main.bbl to paper.bbl",
|
|
162
|
+
],
|
|
163
|
+
edits: [],
|
|
164
|
+
size: mainTex("\\input{sections/intro}").length + 3 + 6 + 3,
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("without a README: main/paper/ms first, else the largest candidate", () => {
|
|
169
|
+
const named = stagingPlan([
|
|
170
|
+
file("big.tex", mainTex("x".repeat(100))),
|
|
171
|
+
file("ms.tex", mainTex("")),
|
|
172
|
+
file("notmain.tex", "\\documentclass{article} % \\begin{document}"),
|
|
173
|
+
]);
|
|
174
|
+
// Guards: a conventional name beats size; a file whose \begin{document} is commented out is no candidate.
|
|
175
|
+
expect(named.ok && [named.main, named.mainCandidates]).toEqual([
|
|
176
|
+
"ms.tex",
|
|
177
|
+
2,
|
|
178
|
+
]);
|
|
179
|
+
const largest = stagingPlan([
|
|
180
|
+
file("a.tex", mainTex("")),
|
|
181
|
+
file("b.tex", mainTex("longer")),
|
|
182
|
+
]);
|
|
183
|
+
// Guards: else the largest.
|
|
184
|
+
expect(largest.ok && largest.main).toBe("b.tex");
|
|
185
|
+
// Guards: no candidate at all is a rejection.
|
|
186
|
+
expect(stagingPlan([file("a.bib", "")])).toEqual({
|
|
187
|
+
ok: false,
|
|
188
|
+
reason: "no main .tex found",
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe("renaming the main file", () => {
|
|
194
|
+
test("a wrapper's \\input of the main file is rewritten to paper", () => {
|
|
195
|
+
const plan = stagingPlan([
|
|
196
|
+
file("00README.XXX", "doc.tex toplevelfile"),
|
|
197
|
+
file("doc.tex", mainTex("body")),
|
|
198
|
+
file("wrap.tex", "\\input{doc}\\include{doc.tex}\\input{other}"),
|
|
199
|
+
file("paper.tex.bak", "dropped"),
|
|
200
|
+
]);
|
|
201
|
+
// Guards: each rewrite noted, the wrapper's bytes changed, other inputs untouched.
|
|
202
|
+
expect(
|
|
203
|
+
plan.ok && {
|
|
204
|
+
edits: plan.edits,
|
|
205
|
+
wrap: plan.staged.filter((f) => f.path === "wrap.tex").map(text),
|
|
206
|
+
},
|
|
207
|
+
).toEqual({
|
|
208
|
+
edits: [
|
|
209
|
+
"\\input{doc} to \\input{paper}",
|
|
210
|
+
"\\include{doc.tex} to \\include{paper.tex}",
|
|
211
|
+
],
|
|
212
|
+
wrap: ["\\input{paper}\\include{paper.tex}\\input{other}"],
|
|
213
|
+
});
|
|
214
|
+
const already = stagingPlan([
|
|
215
|
+
file("paper.tex", mainTex("")),
|
|
216
|
+
file("w.tex", "\\input{paper}"),
|
|
217
|
+
]);
|
|
218
|
+
// Guards: a main file already called paper.tex needs no rename and no edit.
|
|
219
|
+
expect(already.ok && [already.renames, already.edits]).toEqual([[], []]);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
describe("renaming the main file onto a file the archive already has", () => {
|
|
224
|
+
test("an archive with its own paper.tex or paper.bbl besides another main is rejected", () => {
|
|
225
|
+
const readme = file("00README.XXX", "main.tex toplevelfile");
|
|
226
|
+
// Guards: two files would be staged as paper.tex, and one would be lost.
|
|
227
|
+
expect(
|
|
228
|
+
stagingPlan([
|
|
229
|
+
readme,
|
|
230
|
+
file("main.tex", mainTex("")),
|
|
231
|
+
file("paper.tex", "x"),
|
|
232
|
+
]),
|
|
233
|
+
).toEqual({ ok: false, reason: "two files would be staged as paper.tex" });
|
|
234
|
+
// Guards: the same for the .bbl.
|
|
235
|
+
expect(
|
|
236
|
+
stagingPlan([
|
|
237
|
+
readme,
|
|
238
|
+
file("main.tex", mainTex("")),
|
|
239
|
+
file("main.bbl", ""),
|
|
240
|
+
file("paper.bbl", ""),
|
|
241
|
+
]),
|
|
242
|
+
).toEqual({ ok: false, reason: "two files would be staged as paper.bbl" });
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
describe("record-by-hand.json", () => {
|
|
247
|
+
test("paper.tex, root class and style files, then inputs depth first, hashed", () => {
|
|
248
|
+
const staged = [
|
|
249
|
+
file(
|
|
250
|
+
"paper.tex",
|
|
251
|
+
mainTex(
|
|
252
|
+
"\\input{./a}\\include{b.tex}\\input{a}% \\input{c}\n\\input{gone}",
|
|
253
|
+
),
|
|
254
|
+
),
|
|
255
|
+
file("a.tex", "\\input{sub/d}"),
|
|
256
|
+
file("sub/d.tex", "d"),
|
|
257
|
+
file("b.tex", "b"),
|
|
258
|
+
file("c.tex", "c"),
|
|
259
|
+
file("z.sty", "z"),
|
|
260
|
+
file("acl.cls", "k"),
|
|
261
|
+
file("styles/nested.sty", "n"),
|
|
262
|
+
];
|
|
263
|
+
const hash = (p: string) =>
|
|
264
|
+
sha256(staged.find((f) => f.path === p)?.bytes ?? new Uint8Array());
|
|
265
|
+
const order = [
|
|
266
|
+
"paper.tex",
|
|
267
|
+
"acl.cls",
|
|
268
|
+
"z.sty",
|
|
269
|
+
"a.tex",
|
|
270
|
+
"sub/d.tex",
|
|
271
|
+
"b.tex",
|
|
272
|
+
];
|
|
273
|
+
// Guards: the order and roles a reader audits, no repeat, a commented or missing input left out.
|
|
274
|
+
expect(recordOf(staged)).toEqual({
|
|
275
|
+
schema: 1,
|
|
276
|
+
inputs: [
|
|
277
|
+
{ path: "paper.tex", role: "body" },
|
|
278
|
+
{ path: "acl.cls", role: "preamble" },
|
|
279
|
+
{ path: "z.sty", role: "preamble" },
|
|
280
|
+
{ path: "a.tex", role: "body" },
|
|
281
|
+
{ path: "sub/d.tex", role: "body" },
|
|
282
|
+
{ path: "b.tex", role: "body" },
|
|
283
|
+
],
|
|
284
|
+
written: [],
|
|
285
|
+
bibdata: [],
|
|
286
|
+
bibtex: { ran: false },
|
|
287
|
+
sha256: Object.fromEntries(order.map((p) => [p, hash(p)])),
|
|
288
|
+
});
|
|
289
|
+
// Guards: a staging without paper.tex records it as empty.
|
|
290
|
+
expect(recordOf([]).sha256).toEqual({
|
|
291
|
+
"paper.tex": sha256(new Uint8Array()),
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
});
|