Commits

Georg Brandl  committed 3af29d9

#537: Added :confval:`nitpick_ignore`.

  • Participants
  • Parent commits b40174c

Comments (0)

Files changed (4)

 
 * #590: Added ``caption`` option to graphviz directives.
 
+* #537: Added :confval:`nitpick_ignore`.
+
 * C++ domain now supports array definitions.
 
 

File doc/config.rst

 
    .. versionadded:: 1.0
 
+.. confval:: nitpick_ignore
+
+   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')``.
+
+   .. versionadded:: 1.1
+
 
 Project information
 -------------------

File sphinx/config.py

         primary_domain = ('py', 'env'),
         needs_sphinx = (None, None),
         nitpicky = (False, 'env'),
+        nitpick_ignore = ([], 'env'),
 
         # HTML options
         html_theme = ('default', 'html'),

File sphinx/environment.py

 
 # This is increased every time an environment attribute is added
 # or changed to properly invalidate pickle files.
-ENV_VERSION = 40
+ENV_VERSION = 41
 
 
 default_substitutions = set([
         # 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.
 
     def _warn_missing_reference(self, fromdoc, typ, target, node, domain):
         warn = node.get('refwarn')
         if self.config.nitpicky:
-            warn = True  # XXX process exceptions here
+            warn = True
+            if self._nitpick_ignore:
+                dtype = domain and '%s:%s' % (domain.name, typ) or typ
+                if (dtype, target) in self._nitpick_ignore:
+                    warn = False
         if not warn:
             return
         refdoc = node.get('refdoc', fromdoc)