From 926e0e766d9c6f77b1cd30d7c7b8b96e632f54b1 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 8 Apr 2019 07:48:20 -0400 Subject: [PATCH] ENH: Explain warnings-as-errors --- sphinx/application.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sphinx/application.py b/sphinx/application.py index 8590aa4d2..96dd3f936 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -348,9 +348,16 @@ class Sphinx: status = (self.statuscode == 0 and __('succeeded') or __('finished with problems')) if self._warncount: - logger.info(bold(__('build %s, %s warning.', - 'build %s, %s warnings.', self._warncount) % - (status, self._warncount))) + if self.warningiserror: + msg = __('build %s, %s warning (with warnings treated as errors).', + 'build %s, %s warnings (with warnings treated as errors).', + self._warncount) + else: + msg = __('build %s, %s warning.', + 'build %s, %s warnings.', + self._warncount) + + logger.info(bold(msg % (status, self._warncount))) else: logger.info(bold(__('build %s.') % status))