Line mismatch in error message
hugovk opened this issue · 2 comments
sphinx-lint==0.6 finds a valid bug in this file:
winbuild/build.rst:44: inline literal missing (escaped) space after literal: '``ARM64``b' (missing-space-after-literal)
However, the problem is on line 45 not 44.
This seems caused by a bug in the paragraph
function:
Lines 239 to 253 in b377556
I tried to run it on the file you linked, and it produced these numbers:
>>> with open(fname) as f:
... for lno, p in paragraphs(f.readlines()):
... print(lno, repr(p[:30]))
...
1 'Building Pillow on Windows\n==='
3 '.. note:: For most people, the'
7 'This page describes the steps '
10 'Prerequisites\n-------------\n'
13 'Compilers\n^^^^^^^^^\n'
17 'Download and install:\n'
19 '* `Microsoft Visual Studio 201'
23 '* `CMake 3.12 or newer <https:'
26 '* x86/x64: `NASM <https://www.'
28 'Any version of Visual Studio 2'
31 'Paths to CMake (if standalone)'
34 'Build configuration\n----------'
37 'The following environment vari'
40 '* ``PYTHON`` + ``EXECUTABLE`` '
53 '``build_prepare.py`` also supp'
55 '* ``-v`` will print generated '
The relevant paragraph here is the one that starts with * ``PYTHON`` + ``EXECUTABLE``
. The paragraphs
function says it starts at line 40
, however the correct line number should be 41
. Some of the other values are also off.
The following bit of code in check_missing_space_after_literal
does 40 + 4
and gets 44
, instead of doing 41 + 4
and get 45
.
Lines 230 to 236 in b377556
I'm releasing v0.6.1 to fix this, thanks for reporting @hugovk! (And for fixing @ezio-melotti!)