Skip to content

fix(Linter/DocString): report Verso parse errors at their position in the file - #44034

Open
kim-em wants to merge 2 commits into
leanprover-community:masterfrom
kim-em:docstring-verso-positions
Open

kim-em wants to merge 2 commits into
leanprover-community:masterfrom
kim-em:docstring-verso-positions

Conversation

@kim-em

@kim-em kim-em commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

This PR fixes the positions reported by the linter.style.docStringVerso linter. The linter parses the doc-string text in a fresh input context, so the parse errors carry positions relative to the doc-string, and logging them at the resulting syntax produced line numbers relative to the doc-string rather than the file (this week's weekly linting report has warnings at Mathlib/Algebra/Field/GeomSum.lean:3, the copyright header). The linter now offsets each error by the position of the doc-string text in the file and reports the range from the start of the construct Verso was parsing to the point of failure. To make the offsets exact, the replacements of autolinks and $$ blocks that precede parsing now preserve the byte length of the text instead of substituting URL and LaTeX.

🤖 Prepared with Claude Code

… the file

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown

PR summary e019f6fae1

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ blankOut
+ logVersoErrors

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit e019f6f).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.
No changes to weak technical debt.

Current commit e019f6fae1
Reference commit 0a6c8e0355

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-linter Linter label Sep 21, 2026
@grunweg
grunweg requested a review from Vierkantor September 21, 2026 09:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-linter Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant