From 4cd90a644a30e14ba4a9138f634f90b448c05cff Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 25 Jun 2018 08:03:05 +0200 Subject: [PATCH 1/3] BuildDoc: add and pass through nitpicky option This allows for using e.g. `tox -e docs -- -n` with Sphinx's own `build_sphinx` distutils command. --- sphinx/setup_command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py index c541792272..c3957fefcb 100644 --- a/sphinx/setup_command.py +++ b/sphinx/setup_command.py @@ -87,9 +87,10 @@ class BuildDoc(Command): ('link-index', 'i', 'Link index.html to the master doc'), ('copyright', None, 'The copyright string'), ('pdb', None, 'Start pdb on exception'), + ('nitpicky', 'n', 'nit-picky mode, warn about all missing references'), ] boolean_options = ['fresh-env', 'all-files', 'warning-is-error', - 'link-index'] + 'link-index', 'nitpicky'] def initialize_options(self): # type: () -> None @@ -107,6 +108,7 @@ class BuildDoc(Command): self.copyright = '' self.verbosity = 0 self.traceback = False + self.nitpicky = False def _guess_source_dir(self): # type: () -> unicode @@ -174,6 +176,8 @@ class BuildDoc(Command): confoverrides['today'] = self.today if self.copyright: confoverrides['copyright'] = self.copyright + if self.nitpicky: + confoverrides['nitpicky'] = self.nitpicky for builder, builder_target_dir in self.builder_target_dirs: app = None From c62aefd71f24dbf6b40f4f1624523b9b2eae4bf4 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 19 Jul 2018 01:18:39 +0900 Subject: [PATCH 2/3] Fix mypy violation --- sphinx/setup_command.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py index c3957fefcb..ca3256c192 100644 --- a/sphinx/setup_command.py +++ b/sphinx/setup_command.py @@ -28,7 +28,7 @@ from sphinx.util.osutil import abspath if False: # For type annotation - from typing import Any, List, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA class BuildDoc(Command): @@ -165,7 +165,7 @@ class BuildDoc(Command): status_stream = StringIO() else: status_stream = sys.stdout # type: ignore - confoverrides = {} + confoverrides = {} # type: Dict[unicode, Any] if self.project: confoverrides['project'] = self.project if self.version: From f72a53f5bd46bfb100e56a1a07fa177f459c2fd3 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 19 Jul 2018 01:22:20 +0900 Subject: [PATCH 3/3] Update docs for #5122 (nitpicky option) --- CHANGES | 1 + doc/setuptools.rst | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGES b/CHANGES index bad46f5f87..e57a0dad62 100644 --- a/CHANGES +++ b/CHANGES @@ -161,6 +161,7 @@ Features added * Add :confval:`latex_use_xindy` for UTF-8 savvy indexing, defaults to ``True`` if :confval:`latex_engine` is ``'xelatex'`` or ``'lualatex'``. * #4976: ``SphinxLoggerAdapter.info()`` now supports ``location`` parameter +* #5122: setuptools: support nitpicky option Bugs fixed ---------- diff --git a/doc/setuptools.rst b/doc/setuptools.rst index 10f7325598..10cc6a77d0 100644 --- a/doc/setuptools.rst +++ b/doc/setuptools.rst @@ -181,6 +181,14 @@ Options for setuptools integration .. versionadded:: 1.3 +.. confval:: nitpicky + + Run in nit-picky mode. Currently, this generates warnings for all missing + references. See the config value :confval:`nitpick_ignore` for a way to + exclude some references as "known missing". + + .. versionadded:: 1.8 + .. confval:: pdb A boolean to configure ``pdb`` on exception. Default is false.