Closed Heryz1 closed 1 year ago
From the description it seems that this is rather an issue in rstcheck-core. But this would need further triaging.
Unfortunately I am infrequently at home, so this may or may not take some time until I can check it myself.
PRs are welcome, if you find and fix the issue ;) If you have questions, feel free to ask.
I tried to recreate your issue on my linux maschine with py3.9.16 but failed to do so.
Next I tried to recreate it with your specified patch version of py3.9 via docker and also failed to do so. See console log:
$ docker run --rm -it python:3.9.2-alpine3.13 sh
/ # apk add g++
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/15) Upgrading musl (1.2.2-r0 -> 1.2.2-r1)
(2/15) Installing libgcc (10.2.1_pre1-r3)
(3/15) Installing libstdc++ (10.2.1_pre1-r3)
(4/15) Installing binutils (2.35.2-r1)
(5/15) Installing libgomp (10.2.1_pre1-r3)
(6/15) Installing libatomic (10.2.1_pre1-r3)
(7/15) Installing libgphobos (10.2.1_pre1-r3)
(8/15) Installing gmp (6.2.1-r1)
(9/15) Installing isl22 (0.22-r0)
(10/15) Installing mpfr4 (4.1.0-r0)
(11/15) Installing mpc1 (1.2.0-r0)
(12/15) Installing gcc (10.2.1_pre1-r3)
(13/15) Installing musl-dev (1.2.2-r1)
(14/15) Installing libc-dev (0.7.2-r3)
(15/15) Installing g++ (10.2.1_pre1-r3)
Executing busybox-1.32.1-r5.trigger
OK: 197 MiB in 50 packages
/ # python3 -m venv .venv
/ # . .venv/bin/activate
(.venv) / # pip install rstcheck==6.1.1
Collecting rstcheck==6.1.1
Downloading rstcheck-6.1.1-py3-none-any.whl (6.9 kB)
Collecting rstcheck-core<2.0.0,>=1.0.2
Downloading rstcheck_core-1.0.3-py3-none-any.whl (25 kB)
Collecting typer[all]<0.8,>=0.4.1
Downloading typer-0.7.0-py3-none-any.whl (38 kB)
Collecting docutils<0.20,>=0.7
Downloading docutils-0.19-py3-none-any.whl (570 kB)
|████████████████████████████████| 570 kB 6.0 MB/s
Collecting pydantic<2.0,>=1.2
Downloading pydantic-1.10.6-py3-none-any.whl (156 kB)
|████████████████████████████████| 156 kB 31.5 MB/s
Collecting types-docutils<0.20,>=0.18
Downloading types_docutils-0.19.1.6-py3-none-any.whl (16 kB)
Collecting click<9.0.0,>=7.1.1
Downloading click-8.1.3-py3-none-any.whl (96 kB)
|████████████████████████████████| 96 kB 3.8 MB/s
Collecting rich<13.0.0,>=10.11.0; extra == "all"
Downloading rich-12.6.0-py3-none-any.whl (237 kB)
|████████████████████████████████| 237 kB 25.6 MB/s
Collecting colorama<0.5.0,>=0.4.3; extra == "all"
Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting shellingham<2.0.0,>=1.3.0; extra == "all"
Downloading shellingham-1.5.0.post1-py2.py3-none-any.whl (9.4 kB)
Collecting typing-extensions>=4.2.0
Downloading typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting commonmark<0.10.0,>=0.9.0
Downloading commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
|████████████████████████████████| 51 kB 6.4 MB/s
Collecting pygments<3.0.0,>=2.6.0
Downloading Pygments-2.14.0-py3-none-any.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 25.4 MB/s
Installing collected packages: docutils, typing-extensions, pydantic, types-docutils, rstcheck-core, click, commonmark, pygments, rich, colorama, shellingham, typer, rstcheck
Successfully installed click-8.1.3 colorama-0.4.6 commonmark-0.9.1 docutils-0.19 pydantic-1.10.6 pygments-2.14.0 rich-12.6.0 rstcheck-6.1.1 rstcheck-core-1.0.3 shellingham-1.5.0.post1 typer-0.7.0 types-docutils-0.19.1.6 typing-extensions-4.5.0
WARNING: You are using pip version 20.2.3; however, version 23.0.1 is available.
You should consider upgrading via the '/.venv/bin/python3 -m pip install --upgrade pip' command.
(.venv) / # cat <<EOF >> test.rst
> .. code-block:: cpp
>
> int main() {
> return 0;
> }
> EOF
(.venv) / # rstcheck test.rst
Success! No issues detected.
(.venv) / # g++ --version
g++ (Alpine 10.2.1_pre1) 10.2.1 20201203
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(.venv) / #
Unfortunately I don't know cpp so my possibilities to help are very limited.
Could the cpp compiler version have an influence here?
rstcheck checks the CXX
environment variable to get your cpp compiler and falls back to g++
. https://github.com/rstcheck/rstcheck-core/blob/main/src/rstcheck_core/checker.py#L768
My local maschine has g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
installed and the docker container had g++ (Alpine 10.2.1_pre1) 10.2.1 20201203
installed.
Hello,
My explanation was a bit confuse. the code-block must be indented and it seems that github deleted the indentation in the rst code I sent last time.
A first paragraph
.. code-block:: cpp
int main() {
return 0;
}
With this code, rstcheck returns : ERROR:rstcheck_core.checker:Could not find line for literal block directive. Source: xxx at line None
Hope I can take another look at this within the next 2 weeks.
Yes I can recreate the issue. The search for the root cause is next.
Code causing the logged error message: https://github.com/rstcheck/rstcheck-core/blob/main/src/rstcheck_core/checker.py#L420-L426
I can reproduce the error with fresh virtualenv with py3.8 up to py3.12 and only rstcheck
6.2 and rstcheck-core
1.1 installed.
When I install sphinx
(7.2.5) also the error log msg goes away.
I have snooty in my VSCode installed, which is a language server for rst. Snooty complains about the indentation. When I remove the indentation snooty does not complain and the error message when running rstcheck goes away. So I guess removing the indentation is the way to go.
To Dos
[X] I tested with the latest released version.
[X] I have checked the issues and think that this is not a duplicate.
[X] I added a very descriptive title to this issue.
Example Code (rst)
Relevant log output
Description
When I try to add an indented code-block, rstcheck prints an error. Therefore I am unable to add indented code-block inside a list block
Operating System
Linux
Operating System Details
WSL2
Python Version
Python 3.9.2
rstcheck Version
rstcheck CLI Version: 6.1.1 rstcheck-core Version: 1.0.3
Additional Context
No response