paperlint 4.1.0 → 5.0.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 +26 -2
- package/CONTRIBUTING.md +7 -0
- package/README.md +15 -4
- package/action.harness.mjs +54 -36
- package/action.yml +12 -27
- package/dist/adapters/latex/document-class.d.ts +6 -5
- package/dist/adapters/latex/document-class.d.ts.map +1 -1
- package/dist/adapters/latex/document-class.js +18 -10
- package/dist/adapters/latex/document-class.js.map +1 -1
- package/dist/adapters/latex/includes.d.ts +16 -0
- package/dist/adapters/latex/includes.d.ts.map +1 -0
- package/dist/adapters/latex/includes.js +48 -0
- package/dist/adapters/latex/includes.js.map +1 -0
- package/dist/adapters/latex/index.d.ts +9 -5
- package/dist/adapters/latex/index.d.ts.map +1 -1
- package/dist/adapters/latex/index.js +8 -1
- package/dist/adapters/latex/index.js.map +1 -1
- package/dist/adapters/latex/nodes.d.ts +5 -1
- package/dist/adapters/latex/nodes.d.ts.map +1 -1
- package/dist/adapters/latex/nodes.js +6 -2
- package/dist/adapters/latex/nodes.js.map +1 -1
- package/dist/adapters/latex/parse.d.ts.map +1 -1
- package/dist/adapters/latex/parse.js +1 -0
- package/dist/adapters/latex/parse.js.map +1 -1
- package/dist/adapters/latex/prose.d.ts +8 -0
- package/dist/adapters/latex/prose.d.ts.map +1 -0
- package/dist/adapters/latex/prose.js +353 -0
- package/dist/adapters/latex/prose.js.map +1 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +7 -3
- package/dist/build.js.map +1 -1
- package/dist/claim-provenance.d.ts +34 -0
- package/dist/claim-provenance.d.ts.map +1 -0
- package/dist/claim-provenance.js +146 -0
- package/dist/claim-provenance.js.map +1 -0
- package/dist/cli.d.ts +2 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +81 -31
- package/dist/cli.js.map +1 -1
- package/dist/domain/paper-source.d.ts +58 -0
- package/dist/domain/paper-source.d.ts.map +1 -0
- package/dist/domain/paper-source.js +109 -0
- package/dist/domain/paper-source.js.map +1 -0
- package/dist/domain/sentences.d.ts +26 -0
- package/dist/domain/sentences.d.ts.map +1 -0
- package/dist/domain/sentences.js +48 -0
- package/dist/domain/sentences.js.map +1 -0
- package/dist/domain/tex-document.d.ts +39 -4
- package/dist/domain/tex-document.d.ts.map +1 -1
- package/dist/domain/tex-document.js.map +1 -1
- package/dist/eslint-rules/latex-language.d.ts +5 -1
- package/dist/eslint-rules/latex-language.d.ts.map +1 -1
- package/dist/eslint-rules/latex-language.js +6 -3
- package/dist/eslint-rules/latex-language.js.map +1 -1
- package/dist/eslint-rules/paper-context.d.ts +20 -0
- package/dist/eslint-rules/paper-context.d.ts.map +1 -0
- package/dist/eslint-rules/paper-context.js +44 -0
- package/dist/eslint-rules/paper-context.js.map +1 -0
- package/dist/eslint-rules/paper-typography.d.ts +8 -1
- package/dist/eslint-rules/paper-typography.d.ts.map +1 -1
- package/dist/eslint-rules/paper-typography.js +85 -19
- package/dist/eslint-rules/paper-typography.js.map +1 -1
- package/dist/eslint-rules/tex-build.d.ts.map +1 -1
- package/dist/eslint-rules/tex-build.js +7 -1
- package/dist/eslint-rules/tex-build.js.map +1 -1
- package/dist/init.d.ts +4 -19
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +24 -29
- package/dist/init.js.map +1 -1
- package/dist/package-dirs.d.ts +2 -0
- package/dist/package-dirs.d.ts.map +1 -1
- package/dist/package-dirs.js +8 -0
- package/dist/package-dirs.js.map +1 -1
- package/dist/paper-files.d.ts +2 -2
- package/dist/paper-includes.d.ts +17 -0
- package/dist/paper-includes.d.ts.map +1 -0
- package/dist/paper-includes.js +51 -0
- package/dist/paper-includes.js.map +1 -0
- package/dist/ports/latex.d.ts +12 -1
- package/dist/ports/latex.d.ts.map +1 -1
- package/dist/register.d.ts +40 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +134 -0
- package/dist/register.js.map +1 -0
- package/dist/rules-config.d.ts +1 -0
- package/dist/rules-config.d.ts.map +1 -1
- package/dist/rules-config.js.map +1 -1
- package/dist/structure.js +1 -1
- package/dist/structure.js.map +1 -1
- package/dist/tex-paper.d.ts +33 -0
- package/dist/tex-paper.d.ts.map +1 -0
- package/dist/tex-paper.js +103 -0
- package/dist/tex-paper.js.map +1 -0
- package/dist/tex-venue-rules.d.ts +7 -2
- package/dist/tex-venue-rules.d.ts.map +1 -1
- package/dist/tex-venue-rules.js +31 -17
- package/dist/tex-venue-rules.js.map +1 -1
- package/docs/configuration.md +5 -4
- package/docs/install.md +8 -8
- package/docs/prior-art/paper-folder-scaffolding.md +4 -7
- package/docs/rules/tex/claim-provenance.md +83 -0
- package/docs/rules/tex/register.md +77 -0
- package/docs/rules/tex/required-section.md +3 -1
- package/docs/rules/tex/template.md +12 -0
- package/docs/rules/tex/venue-leftover.md +4 -2
- package/docs/rules.md +17 -10
- package/eslint-rules/latex-language.ts +10 -4
- package/eslint-rules/paper-context.test.ts +47 -0
- package/eslint-rules/paper-context.ts +57 -0
- package/eslint-rules/paper-typography.test.mjs +48 -1
- package/eslint-rules/paper-typography.ts +139 -24
- package/eslint-rules/tex-build.ts +8 -1
- package/eslint.config.mjs +1 -0
- package/fixtures/real-markdown-paper/baseline.json +1 -2
- package/fixtures/real-markdown-paper/baseline.ts +8 -7
- package/package.json +2 -1
- package/scripts/check.ts +2 -2
- package/scripts/eslint-report-guard.mjs +5 -2
- package/scripts/harness-api.frozen.json +0 -1
- package/skills/cold-read-diff/SKILL.md +31 -10
- package/skills/cold-read-diff/SKILL.md.spec.ts +30 -9
- package/skills/draft-paper/SKILL.md +2 -2
- package/skills/draft-paper/SKILL.md.spec.ts +1 -1
- package/skills/grade-paper-writing/SKILL.md +109 -44
- package/skills/grade-paper-writing/SKILL.md.spec.ts +108 -43
- package/skills/harden-paper/SKILL.md +35 -36
- package/skills/harden-paper/SKILL.md.spec.ts +34 -35
- package/skills/paper-adversarial-review/SKILL.md +2 -2
- package/skills/paper-adversarial-review/SKILL.md.spec.ts +1 -1
- package/skills/paper-pipeline/SKILL.md +3 -3
- package/skills/paper-pipeline/SKILL.md.spec.ts +2 -2
- package/skills/paper-pipeline/grade-paper-writing-ablation.eval.mjs +6 -6
- package/skills/paper-pipeline/references/pipeline-status-template.md +2 -16
- package/skills/paper-pipeline/references/writing-craft.md +53 -18
- package/skills/pc-panel-review/SKILL.md +36 -11
- package/skills/pc-panel-review/SKILL.md.spec.ts +35 -10
- package/src/adapters/latex/document-class.ts +20 -12
- package/src/adapters/latex/includes.ts +74 -0
- package/src/adapters/latex/index.test.ts +183 -1
- package/src/adapters/latex/index.ts +14 -4
- package/src/adapters/latex/nodes.ts +11 -2
- package/src/adapters/latex/parse.ts +1 -0
- package/src/adapters/latex/prose.ts +484 -0
- package/src/build.harness.mjs +4 -2
- package/src/build.test.ts +18 -1
- package/src/build.ts +7 -3
- package/src/claim-provenance.test.ts +352 -0
- package/src/claim-provenance.ts +217 -0
- package/src/cli.harness.mjs +22 -54
- package/src/cli.test.ts +2 -18
- package/src/cli.ts +92 -36
- package/src/domain/paper-source.test.ts +156 -0
- package/src/domain/paper-source.ts +233 -0
- package/src/domain/sentences.ts +67 -0
- package/src/domain/tex-document.ts +36 -3
- package/src/init.test.ts +33 -13
- package/src/init.ts +25 -48
- package/src/linted-set.test.ts +11 -1
- package/src/new-paper.harness.mjs +1 -5
- package/src/package-dirs.ts +9 -0
- package/src/paper-files.ts +2 -2
- package/src/paper-includes.test.ts +161 -0
- package/src/paper-includes.ts +77 -0
- package/src/ports/latex.ts +13 -0
- package/src/register.test.ts +165 -0
- package/src/register.ts +177 -0
- package/src/rule-cases.test.ts +43 -23
- package/src/rule-docs.test.ts +0 -1
- package/src/rules-config.ts +1 -0
- package/src/structure.harness.ts +1 -3
- package/src/structure.ts +1 -1
- package/src/tex-paper.test.ts +148 -0
- package/src/tex-paper.ts +161 -0
- package/src/tex-venue-rules.test.ts +87 -5
- package/src/tex-venue-rules.ts +62 -30
- package/templates/paper/PIPELINE-STATUS.md +0 -4
- package/dist/action-ref.d.ts +0 -12
- package/dist/action-ref.d.ts.map +0 -1
- package/dist/action-ref.js +0 -16
- package/dist/action-ref.js.map +0 -1
- package/dist/eslint-rules/paper-research-question.d.ts +0 -31
- package/dist/eslint-rules/paper-research-question.d.ts.map +0 -1
- package/dist/eslint-rules/paper-research-question.js +0 -188
- package/dist/eslint-rules/paper-research-question.js.map +0 -1
- package/eslint-rules/paper-research-question.harness.mjs +0 -212
- package/eslint-rules/paper-research-question.ts +0 -199
- package/fixtures/paper-research-question/comment-only/PIPELINE-STATUS.md +0 -9
- package/fixtures/paper-research-question/comment-only/paper.tex +0 -7
- package/fixtures/paper-research-question/declared-not-in-paper/PIPELINE-STATUS.md +0 -10
- package/fixtures/paper-research-question/declared-not-in-paper/paper.tex +0 -6
- package/fixtures/paper-research-question/draft/PIPELINE-STATUS.md +0 -6
- package/fixtures/paper-research-question/draft/paper.tex +0 -2
- package/fixtures/paper-research-question/markdown-no-rq/PIPELINE-STATUS.md +0 -9
- package/fixtures/paper-research-question/markdown-no-rq/paper.md +0 -4
- package/fixtures/paper-research-question/shipped-no-rq/PIPELINE-STATUS.md +0 -12
- package/fixtures/paper-research-question/shipped-no-rq/paper.tex +0 -3
- package/fixtures/paper-research-question/shipped-with-rq/PIPELINE-STATUS.md +0 -10
- package/fixtures/paper-research-question/shipped-with-rq/paper.tex +0 -2
- package/skills/harden-paper/fixtures/uncited-assertions-sample.md +0 -43
- package/skills/harden-paper/fixtures/uncited-assertions-sample.tex +0 -77
- package/src/action-ref.test.ts +0 -26
- package/src/action-ref.ts +0 -15
package/src/tex-venue-rules.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
missingOptions,
|
|
29
29
|
runText,
|
|
30
30
|
spanIn,
|
|
31
|
+
type ClassCandidate,
|
|
31
32
|
type ClassLine,
|
|
32
33
|
type DocumentClass,
|
|
33
34
|
type Heading,
|
|
@@ -44,6 +45,8 @@ import {
|
|
|
44
45
|
shippedPresets,
|
|
45
46
|
type Preset,
|
|
46
47
|
} from "./presets.ts";
|
|
48
|
+
import type { PaperSource } from "./domain/paper-source.ts";
|
|
49
|
+
import { readPaper, reportInPaper } from "./tex-paper.ts";
|
|
47
50
|
import type { RequiredSection } from "./tex-requirements.ts";
|
|
48
51
|
import type { Finding, VenueRuleDeps } from "./venue-rules.ts";
|
|
49
52
|
|
|
@@ -55,19 +58,27 @@ export interface Located extends Finding {
|
|
|
55
58
|
/** The slice of ESLint's rule context these rules use. `raw` exists on the `.tex` language's. */
|
|
56
59
|
export interface TexRuleContext {
|
|
57
60
|
readonly filename: string;
|
|
61
|
+
/** The rule's options from the config, as ESLint validated them against its schema. */
|
|
62
|
+
readonly options?: readonly unknown[];
|
|
58
63
|
readonly sourceCode: {
|
|
59
64
|
readonly text: string;
|
|
60
65
|
readonly raw?: string;
|
|
61
66
|
getLocFromIndex(index: number): Readonly<{ line: number; column: number }>;
|
|
62
67
|
};
|
|
63
|
-
report(
|
|
64
|
-
|
|
65
|
-
readonly
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
report(
|
|
69
|
+
d: {
|
|
70
|
+
readonly loc: {
|
|
71
|
+
readonly start: { line: number; column: number };
|
|
72
|
+
readonly end: { line: number; column: number };
|
|
73
|
+
};
|
|
74
|
+
} & (
|
|
75
|
+
| {
|
|
76
|
+
readonly messageId: string;
|
|
77
|
+
readonly data?: Readonly<Record<string, string | number>>;
|
|
78
|
+
}
|
|
79
|
+
| { readonly message: string }
|
|
80
|
+
),
|
|
81
|
+
): void;
|
|
71
82
|
}
|
|
72
83
|
|
|
73
84
|
export interface TexRuleModule {
|
|
@@ -110,6 +121,30 @@ function judgeClass(
|
|
|
110
121
|
}));
|
|
111
122
|
}
|
|
112
123
|
|
|
124
|
+
/** A candidate as the message names it: its line, or an empty `\documentclass{}`. */
|
|
125
|
+
const candidateLine = (c: ClassCandidate): string =>
|
|
126
|
+
c.kind === "class" ? documentClassLine(c) : "\\documentclass{}";
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Several class lines behind a TeX switch: satisfied when any candidate is the template's class
|
|
130
|
+
* with its options; otherwise one finding, at the first candidate, naming every one.
|
|
131
|
+
*/
|
|
132
|
+
function judgeCandidates(
|
|
133
|
+
candidates: readonly [ClassCandidate, ...ClassCandidate[]],
|
|
134
|
+
want: DocumentClass,
|
|
135
|
+
data: TemplateData,
|
|
136
|
+
): readonly Located[] {
|
|
137
|
+
const matches = candidates.some(
|
|
138
|
+
(c) => c.kind === "class" && judgeClass(c, want, data).length === 0,
|
|
139
|
+
);
|
|
140
|
+
if (matches) return [];
|
|
141
|
+
const named = candidates.map((c) => `\`${candidateLine(c)}\``).join(", ");
|
|
142
|
+
const found = { ...data, count: candidates.length, candidates: named };
|
|
143
|
+
return [
|
|
144
|
+
{ messageId: "noCandidate", data: found, at: spanOf(candidates[0].place) },
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
|
|
113
148
|
/** The paper's class line against a template that was read: present, naming a class, that class. */
|
|
114
149
|
function judgeClassLine(
|
|
115
150
|
line: ClassLine,
|
|
@@ -123,6 +158,8 @@ function judgeClassLine(
|
|
|
123
158
|
return [{ messageId: "emptyClass", data, at: spanOf(line.place) }];
|
|
124
159
|
case "class":
|
|
125
160
|
return judgeClass(line, want, data);
|
|
161
|
+
case "ambiguous":
|
|
162
|
+
return judgeCandidates(line.candidates, want, data);
|
|
126
163
|
}
|
|
127
164
|
}
|
|
128
165
|
|
|
@@ -252,7 +289,9 @@ export function judgeLeftover(
|
|
|
252
289
|
}
|
|
253
290
|
|
|
254
291
|
/** Where a rule's page lives: `docs/rules/tex/<name>.md` on the default branch. */
|
|
255
|
-
export const ruleDocsUrl = (
|
|
292
|
+
export const ruleDocsUrl = (
|
|
293
|
+
name: TexVenueRuleName | "claim-provenance" | "register",
|
|
294
|
+
): string =>
|
|
256
295
|
`https://github.com/zernie/paperlint/blob/main/docs/rules/tex/${name}.md`;
|
|
257
296
|
|
|
258
297
|
/** What a judge reads: the paper's source through the reader, its preset, the other venues. */
|
|
@@ -295,6 +334,8 @@ const RULES: Readonly<
|
|
|
295
334
|
"the class is `{{got}}`, and {{venue}} requires `{{template}}` — the page size, fonts and layout the venue checks come from the class",
|
|
296
335
|
missingOption:
|
|
297
336
|
"the class option `{{option}}` is missing: {{venue}} requires `{{template}}`",
|
|
337
|
+
noCandidate:
|
|
338
|
+
"none of the {{count}} \\documentclass lines is `{{template}}`, which {{venue}} requires: {{candidates}}. The source picks one behind a TeX switch, which is not evaluated; make one of them the venue's",
|
|
298
339
|
},
|
|
299
340
|
},
|
|
300
341
|
},
|
|
@@ -368,35 +409,25 @@ export interface TexVenueRuleDeps extends VenueRuleDeps {
|
|
|
368
409
|
}
|
|
369
410
|
|
|
370
411
|
/**
|
|
371
|
-
* What a judge reads for the paper whose `paper.tex` is `filename
|
|
372
|
-
* resolved preset (`pdf/measured` and
|
|
412
|
+
* What a judge reads for the paper whose `paper.tex` is `filename` — the paper with its includes
|
|
413
|
+
* spliced (`readPaper`) — or null when the paper has no resolved preset (`pdf/measured` and
|
|
414
|
+
* `pdf/profile` already say so).
|
|
373
415
|
*/
|
|
374
416
|
function readingOf(
|
|
375
417
|
filename: string,
|
|
376
418
|
src: string,
|
|
377
419
|
deps: TexVenueRuleDeps,
|
|
378
|
-
): Reading | null {
|
|
420
|
+
): { readonly reading: Reading; readonly paper: PaperSource } | null {
|
|
379
421
|
const dir = dirname(filename);
|
|
380
422
|
const p = paperPreset(dir, deps);
|
|
381
423
|
if (p.kind !== "resolved") return null;
|
|
382
424
|
const preset = p.preset;
|
|
383
425
|
const others = () => otherVenues(preset, join(dir, CONFIG_FILE), deps);
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
context: TexRuleContext,
|
|
390
|
-
findings: readonly Located[],
|
|
391
|
-
): void {
|
|
392
|
-
const at = (i: number) => context.sourceCode.getLocFromIndex(i);
|
|
393
|
-
findings.forEach((f) => {
|
|
394
|
-
context.report({
|
|
395
|
-
loc: { start: at(f.at?.start ?? 0), end: at(f.at?.end ?? 0) },
|
|
396
|
-
messageId: f.messageId,
|
|
397
|
-
data: f.data,
|
|
398
|
-
});
|
|
399
|
-
});
|
|
426
|
+
const paper = readPaper(filename, src, deps);
|
|
427
|
+
return {
|
|
428
|
+
reading: { src: paper.text, latex: deps.latex, preset, others },
|
|
429
|
+
paper,
|
|
430
|
+
};
|
|
400
431
|
}
|
|
401
432
|
|
|
402
433
|
function rule(name: TexVenueRuleName, deps: TexVenueRuleDeps): TexRuleModule {
|
|
@@ -409,8 +440,9 @@ function rule(name: TexVenueRuleName, deps: TexVenueRuleDeps): TexRuleModule {
|
|
|
409
440
|
return {
|
|
410
441
|
root() {
|
|
411
442
|
const sc = context.sourceCode;
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
443
|
+
const r = readingOf(context.filename, sc.raw ?? sc.text, deps);
|
|
444
|
+
if (r !== null)
|
|
445
|
+
reportInPaper(context, meta.messages, r.paper, judge(r.reading));
|
|
414
446
|
},
|
|
415
447
|
};
|
|
416
448
|
},
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
# Created by `paperlint new` — from <papers>/.template/ when the project keeps one, else from the package.
|
|
3
3
|
#
|
|
4
|
-
# researchQuestion — the paper's question, one sentence, written the way it appears in the paper.
|
|
5
|
-
# `paper/research-question` reads it once the paper has shipped a stage. Empty until you have it.
|
|
6
|
-
researchQuestion: ""
|
|
7
|
-
#
|
|
8
4
|
# There is no `stages` field yet, on purpose: a new paper has shipped nothing and owes nothing.
|
|
9
5
|
# When it reaches a stage, add the record — its shape is in docs/rules.md of the package.
|
|
10
6
|
---
|
package/dist/action-ref.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The ref `paperlint init` pins the GitHub Action to, decided from the version of the package that is
|
|
3
|
-
* running. semantic-release tags every release `v<version>` on the commit it publishes, so the
|
|
4
|
-
* action at that tag is the same code as the installed package.
|
|
5
|
-
*
|
|
6
|
-
* Only a plain `X.Y.Z` has such a tag. A git checkout or `npm link` carries the unreleased
|
|
7
|
-
* placeholder `0.0.0-semantically-released`, a version that could not be read is `undefined`, and
|
|
8
|
-
* anything else is not known to be tagged: those return `null` ("no pin known"), and the caller
|
|
9
|
-
* keeps the placeholder. A wrong tag written confidently is worse than an obvious placeholder.
|
|
10
|
-
*/
|
|
11
|
-
export declare function actionRef(version: string | undefined): string | null;
|
|
12
|
-
//# sourceMappingURL=action-ref.d.ts.map
|
package/dist/action-ref.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-ref.d.ts","sourceRoot":"","sources":["../src/action-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIpE"}
|
package/dist/action-ref.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The ref `paperlint init` pins the GitHub Action to, decided from the version of the package that is
|
|
3
|
-
* running. semantic-release tags every release `v<version>` on the commit it publishes, so the
|
|
4
|
-
* action at that tag is the same code as the installed package.
|
|
5
|
-
*
|
|
6
|
-
* Only a plain `X.Y.Z` has such a tag. A git checkout or `npm link` carries the unreleased
|
|
7
|
-
* placeholder `0.0.0-semantically-released`, a version that could not be read is `undefined`, and
|
|
8
|
-
* anything else is not known to be tagged: those return `null` ("no pin known"), and the caller
|
|
9
|
-
* keeps the placeholder. A wrong tag written confidently is worse than an obvious placeholder.
|
|
10
|
-
*/
|
|
11
|
-
export function actionRef(version) {
|
|
12
|
-
return version !== undefined && /^\d+\.\d+\.\d+$/.test(version)
|
|
13
|
-
? `v${version}`
|
|
14
|
-
: null;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=action-ref.js.map
|
package/dist/action-ref.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-ref.js","sourceRoot":"","sources":["../src/action-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,OAA2B;IACnD,OAAO,OAAO,KAAK,SAAS,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;QAC7D,CAAC,CAAC,IAAI,OAAO,EAAE;QACf,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { RuleContext } from "./rule-context.ts";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
rules: {
|
|
4
|
-
"research-question": {
|
|
5
|
-
meta: {
|
|
6
|
-
type: "suggestion";
|
|
7
|
-
docs: {
|
|
8
|
-
description: string;
|
|
9
|
-
};
|
|
10
|
-
schema: {
|
|
11
|
-
type: string;
|
|
12
|
-
properties: {
|
|
13
|
-
statusFile: {
|
|
14
|
-
type: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
additionalProperties: boolean;
|
|
18
|
-
}[];
|
|
19
|
-
messages: {
|
|
20
|
-
notDeclared: string;
|
|
21
|
-
notInPaper: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
create(context: RuleContext): {
|
|
25
|
-
"root:exit"(node: object): void;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export default _default;
|
|
31
|
-
//# sourceMappingURL=paper-research-question.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paper-research-question.d.ts","sourceRoot":"","sources":["../../eslint-rules/paper-research-question.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;4BAuH/B,WAAW;kCAQL,MAAM;;;;;AApClC,wBAqEE"}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `paper/research-question` — a shipped paper states its research question EXPLICITLY.
|
|
3
|
-
*
|
|
4
|
-
* Reviewer A's verbatim point on agenticdev (#20), as it was parsed: "State the goal as a
|
|
5
|
-
* research question." This is a venue expectation, not taste: an empirical paper that never
|
|
6
|
-
* names the question it answers forces the reviewer to reconstruct it — and they say so.
|
|
7
|
-
*
|
|
8
|
-
* ── WHY THE SCOPE IS SHIPPED PAPERS ONLY ─────────────────────────────────────────────────
|
|
9
|
-
* A draft never asked anyone to read it. The scope deliberately matches `paper/author-list`:
|
|
10
|
-
* both are about the DEBT of a shipped paper, and an unshipped one has no debt. Measured on the
|
|
11
|
-
* live corpus before the move:
|
|
12
|
-
* agenticdev-2026 has RQ, shipped -> silent (added because of this very review)
|
|
13
|
-
* aisec-2026 no RQ, shipped -> a finding
|
|
14
|
-
* compile-rules no RQ, shipped -> a finding
|
|
15
|
-
* scored-2026 no RQ, NOT shipped -> silent
|
|
16
|
-
*
|
|
17
|
-
* ── WHAT THE MOVE CHANGED ─────────────────────────────────────────────────────────────────
|
|
18
|
-
* The predecessor read the stage with a REGEX OVER THE SCORECARD'S PROSE. Remeasured 2026-09-17:
|
|
19
|
-
* for `agenticdev-2026` the prose reads `submitted`, while the `stages` field declares
|
|
20
|
-
* `submitted, camera-ready`. Here the stage comes from the FIELD — the same one `paper/stages`
|
|
21
|
-
* checks against the bytes in both directions.
|
|
22
|
-
*
|
|
23
|
-
* ⚠️ WHAT THE MOVE DOES NOT FIX, AND THIS IS MEASURED, NOT ASSUMED. The rule reads RAW text, not
|
|
24
|
-
* the parsed tree, so a mention of RQ inside a LaTeX comment (`% add an RQ`) will put it to
|
|
25
|
-
* sleep. Measured 2026-09-17 across all four papers: ZERO such cases — not a single match inside
|
|
26
|
-
* a comment. So the hole is LATENT, not observed, and closing it with a tree walk would
|
|
27
|
-
* complicate the rule without a measured difference. The neighboring `paper/typography` is built
|
|
28
|
-
* the same way and for the same reason. Once a real case shows up, there will be something to
|
|
29
|
-
* cite here.
|
|
30
|
-
*
|
|
31
|
-
* The rule is ADVISORY by decision, not by coincidence: a position paper may legitimately have
|
|
32
|
-
* no question. Then its absence is the author's decision, and the rule says exactly that,
|
|
33
|
-
* rather than declaring the absence a defect on its own.
|
|
34
|
-
*/
|
|
35
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
36
|
-
import { join, dirname } from "node:path";
|
|
37
|
-
import { load } from "js-yaml";
|
|
38
|
-
import { z } from "zod";
|
|
39
|
-
/**
|
|
40
|
-
* The two scorecard fields this rule reads, parsed rather than trusted: a field of the wrong shape
|
|
41
|
-
* reads as absent, the way `data?.stages` on a string or a number always did.
|
|
42
|
-
*/
|
|
43
|
-
const Scorecard = z
|
|
44
|
-
.looseObject({
|
|
45
|
-
stages: z.array(z.unknown()).catch([]),
|
|
46
|
-
researchQuestion: z.string().catch(""),
|
|
47
|
-
})
|
|
48
|
-
.catch({ stages: [], researchQuestion: "" });
|
|
49
|
-
const StageEntry = z.looseObject({ stage: z.unknown().optional() }).catch({});
|
|
50
|
-
const RuleOptions = z
|
|
51
|
-
.object({ statusFile: z.string().default("PIPELINE-STATUS.md") })
|
|
52
|
-
.default({ statusFile: "PIPELINE-STATUS.md" });
|
|
53
|
-
/**
|
|
54
|
-
* 🔴 THE REGEX IS GONE, AND THE REASON IS NOT "regexes are bad" — IT IS THAT IT ANSWERED THE
|
|
55
|
-
* WRONG QUESTION (2026-09-19).
|
|
56
|
-
*
|
|
57
|
-
* What stood here was `/\\textbf\{RQ|\bRQ[0-9]?\b|research question/i`, defended in this very
|
|
58
|
-
* file with: "a regex is LEGITIMATE here: the subject is human prose, which has no structure by
|
|
59
|
-
* definition, and no parser can tell a question's statement apart from a paragraph about it."
|
|
60
|
-
*
|
|
61
|
-
* The premise is true. The conclusion does not follow. From "the text cannot decide this" the
|
|
62
|
-
* answer is not "so pattern-match harder" — it is "so the HUMAN declares it, and the check
|
|
63
|
-
* compares the declaration against the text." The three spellings were an undeclared schema
|
|
64
|
-
* field: someone added a fact and invented a convention for how it would look in prose, which is
|
|
65
|
-
* the design running backwards.
|
|
66
|
-
*
|
|
67
|
-
* What the pattern actually decided, in both directions:
|
|
68
|
-
* • a paper that says "we leave the research question to future work" — MATCHED, and the rule
|
|
69
|
-
* went silent on a paper that states no question at all;
|
|
70
|
-
* • a paper whose question is written plainly ("Does pruning reduce review cost?") with no
|
|
71
|
-
* "RQ" anywhere — NOT matched, and the rule reported a paper that does exactly what is asked.
|
|
72
|
-
* An open list of spellings cannot be completed, so both failures are structural, not bugs.
|
|
73
|
-
*
|
|
74
|
-
* ── WHAT REPLACES IT: ONE UNDECIDABLE QUESTION BECOMES TWO DECIDABLE ONES ──────────────────
|
|
75
|
-
* 1. Is the question WRITTEN DOWN? — `researchQuestion` in the scorecard's front matter. A
|
|
76
|
-
* field, parsed by js-yaml, not a phrase hunted for in prose.
|
|
77
|
-
* 2. Does the paper CONTAIN what was written down? — the declared sentence, whitespace
|
|
78
|
-
* collapsed, compared against the source. Bytes, not spelling.
|
|
79
|
-
*
|
|
80
|
-
* This is the shape this package already uses twice, and for the same reason: `bytes`/
|
|
81
|
-
* `sourceBytes` (a recorded number compared against the file on disk) and `paper/author-list`
|
|
82
|
-
* (a recorded marker, because whether a cross-check ran is not visible in the paper). Neither
|
|
83
|
-
* asks the prose a question the prose cannot answer.
|
|
84
|
-
*
|
|
85
|
-
* ⚠️ WHAT THIS STILL CANNOT DO, said plainly rather than implied: nothing here decides that the
|
|
86
|
-
* declared sentence IS a research question. A declaration of "banana" passes step 1 and, if the
|
|
87
|
-
* word appears in the paper, step 2. The rule guarantees that the author wrote a question down
|
|
88
|
-
* and that the paper carries it — it does not grade the question. That is a human's job, and
|
|
89
|
-
* pretending otherwise is what the regex was doing.
|
|
90
|
-
*/
|
|
91
|
-
/** Whitespace is the only thing normalised: a sentence wrapped across lines is the same sentence. */
|
|
92
|
-
const flatten = (t) => t.replace(/\s+/g, " ").trim().toLowerCase();
|
|
93
|
-
/**
|
|
94
|
-
* Both facts come out of ONE parse of the scorecard's front matter: the stages (has this paper
|
|
95
|
-
* shipped?) and the declared question. Reading them separately would invite the two to be taken
|
|
96
|
-
* from different revisions of the same file.
|
|
97
|
-
*/
|
|
98
|
-
function scorecard(dir, statusName) {
|
|
99
|
-
const p = join(dir, statusName);
|
|
100
|
-
const none = { stages: [], question: "" };
|
|
101
|
-
if (!existsSync(p))
|
|
102
|
-
return none;
|
|
103
|
-
let text;
|
|
104
|
-
try {
|
|
105
|
-
text = readFileSync(p, "utf-8");
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
return none;
|
|
109
|
-
}
|
|
110
|
-
const m = /^---\n([\s\S]*?)\n---/.exec(text);
|
|
111
|
-
if (!m)
|
|
112
|
-
return none;
|
|
113
|
-
const [, front = ""] = m;
|
|
114
|
-
let data;
|
|
115
|
-
try {
|
|
116
|
-
data = load(front);
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
return none; // the unreadable YAML is already reported by `paper/stages`, on its own file
|
|
120
|
-
}
|
|
121
|
-
const { stages: raw, researchQuestion: question } = Scorecard.parse(data);
|
|
122
|
-
const stages = raw.map((r) => StageEntry.parse(r).stage).filter(Boolean);
|
|
123
|
-
return { stages, question };
|
|
124
|
-
}
|
|
125
|
-
export default {
|
|
126
|
-
rules: {
|
|
127
|
-
"research-question": {
|
|
128
|
-
meta: {
|
|
129
|
-
type: "suggestion",
|
|
130
|
-
docs: {
|
|
131
|
-
description: "a paper that declares a stage states its research question explicitly — otherwise the reviewer reconstructs it themselves, and says so",
|
|
132
|
-
},
|
|
133
|
-
schema: [
|
|
134
|
-
{
|
|
135
|
-
type: "object",
|
|
136
|
-
properties: {
|
|
137
|
-
// The scorecard's name is a CONSUMER convention. The rule is declared on the
|
|
138
|
-
// paper's source, so it has to name its neighbor itself rather than get it via a
|
|
139
|
-
// config glob.
|
|
140
|
-
statusFile: { type: "string" },
|
|
141
|
-
},
|
|
142
|
-
additionalProperties: false,
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
messages: {
|
|
146
|
-
notDeclared: "the paper shipped (stage «{{stages}}») and its scorecard declares no `researchQuestion`. This is reviewer A's verbatim point on agenticdev (#20), not the linter's taste. Write the question down as a field, in your own words — the check cannot infer it from the prose, and the pattern that used to try matched «we leave the research question to future work» while missing a question stated plainly. Advisory: a position paper may legitimately have none, and then leaving the field out is a DECISION — record it as one",
|
|
147
|
-
notInPaper: "the scorecard declares a research question the paper does not contain. Looked for «{{needle}}» with whitespace collapsed, and the source has no such run of text. Either the paper dropped it or the declaration drifted from what was written — and which of the two it is, only you know",
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
create(context) {
|
|
151
|
-
const { statusFile: statusName } = RuleOptions.parse(context.options[0]);
|
|
152
|
-
return {
|
|
153
|
-
// `root:exit` exists for both markdown and the `tex/latex` language — the same place
|
|
154
|
-
// `paper/typography` lives, and for the same reason: a paper in this corpus can be
|
|
155
|
-
// either.
|
|
156
|
-
"root:exit"(node) {
|
|
157
|
-
const raw = context.sourceCode.raw ?? context.sourceCode.text;
|
|
158
|
-
if (typeof raw !== "string")
|
|
159
|
-
return;
|
|
160
|
-
const { stages, question } = scorecard(dirname(context.filename), statusName);
|
|
161
|
-
if (stages.length === 0)
|
|
162
|
-
return; // not shipped — owes nothing
|
|
163
|
-
// Step 1 — is it written down? A field, not a phrase hunted for in prose.
|
|
164
|
-
if (question.trim() === "") {
|
|
165
|
-
context.report({
|
|
166
|
-
node,
|
|
167
|
-
messageId: "notDeclared",
|
|
168
|
-
data: { stages: stages.join("/") },
|
|
169
|
-
});
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
// Step 2 — does the paper carry what was written down? Bytes, not spelling. Only
|
|
173
|
-
// whitespace is normalised, because a sentence wrapped across source lines is the
|
|
174
|
-
// same sentence; everything else stays the author's.
|
|
175
|
-
if (flatten(raw).includes(flatten(question)))
|
|
176
|
-
return;
|
|
177
|
-
context.report({
|
|
178
|
-
node,
|
|
179
|
-
messageId: "notInPaper",
|
|
180
|
-
data: { needle: flatten(question) },
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
//# sourceMappingURL=paper-research-question.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paper-research-question.js","sourceRoot":"","sources":["../../eslint-rules/paper-research-question.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Both halves for `paper/research-question`, plus two that a test forgets most often: SCOPE
|
|
3
|
-
* and LANGUAGE.
|
|
4
|
-
*
|
|
5
|
-
* The scope is load-bearing here. The rule does not ask "is there a question", it asks "is there
|
|
6
|
-
* a question FOR SOMETHING THAT HAS ALREADY SHIPPED". Remove the stage gate and the rule starts
|
|
7
|
-
* scolding every draft in the corpus, and gets turned off within a week. So "silent on a draft"
|
|
8
|
-
* is checked by its own assert, not treated as a special case of "silent".
|
|
9
|
-
*
|
|
10
|
-
* Language is the second forgotten half: a paper in this corpus can be either LaTeX or markdown.
|
|
11
|
-
* A rule pinned to `.tex` only would LOSE `compile-rules-2026`, where the paper is written in
|
|
12
|
-
* markdown and states no question — one of the two real findings on the live corpus.
|
|
13
|
-
*/
|
|
14
|
-
import assert from "node:assert/strict";
|
|
15
|
-
import { join, dirname } from "node:path";
|
|
16
|
-
import {
|
|
17
|
-
mkdirSync,
|
|
18
|
-
mkdtempSync,
|
|
19
|
-
readFileSync,
|
|
20
|
-
realpathSync,
|
|
21
|
-
rmSync,
|
|
22
|
-
writeFileSync,
|
|
23
|
-
} from "node:fs";
|
|
24
|
-
import { tmpdir } from "node:os";
|
|
25
|
-
import { fileURLToPath } from "node:url";
|
|
26
|
-
import { Linter } from "eslint";
|
|
27
|
-
import markdown from "@eslint/markdown";
|
|
28
|
-
import { createChecker } from "../lib/check.ts";
|
|
29
|
-
|
|
30
|
-
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
31
|
-
const FIX = join(HERE, "..", "fixtures", "paper-research-question");
|
|
32
|
-
|
|
33
|
-
const { texLanguage } = await import(join(HERE, "latex-language.ts"));
|
|
34
|
-
const rq = (await import(join(HERE, "paper-research-question.ts"))).default;
|
|
35
|
-
|
|
36
|
-
const check = createChecker();
|
|
37
|
-
|
|
38
|
-
const linter = new Linter();
|
|
39
|
-
|
|
40
|
-
/** Run against one fixture. The language is picked by extension — exactly like the consumer's config. */
|
|
41
|
-
function lint(dir, file, opts = {}) {
|
|
42
|
-
const path = join(FIX, dir, file);
|
|
43
|
-
const tex = file.endsWith(".tex");
|
|
44
|
-
const cfg = tex
|
|
45
|
-
? {
|
|
46
|
-
files: ["**/*.tex"],
|
|
47
|
-
plugins: { tex: { languages: { latex: texLanguage } }, paper: rq },
|
|
48
|
-
language: "tex/latex",
|
|
49
|
-
}
|
|
50
|
-
: {
|
|
51
|
-
// `files` is required, not cosmetic: without it flat config falls back to JS
|
|
52
|
-
// extensions, and the fixture comes back as "No matching configuration found" — a
|
|
53
|
-
// message that reads exactly like a clean run.
|
|
54
|
-
files: ["**/*.md"],
|
|
55
|
-
plugins: { markdown, paper: rq },
|
|
56
|
-
language: "markdown/gfm",
|
|
57
|
-
languageOptions: { frontmatter: "yaml" },
|
|
58
|
-
};
|
|
59
|
-
const msgs = linter.verify(
|
|
60
|
-
readFileSync(path, "utf-8"),
|
|
61
|
-
[{ ...cfg, rules: { "paper/research-question": ["error", opts] } }],
|
|
62
|
-
path,
|
|
63
|
-
);
|
|
64
|
-
assert.deepEqual(
|
|
65
|
-
msgs.filter((m) => m.fatal),
|
|
66
|
-
[],
|
|
67
|
-
`${dir}/${file}: the rule threw`,
|
|
68
|
-
);
|
|
69
|
-
return msgs.map((m) => m.message);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ── fires on a planted defect ───────────────────────────────────────────────────────────
|
|
73
|
-
const fires = lint("shipped-no-rq", "paper.tex");
|
|
74
|
-
check("shipped and no question — a finding", fires.length === 1);
|
|
75
|
-
// 🔴 The message must name WHERE the requirement comes from. Without this it reads as the
|
|
76
|
-
// linter's taste, but the requirement came from a real venue reviewer.
|
|
77
|
-
check(
|
|
78
|
-
"and it cites the reviewer, rather than passing this off as the linter's taste",
|
|
79
|
-
/reviewer/i.test(fires[0]),
|
|
80
|
-
);
|
|
81
|
-
// The stages in the text come from the FIELD. The predecessor derived them with a regex over
|
|
82
|
-
// the scorecard's prose and on agenticdev printed `submitted` where `submitted, camera-ready`
|
|
83
|
-
// was declared.
|
|
84
|
-
check(
|
|
85
|
-
"the stage list in the message comes from the field and carries BOTH",
|
|
86
|
-
/submitted\/camera-ready/.test(fires[0]),
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
// markdown — the second half of LANGUAGE, without it one of the two real findings is lost
|
|
90
|
-
check(
|
|
91
|
-
"a paper in markdown is checked the same way",
|
|
92
|
-
lint("markdown-no-rq", "paper.md").length === 1,
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
// ── THE CASE THE PREDECESSOR COULD NOT EXPRESS ──────────────────────────────────────────
|
|
96
|
-
// 🔴 The point of the 2026-09-19 redesign, in one fixture. The scorecard declares a question,
|
|
97
|
-
// the paper does not carry it — AND the paper contains the words "research question", inside
|
|
98
|
-
// "We leave the research question to future work". The old pattern matched that phrase and went
|
|
99
|
-
// SILENT on a paper stating no question at all. Matching a sentence ABOUT the thing is not
|
|
100
|
-
// finding the thing, and no list of spellings fixes that.
|
|
101
|
-
const drifted = lint("declared-not-in-paper", "paper.tex");
|
|
102
|
-
check(
|
|
103
|
-
"declared but absent from the paper — a finding, where the old pattern was silent",
|
|
104
|
-
drifted.length === 1,
|
|
105
|
-
);
|
|
106
|
-
check(
|
|
107
|
-
"and the message QUOTES what was looked for, so the author can see why it missed",
|
|
108
|
-
/does pruning reduce review cost\?/i.test(drifted[0]),
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
// ── stays silent where it must ──────────────────────────────────────────────────────────
|
|
112
|
-
check(
|
|
113
|
-
"the question is stated — silent",
|
|
114
|
-
lint("shipped-with-rq", "paper.tex").length === 0,
|
|
115
|
-
);
|
|
116
|
-
// The stage gate: a draft owes nothing, because it never asked anyone to read it.
|
|
117
|
-
check(
|
|
118
|
-
"a draft (no stages) — silent, even though it has no question either",
|
|
119
|
-
lint("draft", "paper.tex").length === 0,
|
|
120
|
-
);
|
|
121
|
-
// And the distinguisher against the previous case: the same draft with a SWAPPED scorecard
|
|
122
|
-
// name is also silent — so the silence there is not because the file went unfound, it's
|
|
123
|
-
// because the stage list is empty.
|
|
124
|
-
check(
|
|
125
|
-
"and with a nonexistent scorecard a shipped paper is also silent — the stage gate is load-bearing",
|
|
126
|
-
lint("shipped-no-rq", "paper.tex", { statusFile: "NO-SUCH-FILE.md" })
|
|
127
|
-
.length === 0,
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
// ── a named hole, pinned down by an assert, and RESHAPED by the redesign ────────────────
|
|
131
|
-
// ⚠️ The hole changed form on 2026-09-19 and did not close. Before, ANY mention of "RQ" in a
|
|
132
|
-
// LaTeX comment silenced the rule. Now the rule no longer hunts for spellings, so this fixture
|
|
133
|
-
// — a comment saying "TODO: state the research question", with no `researchQuestion` field —
|
|
134
|
-
// is a FINDING, which it never was before. What survives is narrower: if the DECLARED sentence
|
|
135
|
-
// appears only inside a comment, the raw-text comparison still accepts it. That is a smaller
|
|
136
|
-
// hole with a named owner, and closing it means walking the parsed tree.
|
|
137
|
-
check(
|
|
138
|
-
"a paper whose only mention is a comment, with nothing declared, is now a finding",
|
|
139
|
-
lint("comment-only", "paper.tex").length === 1,
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
// ── the scorecard's name is consumer data ───────────────────────────────────────────────
|
|
143
|
-
check(
|
|
144
|
-
"the scorecard's name comes in as an option",
|
|
145
|
-
lint("shipped-no-rq", "paper.tex", { statusFile: "PIPELINE-STATUS.md" })
|
|
146
|
-
.length === 1,
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
// ── a scorecard that cannot be read is no scorecard: silence, never a crash ────────────
|
|
150
|
-
// A directory where the file should be (EISDIR), and front matter that is not YAML — which
|
|
151
|
-
// `paper/stages` reports on the scorecard itself, so this rule does not report it twice.
|
|
152
|
-
{
|
|
153
|
-
const work = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-rq-")));
|
|
154
|
-
try {
|
|
155
|
-
const paperIn = (name, status) => {
|
|
156
|
-
const dir = join(work, name);
|
|
157
|
-
mkdirSync(dir);
|
|
158
|
-
status(join(dir, "PIPELINE-STATUS.md"));
|
|
159
|
-
const path = join(dir, "paper.md");
|
|
160
|
-
writeFileSync(path, "# A paper\n");
|
|
161
|
-
// A linter rooted at the scratch directory: files outside `cwd` match no config.
|
|
162
|
-
return new Linter({ cwd: work }).verify(
|
|
163
|
-
"# A paper\n",
|
|
164
|
-
[
|
|
165
|
-
{
|
|
166
|
-
files: ["**/*.md"],
|
|
167
|
-
plugins: { markdown, paper: rq },
|
|
168
|
-
language: "markdown/gfm",
|
|
169
|
-
rules: { "paper/research-question": "error" },
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
path,
|
|
173
|
-
);
|
|
174
|
-
};
|
|
175
|
-
check(
|
|
176
|
-
"a scorecard path that is a directory: no finding, no crash",
|
|
177
|
-
JSON.stringify(paperIn("dir", (p) => mkdirSync(p))) === "[]",
|
|
178
|
-
() => paperIn("dir2", (p) => mkdirSync(p)),
|
|
179
|
-
);
|
|
180
|
-
check(
|
|
181
|
-
"a scorecard whose front matter is not YAML: no finding, no crash",
|
|
182
|
-
JSON.stringify(
|
|
183
|
-
paperIn("yaml", (p) =>
|
|
184
|
-
writeFileSync(p, "---\nstages: [submitted\n---\n"),
|
|
185
|
-
),
|
|
186
|
-
) === "[]",
|
|
187
|
-
);
|
|
188
|
-
} finally {
|
|
189
|
-
rmSync(work, { recursive: true, force: true });
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// ── a language whose source code carries no text at all: nothing to compare, silence ───
|
|
194
|
-
{
|
|
195
|
-
const reports = [];
|
|
196
|
-
rq.rules["research-question"]
|
|
197
|
-
.create({
|
|
198
|
-
options: [],
|
|
199
|
-
filename: join(FIX, "shipped-no-rq", "paper.tex"),
|
|
200
|
-
sourceCode: {},
|
|
201
|
-
report: (r) => reports.push(r),
|
|
202
|
-
})
|
|
203
|
-
["root:exit"]({});
|
|
204
|
-
check(
|
|
205
|
-
"a source code with neither `raw` nor `text` is skipped, even for a shipped paper",
|
|
206
|
-
reports.length === 0,
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
console.log(
|
|
211
|
-
`✓ ${String(check.count)} assertions passed — paper/research-question, the debt of a shipped paper`,
|
|
212
|
-
);
|