Page MenuHomePhabricator

jenkins doc generation rule should vote against changes which create sphinx errors
Closed, ResolvedPublic

Description

To prevent new doc problems appearing, a jenkins rule needs to ensure no errors occur doing generation

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb subscribed.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript

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

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.

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

Change 238420 had a related patch set uploaded (by John Vandenberg):
Fail on docutils errors inside Sphinx

https://gerrit.wikimedia.org/r/238420

Change 238420 merged by jenkins-bot:
Fail on docutils errors inside Sphinx

https://gerrit.wikimedia.org/r/238420

jayvdb removed a project: Patch-For-Review.
jayvdb set Security to None.
Dalba claimed this task.
Dalba subscribed.

The upstream issue is closed and we have a patch merged for it. I'm going to close this issue as well as it seem we are not facing this issue anymore.