paperlint 8.0.0 → 9.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.
Files changed (356) hide show
  1. package/CLAUDE.md +9 -25
  2. package/CONTRIBUTING.md +5 -4
  3. package/README.md +4 -3
  4. package/dist/adapters/bibtex/index.d.ts +3 -0
  5. package/dist/adapters/bibtex/index.d.ts.map +1 -0
  6. package/dist/adapters/bibtex/index.js +103 -0
  7. package/dist/adapters/bibtex/index.js.map +1 -0
  8. package/dist/adapters/latex/filecontents.d.ts +33 -0
  9. package/dist/adapters/latex/filecontents.d.ts.map +1 -0
  10. package/dist/adapters/latex/filecontents.js +65 -0
  11. package/dist/adapters/latex/filecontents.js.map +1 -0
  12. package/dist/adapters/latex/includes.d.ts +3 -3
  13. package/dist/adapters/latex/includes.d.ts.map +1 -1
  14. package/dist/adapters/latex/includes.js +18 -10
  15. package/dist/adapters/latex/includes.js.map +1 -1
  16. package/dist/adapters/latex/index.d.ts.map +1 -1
  17. package/dist/adapters/latex/index.js +2 -0
  18. package/dist/adapters/latex/index.js.map +1 -1
  19. package/dist/adapters/latex/nodes.d.ts +12 -0
  20. package/dist/adapters/latex/nodes.d.ts.map +1 -1
  21. package/dist/adapters/latex/nodes.js +39 -0
  22. package/dist/adapters/latex/nodes.js.map +1 -1
  23. package/dist/adapters/latex/parse.d.ts +7 -1
  24. package/dist/adapters/latex/parse.d.ts.map +1 -1
  25. package/dist/adapters/latex/parse.js +55 -6
  26. package/dist/adapters/latex/parse.js.map +1 -1
  27. package/dist/adapters/memory/index.d.ts +3 -0
  28. package/dist/adapters/memory/index.d.ts.map +1 -1
  29. package/dist/adapters/memory/index.js +9 -0
  30. package/dist/adapters/memory/index.js.map +1 -1
  31. package/dist/adapters/references/index.d.ts.map +1 -1
  32. package/dist/adapters/references/index.js +27 -24
  33. package/dist/adapters/references/index.js.map +1 -1
  34. package/dist/adapters/sources-record/index.d.ts +9 -0
  35. package/dist/adapters/sources-record/index.d.ts.map +1 -0
  36. package/dist/adapters/sources-record/index.js +68 -0
  37. package/dist/adapters/sources-record/index.js.map +1 -0
  38. package/dist/adapters/tex-output/blg.d.ts +9 -0
  39. package/dist/adapters/tex-output/blg.d.ts.map +1 -0
  40. package/dist/adapters/tex-output/blg.js +20 -0
  41. package/dist/adapters/tex-output/blg.js.map +1 -0
  42. package/dist/adapters/tex-output/fls.d.ts +8 -0
  43. package/dist/adapters/tex-output/fls.d.ts.map +1 -0
  44. package/dist/adapters/tex-output/fls.js +16 -0
  45. package/dist/adapters/tex-output/fls.js.map +1 -0
  46. package/dist/adapters/tex-output/index.d.ts +7 -0
  47. package/dist/adapters/tex-output/index.d.ts.map +1 -0
  48. package/dist/adapters/tex-output/index.js +7 -0
  49. package/dist/adapters/tex-output/index.js.map +1 -0
  50. package/dist/bib-rules.d.ts +47 -0
  51. package/dist/bib-rules.d.ts.map +1 -0
  52. package/dist/bib-rules.js +127 -0
  53. package/dist/bib-rules.js.map +1 -0
  54. package/dist/build.d.ts +29 -1
  55. package/dist/build.d.ts.map +1 -1
  56. package/dist/build.js +40 -24
  57. package/dist/build.js.map +1 -1
  58. package/dist/claim-provenance.d.ts +2 -2
  59. package/dist/cli.d.ts +6 -1
  60. package/dist/cli.d.ts.map +1 -1
  61. package/dist/cli.js +30 -26
  62. package/dist/cli.js.map +1 -1
  63. package/dist/domain/paper-source.d.ts +1 -10
  64. package/dist/domain/paper-source.d.ts.map +1 -1
  65. package/dist/domain/paper-source.js +34 -24
  66. package/dist/domain/paper-source.js.map +1 -1
  67. package/dist/domain/paper-sources.d.ts +72 -0
  68. package/dist/domain/paper-sources.d.ts.map +1 -0
  69. package/dist/domain/paper-sources.js +18 -0
  70. package/dist/domain/paper-sources.js.map +1 -0
  71. package/dist/domain/sources-record.d.ts +102 -0
  72. package/dist/domain/sources-record.d.ts.map +1 -0
  73. package/dist/domain/sources-record.js +38 -0
  74. package/dist/domain/sources-record.js.map +1 -0
  75. package/dist/domain/tex-run.d.ts +25 -0
  76. package/dist/domain/tex-run.d.ts.map +1 -0
  77. package/dist/domain/tex-run.js +79 -0
  78. package/dist/domain/tex-run.js.map +1 -0
  79. package/dist/eslint-rules/paper-context.d.ts.map +1 -1
  80. package/dist/eslint-rules/paper-context.js +4 -3
  81. package/dist/eslint-rules/paper-context.js.map +1 -1
  82. package/dist/eslint-rules/paper-typography.d.ts +0 -9
  83. package/dist/eslint-rules/paper-typography.d.ts.map +1 -1
  84. package/dist/eslint-rules/paper-typography.js +12 -5
  85. package/dist/eslint-rules/paper-typography.js.map +1 -1
  86. package/dist/latex-log.d.ts +10 -0
  87. package/dist/latex-log.d.ts.map +1 -1
  88. package/dist/latex-log.js +10 -0
  89. package/dist/latex-log.js.map +1 -1
  90. package/dist/latex-loop.d.ts +2 -0
  91. package/dist/latex-loop.d.ts.map +1 -1
  92. package/dist/latex-loop.js.map +1 -1
  93. package/dist/package-dirs.d.ts.map +1 -1
  94. package/dist/package-dirs.js +3 -2
  95. package/dist/package-dirs.js.map +1 -1
  96. package/dist/paper-includes.d.ts +4 -7
  97. package/dist/paper-includes.d.ts.map +1 -1
  98. package/dist/paper-includes.js +29 -21
  99. package/dist/paper-includes.js.map +1 -1
  100. package/dist/paper-prose.d.ts +2 -2
  101. package/dist/paper-record.d.ts +25 -0
  102. package/dist/paper-record.d.ts.map +1 -0
  103. package/dist/paper-record.js +39 -0
  104. package/dist/paper-record.js.map +1 -0
  105. package/dist/paper-sources.d.ts +66 -0
  106. package/dist/paper-sources.d.ts.map +1 -0
  107. package/dist/paper-sources.js +92 -0
  108. package/dist/paper-sources.js.map +1 -0
  109. package/dist/ports/bib-reader.d.ts +18 -0
  110. package/dist/ports/bib-reader.d.ts.map +1 -0
  111. package/dist/ports/bib-reader.js +2 -0
  112. package/dist/ports/bib-reader.js.map +1 -0
  113. package/dist/ports/check-references.d.ts +9 -4
  114. package/dist/ports/check-references.d.ts.map +1 -1
  115. package/dist/ports/latex.d.ts +15 -0
  116. package/dist/ports/latex.d.ts.map +1 -1
  117. package/dist/ports/sources-codec.d.ts +11 -0
  118. package/dist/ports/sources-codec.d.ts.map +1 -0
  119. package/dist/ports/sources-codec.js +2 -0
  120. package/dist/ports/sources-codec.js.map +1 -0
  121. package/dist/ports/tex-output.d.ts +17 -0
  122. package/dist/ports/tex-output.d.ts.map +1 -0
  123. package/dist/ports/tex-output.js +2 -0
  124. package/dist/ports/tex-output.js.map +1 -0
  125. package/dist/recorded-bibliography.d.ts +89 -0
  126. package/dist/recorded-bibliography.d.ts.map +1 -0
  127. package/dist/recorded-bibliography.js +136 -0
  128. package/dist/recorded-bibliography.js.map +1 -0
  129. package/dist/reference-rules.d.ts +5 -5
  130. package/dist/reference-rules.d.ts.map +1 -1
  131. package/dist/reference-rules.js +150 -77
  132. package/dist/reference-rules.js.map +1 -1
  133. package/dist/references.d.ts +71 -16
  134. package/dist/references.d.ts.map +1 -1
  135. package/dist/references.js +110 -26
  136. package/dist/references.js.map +1 -1
  137. package/dist/register-bands.d.ts +3 -3
  138. package/dist/register-bands.d.ts.map +1 -1
  139. package/dist/register-bands.js.map +1 -1
  140. package/dist/register.d.ts +2 -2
  141. package/dist/sources-record.d.ts +38 -0
  142. package/dist/sources-record.d.ts.map +1 -0
  143. package/dist/sources-record.js +123 -0
  144. package/dist/sources-record.js.map +1 -0
  145. package/dist/sources-rules.d.ts +44 -0
  146. package/dist/sources-rules.d.ts.map +1 -0
  147. package/dist/sources-rules.js +76 -0
  148. package/dist/sources-rules.js.map +1 -0
  149. package/dist/tex-paper.d.ts +10 -15
  150. package/dist/tex-paper.d.ts.map +1 -1
  151. package/dist/tex-paper.js +24 -40
  152. package/dist/tex-paper.js.map +1 -1
  153. package/dist/tex-venue-rules.d.ts +3 -3
  154. package/dist/tex-venue-rules.d.ts.map +1 -1
  155. package/dist/tex-venue-rules.js.map +1 -1
  156. package/docs/configuration.md +12 -4
  157. package/docs/design/paper-sources.md +197 -0
  158. package/docs/package-shape-options.md +1 -1
  159. package/docs/references.md +34 -8
  160. package/docs/rules/bib/reachable-entry.md +64 -0
  161. package/docs/rules/paper/sources-fresh.md +81 -0
  162. package/docs/rules.md +62 -57
  163. package/eslint-rules/paper-context.ts +4 -3
  164. package/eslint-rules/paper-typography.test.mjs +12 -72
  165. package/eslint-rules/paper-typography.ts +13 -6
  166. package/eslint.config.mjs +22 -0
  167. package/fixtures/build-e2e/aidc/paper.tex +1 -1
  168. package/fixtures/build-e2e/anon-ack/paper.tex +1 -1
  169. package/fixtures/build-e2e/anon-author/paper.tex +1 -1
  170. package/fixtures/build-e2e/anon-bib/paper.tex +1 -1
  171. package/fixtures/build-e2e/anon-href/paper.tex +1 -1
  172. package/fixtures/build-e2e/anon-macro/paper.tex +1 -1
  173. package/fixtures/build-e2e/anon-pdfauthor/paper.tex +1 -1
  174. package/fixtures/paper-sources/p1/paper.tex +30 -0
  175. package/fixtures/paper-sources/p1/refs.bib +6 -0
  176. package/fixtures/paper-sources/p1/sections/dead.tex +6 -0
  177. package/fixtures/paper-sources/p1/sections/intro.tex +7 -0
  178. package/fixtures/paper-sources/p1/sections/parked.tex +6 -0
  179. package/fixtures/paper-sources/p1/tex-truth.json +37 -0
  180. package/fixtures/paper-sources/p1/versions/2026-01-01-review.tex +4 -0
  181. package/fixtures/paper-sources/v1-stale/paper.tex +14 -0
  182. package/fixtures/paper-sources/v1-stale/refs.bib +6 -0
  183. package/fixtures/paper-sources/v1-stale/tex-truth.json +32 -0
  184. package/fixtures/paper-sources/v10-ifthenelse/anon.bib +1 -0
  185. package/fixtures/paper-sources/v10-ifthenelse/paper.tex +9 -0
  186. package/fixtures/paper-sources/v10-ifthenelse/real.bib +1 -0
  187. package/fixtures/paper-sources/v10-ifthenelse/tex-truth.json +28 -0
  188. package/fixtures/paper-sources/v11-two-blocks/paper.tex +12 -0
  189. package/fixtures/paper-sources/v11-two-blocks/tex-truth.json +30 -0
  190. package/fixtures/paper-sources/v13-percent-text/paper.tex +6 -0
  191. package/fixtures/paper-sources/v13-percent-text/refs.bib +3 -0
  192. package/fixtures/paper-sources/v13-percent-text/tex-truth.json +30 -0
  193. package/fixtures/paper-sources/v15-after-end/paper.tex +6 -0
  194. package/fixtures/paper-sources/v15-after-end/refs.bib +1 -0
  195. package/fixtures/paper-sources/v15-after-end/tex-truth.json +17 -0
  196. package/fixtures/paper-sources/v16-included-block/bibblock.tex +3 -0
  197. package/fixtures/paper-sources/v16-included-block/paper.tex +7 -0
  198. package/fixtures/paper-sources/v16-included-block/refs.bib +1 -0
  199. package/fixtures/paper-sources/v16-included-block/tex-truth.json +35 -0
  200. package/fixtures/paper-sources/v17-include-order/bibsetup.tex +1 -0
  201. package/fixtures/paper-sources/v17-include-order/first.bib +1 -0
  202. package/fixtures/paper-sources/v17-include-order/later.bib +1 -0
  203. package/fixtures/paper-sources/v17-include-order/paper.tex +7 -0
  204. package/fixtures/paper-sources/v17-include-order/tex-truth.json +40 -0
  205. package/fixtures/paper-sources/v2-overwrite/paper.tex +14 -0
  206. package/fixtures/paper-sources/v2-overwrite/refs.bib +6 -0
  207. package/fixtures/paper-sources/v2-overwrite/tex-truth.json +30 -0
  208. package/fixtures/paper-sources/v22-parked-thebibliography/paper.tex +7 -0
  209. package/fixtures/paper-sources/v22-parked-thebibliography/tex-truth.json +17 -0
  210. package/fixtures/paper-sources/v23-parked-include/old.bib +1 -0
  211. package/fixtures/paper-sources/v23-parked-include/paper.tex +7 -0
  212. package/fixtures/paper-sources/v23-parked-include/parked.tex +1 -0
  213. package/fixtures/paper-sources/v23-parked-include/refs.bib +1 -0
  214. package/fixtures/paper-sources/v23-parked-include/tex-truth.json +28 -0
  215. package/fixtures/paper-sources/v24-quoted-fields/paper.tex +6 -0
  216. package/fixtures/paper-sources/v24-quoted-fields/refs.bib +5 -0
  217. package/fixtures/paper-sources/v24-quoted-fields/tex-truth.json +32 -0
  218. package/fixtures/paper-sources/v25-string-differs/paper.tex +10 -0
  219. package/fixtures/paper-sources/v25-string-differs/refs.bib +2 -0
  220. package/fixtures/paper-sources/v25-string-differs/tex-truth.json +32 -0
  221. package/fixtures/paper-sources/v26-comment-in-names/one.bib +1 -0
  222. package/fixtures/paper-sources/v26-comment-in-names/paper.tex +7 -0
  223. package/fixtures/paper-sources/v26-comment-in-names/tex-truth.json +32 -0
  224. package/fixtures/paper-sources/v26-comment-in-names/two.bib +1 -0
  225. package/fixtures/paper-sources/v27-shared-string/abbreviations.bib +2 -0
  226. package/fixtures/paper-sources/v27-shared-string/paper.tex +6 -0
  227. package/fixtures/paper-sources/v27-shared-string/references.bib +6 -0
  228. package/fixtures/paper-sources/v27-shared-string/tex-truth.json +31 -0
  229. package/fixtures/paper-sources/v28-shared-string-block/abbreviations.bib +2 -0
  230. package/fixtures/paper-sources/v28-shared-string-block/paper.tex +14 -0
  231. package/fixtures/paper-sources/v28-shared-string-block/tex-truth.json +33 -0
  232. package/fixtures/paper-sources/v29-generated-input/paper.tex +9 -0
  233. package/fixtures/paper-sources/v29-generated-input/tex-truth.json +24 -0
  234. package/fixtures/paper-sources/v3-declared/paper.bib +6 -0
  235. package/fixtures/paper-sources/v3-declared/paper.tex +6 -0
  236. package/fixtures/paper-sources/v3-declared/tex-truth.json +28 -0
  237. package/fixtures/paper-sources/v30-name-next-line/paper.tex +14 -0
  238. package/fixtures/paper-sources/v30-name-next-line/tex-truth.json +30 -0
  239. package/fixtures/paper-sources/v4-commented/paper.tex +14 -0
  240. package/fixtures/paper-sources/v4-commented/refs.bib +6 -0
  241. package/fixtures/paper-sources/v4-commented/tex-truth.json +28 -0
  242. package/fixtures/paper-sources/v5-percent-entry/paper.tex +20 -0
  243. package/fixtures/paper-sources/v5-percent-entry/tex-truth.json +37 -0
  244. package/fixtures/paper-sources/v6-unclosed/paper.tex +6 -0
  245. package/fixtures/paper-sources/v6-unclosed/refs.bib +5 -0
  246. package/fixtures/paper-sources/v6-unclosed/tex-truth.json +37 -0
  247. package/fixtures/paper-sources/v8-jobname/paper.tex +9 -0
  248. package/fixtures/paper-sources/v8-jobname/tex-truth.json +30 -0
  249. package/fixtures/paper-sources/v9-two-bibliographies/one.bib +1 -0
  250. package/fixtures/paper-sources/v9-two-bibliographies/paper.tex +7 -0
  251. package/fixtures/paper-sources/v9-two-bibliographies/tex-truth.json +35 -0
  252. package/fixtures/paper-sources/v9-two-bibliographies/two.bib +1 -0
  253. package/fixtures/paper-typography/clean-paper/paper.tex +1 -1
  254. package/fixtures/paper-typography/messy-paper/paper.tex +1 -1
  255. package/package.json +2 -10
  256. package/scripts/check.test.ts +23 -1
  257. package/scripts/check.ts +7 -3
  258. package/scripts/coverage-config.test.ts +19 -10
  259. package/scripts/layer-legacy-frozen.test.ts +41 -2
  260. package/scripts/layer-legacy-frozen.ts +31 -2
  261. package/skills/grade-paper-writing/SKILL.md +4 -3
  262. package/skills/grade-paper-writing/SKILL.md.spec.ts +3 -2
  263. package/skills/grade-paper-writing/prose-lint.mjs +11 -2
  264. package/skills/grade-paper-writing/prose-lint.test.ts +52 -4
  265. package/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs +83 -33
  266. package/skills/paper-pipeline/scripts/extract-ref-facts.mjs +67 -115
  267. package/skills/paper-pipeline/scripts/extract-ref-facts.test.mjs +128 -121
  268. package/skills/verify-citations/SKILL.md +7 -4
  269. package/skills/verify-citations/SKILL.md.spec.ts +6 -3
  270. package/skills/verify-citations/scripts/bib-authors.check.test.mjs +17 -19
  271. package/skills/verify-citations/scripts/bib-authors.cli.test.ts +129 -46
  272. package/skills/verify-citations/scripts/bib-authors.d.mts +22 -2
  273. package/skills/verify-citations/scripts/bib-authors.mjs +57 -111
  274. package/skills/verify-citations/scripts/verify-cites.cli.test.ts +16 -0
  275. package/skills/verify-citations/scripts/verify-cites.d.mts +19 -3
  276. package/skills/verify-citations/scripts/verify-cites.mjs +42 -108
  277. package/skills/verify-citations/scripts/verify-cites.test.mjs +23 -36
  278. package/src/adapters/bibtex/index.test.ts +163 -0
  279. package/src/adapters/bibtex/index.ts +155 -0
  280. package/src/adapters/latex/filecontents.ts +114 -0
  281. package/src/adapters/latex/includes.ts +18 -10
  282. package/src/adapters/latex/index.test.ts +73 -0
  283. package/src/adapters/latex/index.ts +2 -0
  284. package/src/adapters/latex/nodes.ts +64 -0
  285. package/src/adapters/latex/parse.test.ts +38 -0
  286. package/src/adapters/latex/parse.ts +67 -6
  287. package/src/adapters/memory/index.ts +17 -0
  288. package/src/adapters/references/index.test.ts +75 -21
  289. package/src/adapters/references/index.ts +37 -32
  290. package/src/adapters/sources-record/index.test.ts +87 -0
  291. package/src/adapters/sources-record/index.ts +82 -0
  292. package/src/adapters/tex-output/blg.ts +27 -0
  293. package/src/adapters/tex-output/fls.ts +24 -0
  294. package/src/adapters/tex-output/index.test.ts +171 -0
  295. package/src/adapters/tex-output/index.ts +12 -0
  296. package/src/bib-rules.test.ts +356 -0
  297. package/src/bib-rules.ts +228 -0
  298. package/src/bibliography-at.test.ts +286 -0
  299. package/src/build.test.ts +210 -0
  300. package/src/build.ts +100 -35
  301. package/src/claim-provenance.test.ts +33 -7
  302. package/src/claim-provenance.ts +2 -2
  303. package/src/cli.harness.mjs +20 -10
  304. package/src/cli.test.ts +14 -10
  305. package/src/cli.ts +37 -28
  306. package/src/domain/paper-source.test.ts +58 -20
  307. package/src/domain/paper-source.ts +38 -42
  308. package/src/domain/paper-sources.ts +94 -0
  309. package/src/domain/sources-record.test.ts +71 -0
  310. package/src/domain/sources-record.ts +136 -0
  311. package/src/domain/tex-run.test.ts +228 -0
  312. package/src/domain/tex-run.ts +139 -0
  313. package/src/heading-case.test.ts +24 -10
  314. package/src/latex-log.ts +20 -0
  315. package/src/latex-loop.harness.ts +1 -0
  316. package/src/latex-loop.ts +2 -0
  317. package/src/linted-set.test.ts +9 -1
  318. package/src/new-paper.harness.mjs +3 -2
  319. package/src/new-paper.test.ts +9 -5
  320. package/src/package-dirs.ts +3 -2
  321. package/src/paper-includes.test.ts +157 -38
  322. package/src/paper-includes.ts +39 -35
  323. package/src/paper-prose.test.ts +34 -5
  324. package/src/paper-prose.ts +2 -2
  325. package/src/paper-record.test.ts +173 -0
  326. package/src/paper-record.ts +66 -0
  327. package/src/paper-settings-commands.test.ts +5 -2
  328. package/src/paper-sources.ts +151 -0
  329. package/src/ports/bib-reader.ts +27 -0
  330. package/src/ports/check-references.ts +7 -3
  331. package/src/ports/latex.ts +19 -0
  332. package/src/ports/sources-codec.ts +11 -0
  333. package/src/ports/tex-output.ts +17 -0
  334. package/src/recorded-bibliography.ts +297 -0
  335. package/src/reference-rules.ts +217 -104
  336. package/src/references.test.ts +520 -177
  337. package/src/references.ts +185 -37
  338. package/src/register-bands.test.ts +5 -1
  339. package/src/register-bands.ts +3 -5
  340. package/src/register.test.ts +6 -1
  341. package/src/register.ts +2 -2
  342. package/src/rule-cases.test.ts +68 -12
  343. package/src/rule-docs.test.ts +0 -1
  344. package/src/sources-record.test.ts +308 -0
  345. package/src/sources-record.ts +231 -0
  346. package/src/sources-rules.test.ts +152 -0
  347. package/src/sources-rules.ts +117 -0
  348. package/src/tex-paper.test.ts +148 -78
  349. package/src/tex-paper.ts +31 -61
  350. package/src/tex-venue-rules.test.ts +36 -8
  351. package/src/tex-venue-rules.ts +3 -5
  352. package/dist/eslint-rules/bib-reachable-entry.d.ts +0 -22
  353. package/dist/eslint-rules/bib-reachable-entry.d.ts.map +0 -1
  354. package/dist/eslint-rules/bib-reachable-entry.js +0 -75
  355. package/dist/eslint-rules/bib-reachable-entry.js.map +0 -1
  356. package/eslint-rules/bib-reachable-entry.ts +0 -76
