rstcheck / rstcheck-core

Core library behind rstcheck.
http://rstcheck-core.rtfd.io/
MIT License
4 stars 8 forks source link

[Bug]: rstcheck confuses `include` directive with `code-block` #63

Closed ReenigneArcher closed 1 year ago

ReenigneArcher commented 1 year ago

To Dos

Example Code (rst)

Table of Contents
=================
.. include:: toc.rst

Relevant log output

CRITICAL:rstcheck_core.checker:An `AttributeError` error occured. This is most propably due to a code block directive (code/code-block/sourcecode) without a specified language. This may result in a false negative for source: 'docs/source/index.rst'. See https://rstcheck-core.readthedocs.io/en/latest/faq/#code-blocks-without-language-sphinx for more information.

CRITICAL:rstcheck_core.checker:An `AttributeError` error occured. This is most propably due to a code block directive (code/code-block/sourcecode) without a specified language. This may result in a false negative for source: 'docs/source/about/overview.rst'. See https://rstcheck-core.readthedocs.io/en/latest/faq/#code-blocks-without-language-sphinx for more information.

Description

I am not sure if this is a false positive or what, but I don't have any code-blocks without a specified language.

The first line in the output points to the file pasted above... A pretty simple file. I don't know if the error is actually in that file or within what's included, which is here:

.. toctree::
   :maxdepth: 2
   :caption: About

   about/overview
   about/installation
   about/docker
   about/third_party_packages
   about/usage
   about/app_examples
   about/advanced_usage
   about/changelog

.. toctree::
   :maxdepth: 2
   :caption: GameStream

   gamestream/gamestream

.. toctree::
   :maxdepth: 2
   :caption: Troubleshooting

   troubleshooting/general
   troubleshooting/linux
   troubleshooting/macos
   troubleshooting/windows

.. toctree::
   :maxdepth: 2
   :caption: Build

   building/build
   building/linux
   building/macos
   building/windows

.. toctree::
   :maxdepth: 2
   :caption: Contributing

   contributing/contributing
   contributing/localization
   contributing/testing

.. toctree::
   :maxdepth: 2
   :caption: Legal

   legal/legal

.. toctree::
   :maxdepth: 2
   :caption: source

   source/src

The second error points to this file, which also contains an include directive, and in this case nothing else.

.. include:: ../../../README.rst

There are no code blocks in the included file.

Perhaps this library doesn't understand the include directive?

Operating System

Linux

Operating System Details

This is running in a readthedocs build, Ubuntu 22.04.

Python Version

3.11

rstcheck Version

6.1.2

Additional Context

No response

ReenigneArcher commented 1 year ago

Additionally, after resolving the syntax error in my c++ code block (referenced in rstcheck/rstcheck-core#64)... this no longer returns with an error code, which seems odd if this is marked as CRITICAL.

Cielquan commented 1 year ago

This is related to or somewhat a duplicate of https://github.com/rstcheck/rstcheck-core/issues/3.

The underlying issue is that sphinx sometimes throws an AttributeError and that a code directive without a language triggers this issue was a finding of me which I chose to print when this issue occurs. Therefore the wording "This is most propably due to". So actually include and code-clock directives are not confused with one another, but suffer from the same issue here.

Unfortunately there is no fix found for this since 8 years. The issue is from before I took over maintainership. Some time ago I invested a lot of hours with no solution at the end.

Closing in favor of the linked issue.