jayvdb added a comment.

In https://phabricator.wikimedia.org/T112488#1636064, @Legoktm wrote:

> Do you have an example of a failing change I can test with?


Every changeset currently has 'ERROR: ' in the doc job log.  e.g.
https://integration.wikimedia.org/ci/job/tox-doc-trusty/2667/console

Here is a changeset where all 'ERROR's are fixed:
https://gerrit.wikimedia.org/r/#/c/238039/
https://integration.wikimedia.org/ci/job/tox-doc-trusty/2664/console

I've dug into the Sphinx code, and as far as I can see we have four options:

- also fix every warning, and then enable Sphinx `-W`
- post process the Sphinx stderr for the word 'ERROR':
- Invoking docutils
- Control the behaviour of docutils within Sphinx using `docutils.conf`

The problem is that most of our errors are inside docutils, and while they use 
the word 'ERROR: ' they are treated as a warning inside Sphinx, and the only 
way to get an error code is to enable `-W`, but that means all warnings need to 
be fixed.
See https://github.com/sphinx-doc/sphinx/blob/master/sphinx/application.py#L325

Fixing all warnings is not simple, as those __mro__ warnings means solving the 
problems of T74424: ModuleDeprecationWrapper breaks code inspection tools, 
including epydoc, sphinx autodoc <https://phabricator.wikimedia.org/T74424>.

Invoking docutils with `--halt:error` does result in an exitcode.

  $ /usr/local/bin/rst2html5.py --halt=error pywikibot/__init__.py 
_docutils-out/init.html
  pywikibot/__init__.py:34: (ERROR/3) Unexpected indentation.
  Exiting due to level-3 (ERROR) system message.
  $ echo $?
  1

Running docutils directly isn't a simple option, as we would need to convert 
epytext to rst before invoking docutils, but it is do-able.

However, we can add a `docutils.conf`, which can include the following:

  [general]
  halt_level: error


TASK DETAIL
  https://phabricator.wikimedia.org/T112488

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: jayvdb
Cc: Legoktm, Aklapper, pywikibot-bugs-list, jayvdb, Spage



_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to