@@ -0,0 +1,89 @@
1
+ import { type BibEntry, type BibText } from "./domain/paper-sources.ts";
2
+ import type { AbsolutePath } from "./domain/paths.ts";
3
+ import type { Span } from "./domain/tex-document.ts";
4
+ import { type SourcesRecord } from "./domain/sources-record.ts";
5
+ import { type PaperRecord, type RecordReadDeps } from "./paper-record.ts";
6
+ import type { BibReader } from "./ports/bib-reader.ts";
7
+ import type { LatexReader } from "./ports/latex.ts";
8
+ /** What reading the recorded bibliography needs: the disk, the record's schema, the bibtex reader. */
9
+ export interface RecordedReadDeps extends RecordReadDeps {
10
+ readonly bib: BibReader;
11
+ }
12
+ /** And what finding where a `.bib` TeX wrote stands needs besides: the reader of `filecontents` blocks. */
13
+ export interface RecordedDeps extends RecordedReadDeps {
14
+ readonly latex: Pick<LatexReader, "filecontents">;
15
+ }
16
+ /** A database bibtex opened that is on disk now, as the bibtex reader reads it. */
17
+ export interface ReadDatabase {
18
+ /** As bibtex names it: `refs.bib`, `bibs/x.bib`. */
19
+ readonly name: string;
20
+ /** A `.bib` TeX wrote (a `filecontents` block), not one the author keeps. */
21
+ readonly written: boolean;
22
+ readonly bib: BibText;
23
+ }
24
+ export type RecordedBibliography = {
25
+ readonly kind: "unrecorded";
26
+ readonly record: Exclude<PaperRecord, {
27
+ readonly kind: "fresh";
28
+ }>;
29
+ } | {
30
+ readonly kind: "recorded";
31
+ readonly record: SourcesRecord;
32
+ /** In the order bibtex opened them, each once. */
33
+ readonly databases: readonly ReadDatabase[];
34
+ /**
35
+ * As bibtex names them: the databases it opened that the paper directory does not hold — found on
36
+ * its search path (BIBINPUTS). One that was there when the build recorded it and is gone now made
37
+ * the record stale instead: every database bibtex opened is hashed.
38
+ */
39
+ readonly unread: readonly string[];
40
+ };
41
+ /** The bibliography the last build of the paper in `dir` read. */
42
+ export declare function recordedBibliography(dir: string, deps: RecordedReadDeps): RecordedBibliography;
43
+ /** An entry of a database bibtex opened, and where it stands in that database. */
44
+ export interface RecordedEntry {
45
+ readonly database: ReadDatabase;
46
+ readonly entry: BibEntry;
47
+ /** Its place among the database's entries: what pairs it with the same entry of a block. */
48
+ readonly index: number;
49
+ }
50
+ /** Every entry of the databases, in the order bibtex opened them and the entries stand. */
51
+ export declare const entriesOfDatabases: (databases: readonly ReadDatabase[]) => readonly RecordedEntry[];
52
+ /** Where a finding about an entry is reported in paper.tex. */
53
+ export type EntryReport = {
54
+ readonly kind: "here";
55
+ readonly span: Span;
56
+ }
57
+ /** At the top of paper.tex; `where` names the entry (`refs.bib:12:1`). */
58
+ | {
59
+ readonly kind: "elsewhere";
60
+ readonly span: Span;
61
+ readonly where: string;
62
+ };
63
+ /** A text of the paper that may hold a block: a file of the record, the main file as the editor has it. */
64
+ interface Holder {
65
+ readonly path: AbsolutePath;
66
+ readonly text: string;
67
+ }
68
+ /** The paper being linted: where it is, the record of its build, and its main file as the editor holds it. */
69
+ export interface LintedPaper {
70
+ readonly dir: string;
71
+ readonly record: SourcesRecord;
72
+ readonly main: Holder;
73
+ }
74
+ /**
75
+ * Where each finding about `found` is reported, in the same order. The main file is read as the editor
76
+ * holds it; the record's other `.tex` files are read from disk.
77
+ */
78
+ export declare function entryReports(paper: LintedPaper, found: readonly RecordedEntry[], deps: RecordedDeps): readonly EntryReport[];
79
+ /**
80
+ * The text the author edits for each database bibtex opened, in the order it opened them: for a `.bib`
81
+ * TeX wrote, the block of `paper.tex` or of an included file that holds what bibtex read; for any other
82
+ * database, and for a written one no block holds, the file itself. What a script reads, so its entries
83
+ * stand where the author finds them.
84
+ */
85
+ export declare function authoredTexts(dir: string, recorded: Extract<RecordedBibliography, {
86
+ readonly kind: "recorded";
87
+ }>, deps: RecordedDeps): readonly BibText[];
88
+ export {};
89
+ //# sourceMappingURL=recorded-bibliography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recorded-bibliography.d.ts","sourceRoot":"","sources":["../src/recorded-bibliography.ts"],"names":[],"mappings":"AA0BA,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,OAAO,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,M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per-sources.md §1), through the one bibtex reader. Nothing
4
+ * here reads TeX source to decide which bibliography a paper has: TeX answered, the build wrote it
5
+ * down, and `paperRecord` says whether the paper is still the one it was written for.
6
+ *
7
+ * unrecorded no record, or a stale one — the rules that need it are silent (`paper/sources-fresh`
8
+ * speaks), the scripts refuse ("run `npx paperlint build` first")
9
+ * recorded a current record, and the databases bibtex opened that are on disk now (none when
10
+ * bibtex ran none), and the names of those that are not
11
+ *
12
+ * The databases are read in the order bibtex opened them, each with the `@string`s the ones before it
13
+ * left in force — bibtex keeps one table of them across its databases, so `\\bibliography{abbrev,refs}`
14
+ * expands an entry of `refs.bib` with a `@string` of `abbrev.bib`. A database that is not on disk adds
15
+ * none: its `@string`s are bibtex's alone.
16
+ *
17
+ * WHERE A FINDING ABOUT AN ENTRY GOES (`entryReports`). ESLint lints `paper.tex` only, so every finding
18
+ * is a place in it. An entry of a `.bib` TeX wrote (a `filecontents` block) is reported on its own line
19
+ * in the block of `paper.tex` whose body bibtex takes as the same database (`sameDatabase`) — a lookup
20
+ * of where the text stands, which decides nothing: the record said what TeX read. When no block of
21
+ * `paper.tex` is that database — the block is in an included file, or `paper.tex` was edited after the
22
+ * build — and for the entry of every other `.bib`, the finding is at the top of `paper.tex`, the file,
23
+ * line and column of the entry at the front of the message (`refs.bib:12:1:`).
24
+ */
25
+ import { extname, posix, relative, resolve } from "node:path";
26
+ import { callerPath } from "./caller-path.js";
27
+ import { sameDatabase, } from "./domain/paper-sources.js";
28
+ import { JOBNAME, spelledIn, } from "./domain/sources-record.js";
29
+ import { paperRecord, } from "./paper-record.js";
30
+ import { decoded, lineColumn } from "./tex-paper.js";
31
+ /**
32
+ * The databases `names`, in this order, each read with the `@string`s the ones before it left in force,
33
+ * as bibtex reads them. One that is not on disk adds none.
34
+ */
35
+ const readInSequence = (dir, names, deps) => names.reduce((acc, name) => {
36
+ const path = callerPath(resolve(dir, name));
37
+ const text = decoded(deps.files.readBytes(path));
38
+ const bib = text === null ? null : deps.bib.readFile(path, text, acc.inForce);
39
+ return {
40
+ inForce: bib?.strings ?? acc.inForce,
41
+ read: [...acc.read, { name, bib }],
42
+ };
43
+ }, { inForce: {}, read: [] }).read;
44
+ /** The bibliography the last build of the paper in `dir` read. */
45
+ export function recordedBibliography(dir, deps) {
46
+ const r = paperRecord(dir, deps);
47
+ if (r.kind !== "fresh")
48
+ return { kind: "unrecorded", record: r };
49
+ const { bibtex, written } = r.record;
50
+ const opened = readInSequence(dir, (bibtex.ran ? bibtex.databases : []).filter((d, i, all) => all.findIndex((o) => resolve(dir, o) === resolve(dir, d)) === i), deps);
51
+ return {
52
+ kind: "recorded",
53
+ record: r.record,
54
+ databases: opened.flatMap(({ name, bib }) => bib === null ? [] : [{ name, written: written.includes(name), bib }]),
55
+ unread: opened.filter((d) => d.bib === null).map((d) => d.name),
56
+ };
57
+ }
58
+ /** Every entry of the databases, in the order bibtex opened them and the entries stand. */
59
+ export const entriesOfDatabases = (databases) => databases.flatMap((database) => database.bib.entries.map((entry, index) => ({ database, entry, index })));
60
+ /** The first line of an entry: `@misc{key,` — what a finding underlines. */
61
+ const headOf = (bib, e) => {
62
+ const first = bib.text
63
+ .slice(e.span.start, e.span.end)
64
+ .split("\n", 1)
65
+ .join("");
66
+ return { start: e.span.start, end: e.span.start + first.length };
67
+ };
68
+ const TOP = { start: 0, end: 0 };
69
+ /**
70
+ * The text of every `.tex` the record lists, in the order TeX first read them: from disk, except
71
+ * `override` (the main file as the editor holds it), which stands for its own path. A record is only
72
+ * current while every file it lists is on disk, so none is skipped for being absent.
73
+ */
74
+ function holders(dir, record, override, deps) {
75
+ return record.inputs
76
+ .map((i) => callerPath(resolve(dir, i.path)))
77
+ .filter((p) => extname(p) === ".tex")
78
+ .map((path) => override !== null && override.path === path
79
+ ? override
80
+ : { path, text: decoded(deps.files.readBytes(path)) })
81
+ .filter((h) => h.text !== null);
82
+ }
83
+ /** The block, in some text of the paper, that holds what bibtex read of `db`. */
84
+ const blockHolding = (db, texts, deps) => texts
85
+ .flatMap((holder) => deps.latex
86
+ .filecontents(holder.text, JOBNAME)
87
+ // The block that wrote this database: its file, then its text.
88
+ .filter((b) => spelledIn([posix.normalize(b.writes)], db.name) !== null)
89
+ // Read as bibtex read the database: with the `@string`s in force before it.
90
+ .map((b) => ({
91
+ holder,
92
+ bib: deps.bib.read(holder.path, holder.text, b.body, db.bib.inherited),
93
+ })))
94
+ .find((b) => sameDatabase(b.bib, db.bib)) ?? null;
95
+ /** Where a finding about `f` is reported, given the block of a text of the paper that holds its database (or none). */
96
+ function reportOf(paper, block, f) {
97
+ const there = block?.bib.entries[f.index];
98
+ if (block === null || there?.key !== f.entry.key)
99
+ return {
100
+ kind: "elsewhere",
101
+ span: TOP,
102
+ where: `${f.database.name}:${lineColumn(f.database.bib.text, headOf(f.database.bib, f.entry).start)}`,
103
+ };
104
+ const span = headOf(block.bib, there);
105
+ return block.holder.path === paper.main.path
106
+ ? { kind: "here", span }
107
+ : {
108
+ kind: "elsewhere",
109
+ span: TOP,
110
+ where: `${relative(paper.dir, block.holder.path)}:${lineColumn(block.holder.text, span.start)}`,
111
+ };
112
+ }
113
+ /**
114
+ * Where each finding about `found` is reported, in the same order. The main file is read as the editor
115
+ * holds it; the record's other `.tex` files are read from disk.
116
+ */
117
+ export function entryReports(paper, found, deps) {
118
+ const texts = holders(paper.dir, paper.record, paper.main, deps);
119
+ // Only the written databases that have a finding are searched for their block.
120
+ const blocks = new Map(found
121
+ .map((f) => f.database)
122
+ .filter((d, i, all) => d.written && all.indexOf(d) === i)
123
+ .map((d) => [d, blockHolding(d, texts, deps)]));
124
+ return found.map((f) => reportOf(paper, blocks.get(f.database) ?? null, f));
125
+ }
126
+ /**
127
+ * The text the author edits for each database bibtex opened, in the order it opened them: for a `.bib`
128
+ * TeX wrote, the block of `paper.tex` or of an included file that holds what bibtex read; for any other
129
+ * database, and for a written one no block holds, the file itself. What a script reads, so its entries
130
+ * stand where the author finds them.
131
+ */
132
+ export function authoredTexts(dir, recorded, deps) {
133
+ const texts = holders(dir, recorded.record, null, deps);
134
+ return recorded.databases.map((d) => (d.written ? blockHolding(d, texts, deps)?.bib : undefined) ?? d.bib);
135
+ }
136
+ //# sourceMappingURL=recorded-bibliography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recorded-bibliography.js","sourceRoot":"","sources":["../src/recorded-bibliography.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,YAAY,GAIb,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,OAAO,EACP,SAAS,GAEV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,WAAW,GAGZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6CrD;;;GAGG;AACH,MAAM,cAAc,GAAG,CACrB,GAAW,EACX,KAAwB,EACxB,IAAsB,EACH,EAAE,CACrB,KAAK,CAAC,MAAM,CAIV,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IACZ,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,MAAM,GAAG,GACP,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACpE,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,GAAG,CAAC,OAAO;QACpC,IAAI,EA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4
  readonly column: number;
