Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sphinx-build exit code is 0 with ERRORS #10397

Open
g-chauvel opened this issue Apr 28, 2022 · 5 comments
Open

sphinx-build exit code is 0 with ERRORS #10397

g-chauvel opened this issue Apr 28, 2022 · 5 comments

Comments

@g-chauvel
Copy link

Describe the bug

malformed table errors are reported as ERROR when running sphinx-build

source\a\a.rst:14: ERROR: Error parsing content block for the "list-table" directive: uniform two-level bullet list expected, but row 3 does not contain the same number of items as row 1 (4 vs 5).
source\a\a.rst:35: ERROR: "list-table" widths do not match the number of columns in table (5).
source\a\a.rst:51: ERROR: "list-table" widths do not match the number of columns in table (5).

but the exit code is 0

How to Reproduce

$ git clone https://github.com/g-chauvel/sphinx-doc
$ cd sphinx-doc
$ sphinx-build source build

Expected behavior

exit code is different from 0

Your project

https://github.com/g-chauvel/sphinx-doc

Screenshots

No response

OS

Windows 10

Python version

3.9.12

Sphinx version

4.5.0

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@tk0miya
Copy link
Member

tk0miya commented Apr 30, 2022

Could you try -W option, please?

@g-chauvel
Copy link
Author

I had.
Warning, treated as error: , it stops on first one

@tk0miya
Copy link
Member

tk0miya commented Apr 30, 2022

If you'd like to see the all of warnings (like CI), please use -W --keep-going. Then you'll see all warnings and errors, and will get the non-zero return code.

@revati-naik
Copy link

I had a question on this one, what if there are a few WARNINGS which should not be treated as errors, in that case, how do we differentiate?

@g-chauvel g-chauvel changed the title sphinx-build exit code should be 0 with ERRORS sphinx-build exit code is 0 with ERRORS Jul 29, 2023
@aeisenbarth
Copy link

I had a question on this one, what if there are a few WARNINGS which should not be treated as errors, in that case, how do we differentiate?

This is a very good question! We also have too many warnings that are irrelevant, that we cannot control (#11325) or that are false positives.
I was assuming I could skip reporting non-error-level warnings with -Q (--silent) and raise those of level ERROR with -W (--fail-on-warning). Apparently, this does not work (and it would not be good design). It would be good to have an option like --fail-on-warning-level=ERROR for which severity level should cause a failure, or an intuitive regular expression filter for which exact warnings should fail.

In the end, I found for myst_nb implements an extra nb_execution_raise_on_error. They must have had a reason (executablebooks/MyST-NB#248) to build this despite Sphinx's mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants