Browse Source

Explicitly ignore legacy file reference errors in sphinx -n mode

pull/6867/head
Josh 4 years ago
committed by GitHub
parent
commit
7ebfface22
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      docs/conf.py
  2. 22
      docs/extensions/nitpick_file_ignorer.py

8
docs/conf.py

@ -40,6 +40,7 @@ extensions = [
'exception_hierarchy',
'attributetable',
'resourcelinks',
'nitpick_file_ignorer',
]
autodoc_member_order = 'bysource'
@ -140,6 +141,13 @@ pygments_style = 'friendly'
#keep_warnings = False
# Nitpicky mode options
nitpick_ignore_files = [
"migrating_to_async",
"migrating",
"whats_new",
]
# -- Options for HTML output ----------------------------------------------
html_experimental_html5_writer = True

22
docs/extensions/nitpick_file_ignorer.py

@ -0,0 +1,22 @@
import logging
from sphinx.application import Sphinx
from sphinx.util import logging as sphinx_logging
class NitpickFileIgnorer(logging.Filter):
def __init__(self, app: Sphinx) -> None:
self.app = app
super().__init__()
def filter(self, record: sphinx_logging.SphinxLogRecord) -> bool:
if getattr(record, 'type', None) == 'ref':
return record.location.get('refdoc') not in self.app.config.nitpick_ignore_files
return True
def setup(app: Sphinx):
app.add_config_value('nitpick_ignore_files', [], '')
f = NitpickFileIgnorer(app)
sphinx_logging.getLogger('sphinx.transforms.post_transforms').logger.addFilter(f)
Loading…
Cancel
Save