@@ -7,6 +7,8 @@ interface RuleContext {
7
7
  readonly filename: string;
8
8
  readonly cwd: string;
9
9
  readonly sourceCode: {
10
+ /** The file as written (the `tex/latex` language's source code). */
11
+ readonly raw: string;
10
12
  getLocFromIndex(i: number): Loc;
11
13
  };
12
14
  report(d: {
@@ -32,10 +34,8 @@ export interface ReferenceRuleModule {
32
34
  };
33
35
  }
34
36
  type Name = "author-list" | "cite-exists" | "refs-checked" | "refs-fresh";
35
- /** The four rules, reading through `files`. They act on `paper.tex` only. */
36
- export declare function referenceRules({ files, }: {
37
- files: Files;
38
- }): Record<Name, ReferenceRuleModule>;
37
+ /** The four rules, reading the paper through `deps`. They act on `paper.tex` only. */
38
+ export declare function referenceRules(deps: RecordedDeps): Record<Name, ReferenceRuleModule>;
39
39
  /** The level each is on at for every `paper.tex` in paperlint's own config. */
40
40
  export declare const REFERENCE_RULE_LEVELS: {
41
41
  readonly "paper/author-list": "error";
@@ -1 +1 @@
1
- {"version":3,"file":"reference-rules.d.ts","sourceRoot":"","sources":["../src/reference-rules.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAS9C,UAAU,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AACD,UAAU,WAAW;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE;QACnB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KACjC,CAAC;IACF,MAAM,CAAC,CAAC,EAAE;QACR,GAAG,EAAE;YAAE,KAAK,EAAE,GAAG,CAAC;YAAC,GAAG,EAAE,GAAG,CAAA;SAAE,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CA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EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KACjC,CAAC;IACF,MAAM,CAAC,CAAC,EAAE;QACR,GAAG,EAAE;YAAE,KAAK,EAAE,GAAG,CAAC;YAAC,GAAG,EAAE,GAAG,CAAA;SAAE,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,GAAG,IAAI,CAAC;CACV;AACD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;QACxC,QAAQ,CAAC,IAAI,EAAE;YAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;QAChD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;QACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACrD,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG;QAAE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CAC5D;AAED,KAAK,IAAI,GAAG,aAAa,GAAG,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;AA+N1E,sFAAsF;AACtF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,GACjB,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC,CA6BnC;AAED,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC"}
@@ -5,47 +5,76 @@
5
5
  *
6
6
  * entry whose authors are the preprint's paper/author-list (error), on the entry
7
7
  * entry whose identifier provably fails paper/cite-exists (error), on the entry
8
- * no record, or recorded "not checked" paper/refs-checked (warn) — like pdf/measured
9
- * bibliography edited after the build paper/refs-fresh (error) — like pdf/fresh
8
+ * no verdicts, or recorded "not checked" paper/refs-checked (warn) — like pdf/measured
9
+ * a key bibtex typeset that no entry the paper/refs-checked (warn): that reference was not
10
+ * reader read has (`unseenKeys`) checked
11
+ * a database bibtex found outside the paper/refs-checked (warn): its references were not checked
12
+ * paper directory (BIBINPUTS)
13
+ * databases edited after the build paper/refs-fresh (error) — like pdf/fresh
10
14
  *
11
- * While the record is stale, the per-entry rules are silent: they would judge a bibliography
12
- * that no longer exists, and refs-fresh already says so once. A paper with no bibliography gets
13
- * nothing.
15
+ * The databases are the ones the last build's bibtex opened (`_build/sources.json`,
16
+ * docs/design/paper-sources.md §1) — `readBibliography` answers only from a record the paper has not
17
+ * changed since. With no record, or a stale one, every rule here is silent: `paper/sources-fresh`
18
+ * speaks once. While the verdicts are stale, the per-entry rules are silent too: they would judge
19
+ * databases that no longer exist, and refs-fresh already says so once. A paper whose build ran no
20
+ * bibtex gets nothing.
21
+ *
22
+ * `paper/author-list` and `paper/cite-exists` lay the verdicts on the entries of those databases. ESLint
23
+ * does not lint a `.bib`, so a finding is a place in `paper.tex`: an entry of a `.bib` TeX wrote from a
24
+ * block of `paper.tex` is reported on its line there (`entryReports`); any other entry at the top of
25
+ * `paper.tex`, with the entry's file, line and column at the front of the message (`refs.bib:12:1:`).
14
26
  *
15
27
  * `paper/author-list` used to live on PIPELINE-STATUS.md and ask whether the scorecard mentioned
16
28
  * a run. It lives here now because its subject is the bibliography, and the record of the run is
17
29
  * the run's own output.
18
30
  */
19
31
  import { basename, dirname } from "node:path";
20
- import { bibHash, bibliographyOf, readReferences, REFERENCES_FILE, } from "./references.js";
21
- function assess(files, paperDir) {
22
- const bib = bibliographyOf(files, paperDir);
23
- if (bib === null)
24
- return { kind: "no-bibliography" };
25
- const doc = readReferences(files, paperDir);
32
+ import { callerPath } from "./caller-path.js";
33
+ import { MAIN_FILE } from "./domain/paper-sources.js";
34
+ import { entryReports, } from "./recorded-bibliography.js";
35
+ import { bibHash, readBibliography, readReferences, REFERENCES_FILE, unseenKeys, } from "./references.js";
36
+ /**
37
+ * Each entry checked with its verdict — when the record holds one verdict per entry, in its order, as
38
+ * the build writes it. One that does not (written by hand) is not about these databases: null.
39
+ */
40
+ function laid(verdicts, entries) {
41
+ const pairs = entries.flatMap((f, i) => {
42
+ const v = verdicts[i];
43
+ return v?.key === f.entry.key ? [[f, v]] : [];
44
+ });
45
+ return pairs.length === entries.length && verdicts.length === entries.length
46
+ ? pairs
47
+ : null;
48
+ }
49
+ /** What the verdicts on disk say about the databases of `bib`. */
50
+ function judgedVerdicts(bib, doc) {
26
51
  if (doc === null)
27
52
  return { kind: "unrecorded" };
28
53
  if (doc.bib.sha256 !== bibHash(bib))
29
54
  return { kind: "stale" };
30
55
  if (doc.status === "not-checked")
31
56
  return { kind: "not-checked", why: doc.why ?? "no reason recorded" };
32
- const failing = doc.entries.flatMap((e) => [
33
- ...(e.authors === "mismatch"
34
- ? [{ key: e.key, rule: "author-list", why: e.why ?? "" }]
35
- : []),
36
- ...(e.exists === "false"
37
- ? [{ key: e.key, rule: "cite-exists", why: e.why ?? "" }]
38
- : []),
39
- ]);
40
- return { kind: "ready", bib, failing };
57
+ const verdicts = laid(doc.entries, bib.entries);
58
+ return verdicts === null
59
+ ? { kind: "stale" }
60
+ : { kind: "ready", judged: { bib, verdicts } };
41
61
  }
42
- /** Where entry `key` starts in the source file: its `@type{key,` line, or the file's start. */
43
- function entryOffset(bib, key) {
44
- const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
45
- const m = new RegExp(`^@\\w+\\s*\\{\\s*${escaped}\\s*,`, "m").exec(bib.text);
46
- return m ? bib.offset + m.index : 0;
62
+ function assess(deps, paperDir) {
63
+ const read = readBibliography(paperDir, deps);
64
+ switch (read.kind) {
65
+ case "no-record":
66
+ case "nothing":
67
+ case "not-wired":
68
+ return { kind: "silent" };
69
+ case "unread":
70
+ return { kind: "unread", databases: read.databases };
71
+ case "read":
72
+ return judgedVerdicts(read.bibliography, readReferences(deps.files, paperDir));
73
+ }
47
74
  }
48
75
  const BUILD = "`npx paperlint build`";
76
+ const MISMATCH = "`{{key}}`: the authors are not those of the version cited — {{why}}. The citation resolves and the id resolves, and the list is the PREPRINT's under a published venue";
77
+ const MISSING = "`{{key}}` does not resolve to the work cited — {{why}}";
49
78
  const META = {
50
79
  "author-list": {
51
80
  type: "problem",
@@ -53,9 +82,7 @@ const META = {
53
82
  description: "each entry's authors are those of the version it cites, not the preprint's (recorded by paperlint build)",
54
83
  },
55
84
  schema: [],
56
- messages: {
57
- mismatch: "`{{key}}`: the authors are not those of the version cited — {{why}}. The citation resolves and the id resolves, and the list is the PREPRINT's under a published venue",
58
- },
85
+ messages: { mismatch: MISMATCH, mismatchIn: `{{where}}: ${MISMATCH}` },
59
86
  },
60
87
  "cite-exists": {
61
88
  type: "problem",
@@ -63,9 +90,7 @@ const META = {
63
90
  description: "each entry's identifier resolves to the work cited (recorded by paperlint build)",
64
91
  },
65
92
  schema: [],
66
- messages: {
67
- missing: "`{{key}}` does not resolve to the work cited — {{why}}",
68
- },
93
+ messages: { missing: MISSING, missingIn: `{{where}}: ${MISSING}` },
69
94
  },
70
95
  "refs-checked": {
71
96
  type: "suggestion",
@@ -76,12 +101,14 @@ const META = {
76
101
  messages: {
77
102
  unrecorded: `the references have not been checked — ${BUILD} checks them online and records the result in _build/${REFERENCES_FILE}`,
78
103
  notChecked: `the last build could not check the references ({{why}}) — run ${BUILD} with network`,
104
+ unseen: "the last build's bibtex typeset {{what}}, which paperlint's reader did not read from the databases bibtex opened, so those references were not checked: an entry behind `%` or inside `@comment{…}` — bibtex has no comment syntax and reads it, the reader skips it. Delete the entry, or remove its `@`",
105
+ unread: `{{what}}, which the last build's bibtex opened, is not in the paper directory (bibtex found it on its search path, BIBINPUTS), so its references were not checked — move it beside paper.tex`,
79
106
  },
80
107
  },
81
108
  "refs-fresh": {
82
109
  type: "problem",
83
110
  docs: {
84
- description: "the recorded reference verdicts are about the bibliography on disk, not an earlier one",
111
+ description: "the recorded reference verdicts are about the databases on disk, not an earlier set",
85
112
  },
86
113
  schema: [],
87
114
  messages: {
@@ -89,61 +116,107 @@ const META = {
89
116
  },
90
117
  },
91
118
  };
119
+ const AT_START = { kind: "here", span: { start: 0, end: 0 } };
92
120
  const JUDGES = {
93
- "author-list": (a) => a.kind === "ready"
94
- ? a.failing
95
- .filter((f) => f.rule === "author-list")
96
- .map((f) => ({
97
- at: entryOffset(a.bib, f.key),
98
- messageId: "mismatch",
99
- data: { key: f.key, why: f.why },
100
- }))
101
- : [],
102
- "cite-exists": (a) => a.kind === "ready"
103
- ? a.failing
104
- .filter((f) => f.rule === "cite-exists")
105
- .map((f) => ({
106
- at: entryOffset(a.bib, f.key),
107
- messageId: "missing",
108
- data: { key: f.key, why: f.why },
109
- }))
110
- : [],
111
- "refs-checked": (a) => a.kind === "unrecorded"
112
- ? [{ at: 0, messageId: "unrecorded" }]
113
- : a.kind === "not-checked"
114
- ? [{ at: 0, messageId: "notChecked", data: { why: a.why } }]
115
- : [],
116
- "refs-fresh": (a) => a.kind === "stale" ? [{ at: 0, messageId: "stale" }] : [],
121
+ "refs-checked": (a) => {
122
+ switch (a.kind) {
123
+ case "unrecorded":
124
+ return [{ messageId: "unrecorded" }];
125
+ case "not-checked":
126
+ return [{ messageId: "notChecked", data: { why: a.why } }];
127
+ case "unread":
128
+ return [
129
+ { messageId: "unread", data: { what: a.databases.join(", ") } },
130
+ ];
131
+ case "ready": {
132
+ const unseen = unseenKeys(a.judged.bib);
133
+ return unseen.length === 0
134
+ ? []
135
+ : [
136
+ {
137
+ messageId: "unseen",
138
+ data: { what: unseen.map((k) => `\`${k}\``).join(", ") },
139
+ },
140
+ ];
141
+ }
142
+ case "silent":
143
+ case "stale":
144
+ return [];
145
+ }
146
+ },
147
+ "refs-fresh": (a) => (a.kind === "stale" ? [{ messageId: "stale" }] : []),
117
148
  };
118
- /** The four rules, reading through `files`. They act on `paper.tex` only. */
119
- export function referenceRules({ files, }) {
120
- const make = (name) => ({
149
+ /**
150
+ * One finding, at its entry in paper.tex — or, for an entry in a `.bib`, at the top, with the `…In`
151
+ * message that names the entry's file, line and column first.
152
+ */
153
+ function report(context, r) {
154
+ const loc = (i) => context.sourceCode.getLocFromIndex(i);
155
+ const at = r.at ?? AT_START;
156
+ context.report({
157
+ loc: { start: loc(at.span.start), end: loc(at.span.end) },
158
+ ...(at.kind === "here"
159
+ ? { messageId: r.messageId, ...(r.data ? { data: r.data } : {}) }
160
+ : {
161
+ messageId: `${r.messageId}In`,
162
+ data: { ...r.data, where: at.where },
163
+ }),
164
+ });
165
+ }
166
+ /** The verdicts a rule reports, and the message each makes. */
167
+ const VERDICT_RULES = {
168
+ "author-list": {
169
+ failed: (v) => v.authors === "mismatch",
170
+ messageId: "mismatch",
171
+ },
172
+ "cite-exists": {
173
+ failed: (v) => v.exists === "false",
174
+ messageId: "missing",
175
+ },
176
+ };
177
+ /**
178
+ * The entries the verdicts judged failing for `rule`, each where it is reported (`entryReports`): the
179
+ * line of its `filecontents` block in the paper's text when TeX wrote its `.bib` from one, else the
180
+ * top of `paper.tex`.
181
+ */
182
+ function verdictReports(rule, context, deps) {
183
+ const main = callerPath(context.filename);
184
+ const dir = dirname(main);
185
+ const a = assess(deps, dir);
186
+ if (a.kind !== "ready")
187
+ return [];
188
+ const { failed, messageId } = VERDICT_RULES[rule];
189
+ const flagged = a.judged.verdicts.filter(([, v]) => failed(v));
190
+ const at = entryReports({
191
+ dir,
192
+ record: a.judged.bib.record,
193
+ main: { path: main, text: context.sourceCode.raw },
194
+ }, flagged.map(([f]) => f), deps);
195
+ return flagged.map(([, v], i) => ({
196
+ at: at[i],
197
+ messageId,
198
+ data: { key: v.key, why: v.why ?? "" },
199
+ }));
200
+ }
201
+ /** The four rules, reading the paper through `deps`. They act on `paper.tex` only. */
202
+ export function referenceRules(deps) {
203
+ const make = (name, judge) => ({
121
204
  meta: META[name],
122
- create: (context) => basename(context.filename) !== "paper.tex"
205
+ create: (context) => basename(context.filename) !== MAIN_FILE
123
206
  ? {}
124
207
  : {
125
208
  "root:exit": () => {
126
- const paperDir = dirname(context.filename);
127
- const a = assess(files, paperDir);
128
- // An external refs.bib: the entry is not in this file, so the finding sits at its
129
- // start and names the key.
130
- const external = a.kind === "ready" && a.bib.source !== "paper.tex";
131
- for (const r of JUDGES[name](a)) {
132
- const loc = context.sourceCode.getLocFromIndex(external ? 0 : r.at);
133
- context.report({
134
- loc: { start: loc, end: loc },
135
- messageId: r.messageId,
136
- ...(r.data ? { data: r.data } : {}),
137
- });
138
- }
209
+ for (const r of judge(context))
210
+ report(context, r);
139
211
  },
140
212
  },
141
213
  });
214
+ const assessed = (name) => (context) => JUDGES[name](assess(deps, dirname(callerPath(context.filename))));
142
215
  return {
143
- "author-list": make("author-list"),
144
- "cite-exists": make("cite-exists"),
145
- "refs-checked": make("refs-checked"),
146
- "refs-fresh": make("refs-fresh"),
216
+ "author-list": make("author-list", (c) => verdictReports("author-list", c, deps)),
217
+ "cite-exists": make("cite-exists", (c) => verdictReports("cite-exists", c, deps)),
218
+ "refs-checked": make("refs-checked", assessed("refs-checked")),
219
+ "refs-fresh": make("refs-fresh", assessed("refs-fresh")),
147
220
  };
148
221
  }
149
222
  /** The level each is on at for every `paper.tex` in paperlint's own config. */
@@ -1 +1 @@
1
- {"version":3,"file":"reference-rules.js","sourceRoot":"","sources":["../src/reference-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,GAEhB,MAAM,iBAAiB,CAAC;AA8CzB,SAAS,MAAM,CAAC,KAAY,EAAE,QAAgB;IAC5C,MAAM,GAAG,GAAG,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5C,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAA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