sphinx-doc/sphinx

Make it possible to turn *some* warnings into errors

Open

#7,949 建立於 2020年7月13日

在 GitHub 查看
 (1 留言) (5 反應) (0 負責人)Python (1,985 fork)batch import
help wantedinternals:configtype:enhancement

倉庫指標

Star
 (5,625 star)
PR 合併指標
 (平均合併 10天 11小時) (30 天內合併 11 個 PR)

描述

We have a non-trivial doc build where legitimate warnings can be emitted for various reasons, especially on a developer's machine where some software components may be disabled and autodoc will therefore fail emitting for them. However, some other warnings point to errors in the written documentation itself, and would ideally fail a doc build. I'm thinking especially of reST parsing errors.

Ideally there would be a way in the Sphinx configuration file to define some warning categories that will be turned into errors, and ultimately fail the doc build. This would prevent developers from checking in regression in the docs.

We could instead use suppress_warnings on the non-critical issues, and then use -W to turn the remaining warnings into errors. But I don't want to silence those non-critical warnings, it is still useful to have them emitted on a developer's machine.

So a new configuration key such as:

warnings_as_errors = [ ... ]

would certainly work for us (assuming that all standard warnings get a well-defined category, e.g. reST parsing errors).

貢獻者指南