diff --git a/CHANGES b/CHANGES index 4379871aa..03d3425ed 100644 --- a/CHANGES +++ b/CHANGES @@ -79,6 +79,9 @@ Bugs fixed * #1017: Be helpful and tell the user when the argument to :rst:dir:`option` does not match the required format. +* #1345: Fix two bugs with :confval:`nitpick_ignore`; now you don't have to + remove the store environment for changes to have effect. + Documentation ------------- diff --git a/doc/config.rst b/doc/config.rst index ac6d506b2..5776dbb69 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -236,7 +236,8 @@ General configuration A list of ``(type, target)`` tuples (by default empty) that should be ignored when generating warnings in "nitpicky mode". Note that ``type`` should - include the domain name. An example entry would be ``('py:func', 'int')``. + include the domain name if present. Example entries would be ``('py:func', + 'int')`` or ``('envvar', 'LD_LIBRARY_PATH')``. .. versionadded:: 1.1 diff --git a/doc/invocation.rst b/doc/invocation.rst index c6125ecc5..107a50aa2 100644 --- a/doc/invocation.rst +++ b/doc/invocation.rst @@ -140,7 +140,8 @@ The :program:`sphinx-build` script has several options: .. option:: -n Run in nit-picky mode. Currently, this generates warnings for all missing - references. + references. See the config value :confval:`nitpick_ignore` for a way to + exclude some references as "known missing". .. option:: -N diff --git a/sphinx/config.py b/sphinx/config.py index 4cca4b357..8b15bdf3b 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -72,7 +72,7 @@ class Config(object): primary_domain = ('py', 'env'), needs_sphinx = (None, None), nitpicky = (False, 'env'), - nitpick_ignore = ([], 'env'), + nitpick_ignore = ([], 'html'), # HTML options html_theme = ('default', 'html'), diff --git a/sphinx/environment.py b/sphinx/environment.py index 919ae7102..a319ef3c1 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -177,9 +177,6 @@ class BuildEnvironment: # this is to invalidate old pickles self.version = ENV_VERSION - # make this a set for faster testing - self._nitpick_ignore = set(self.config.nitpick_ignore) - # All "docnames" here are /-separated and relative and exclude # the source suffix. @@ -440,6 +437,9 @@ class BuildEnvironment: self.find_files(config) self.config = config + # this cache also needs to be updated every time + self._nitpick_ignore = set(self.config.nitpick_ignore) + added, changed, removed = self.get_outdated_files(config_changed) # allow user intervention as well @@ -1385,6 +1385,9 @@ class BuildEnvironment: dtype = domain and '%s:%s' % (domain.name, typ) or typ if (dtype, target) in self._nitpick_ignore: warn = False + # for "std" types also try without domain name + if domain.name == 'std' and (typ, target) in self._nitpick_ignore: + warn = False if not warn: return if domain and typ in domain.dangling_warnings: