Skip to content
Permalink
Browse files

Closes #4614: sphinx-build: Add :option:`--keep-going` option to show…

… all warnings
  • Loading branch information
tk0miya committed Jul 19, 2018
1 parent 5c6bb42 commit e3483e9b045584380563d8783ab13bc620af5f27
Showing with 21 additions and 4 deletions.
  1. +1 −0 CHANGES
  2. +7 −0 doc/man/sphinx-build.rst
  3. +10 −3 sphinx/application.py
  4. +3 −1 sphinx/cmd/build.py
@@ -162,6 +162,7 @@ Features added
if :confval:`latex_engine` is ``'xelatex'`` or ``'lualatex'``.
* #4976: ``SphinxLoggerAdapter.info()`` now supports ``location`` parameter
* #5122: setuptools: support nitpicky option
* #4614: sphinx-build: Add ``--keep-going`` option to show all warnings

Bugs fixed
----------
@@ -229,6 +229,13 @@ Options
Turn warnings into errors. This means that the build stops at the first
warning and ``sphinx-build`` exits with exit status 1.

.. option:: --keep-going

With -W option, keep going processing when getting warnings to the end
of build, and ``sphinx-build`` exits with exit status 1.

.. versionadded:: 1.8

.. option:: -T

Display the full traceback when an unhandled exception occurs. Otherwise,
@@ -128,8 +128,8 @@ class Sphinx(object):
def __init__(self, srcdir, confdir, outdir, doctreedir, buildername,
confoverrides=None, status=sys.stdout, warning=sys.stderr,
freshenv=False, warningiserror=False, tags=None, verbosity=0,
parallel=0):
# type: (unicode, unicode, unicode, unicode, unicode, Dict, IO, IO, bool, bool, List[unicode], int, int) -> None # NOQA
parallel=0, keep_going=False):
# type: (unicode, unicode, unicode, unicode, unicode, Dict, IO, IO, bool, bool, List[unicode], int, int, bool) -> None # NOQA
self.phase = BuildPhase.INITIALIZATION
self.verbosity = verbosity
self.extensions = {} # type: Dict[unicode, Extension]
@@ -172,7 +172,11 @@ def __init__(self, srcdir, confdir, outdir, doctreedir, buildername,
else:
self._warning = warning
self._warncount = 0
self.warningiserror = warningiserror
self.keep_going = warningiserror and keep_going
if self.keep_going:
self.warningiserror = False
else:
self.warningiserror = warningiserror
logging.setup(self, self._status, self._warning)

self.events = EventManager()
@@ -334,6 +338,9 @@ def build(self, force_all=False, filenames=None):
self.builder.compile_update_catalogs()
self.builder.build_update()

if self._warncount and self.keep_going:
self.statuscode = 1

status = (self.statuscode == 0 and
__('succeeded') or __('finished with problems'))
if self._warncount:
@@ -189,6 +189,8 @@ def get_parser():
help=__('write warnings (and errors) to given file'))
group.add_argument('-W', action='store_true', dest='warningiserror',
help=__('turn warnings into errors'))
group.add_argument('--keep-going', action='store_true', dest='keep_going',
help=__("With -W, Keep going when getting warnings"))
group.add_argument('-T', action='store_true', dest='traceback',
help=__('show full traceback on exception'))
group.add_argument('-P', action='store_true', dest='pdb',
@@ -298,7 +300,7 @@ def build_main(argv=sys.argv[1:]): # type: ignore
app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
args.doctreedir, args.builder, confoverrides, status,
warning, args.freshenv, args.warningiserror,
args.tags, args.verbosity, args.jobs)
args.tags, args.verbosity, args.jobs, args.keep_going)
app.build(args.force_all, filenames)
return app.statuscode
except (Exception, KeyboardInterrupt) as exc:

0 comments on commit e3483e9

Please sign in to comment.
You can’t perform that action at this time.