Skip to content

Commit

Permalink
Explicitly ignore legacy file reference errors in sphinx -n mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bijij authored May 6, 2021
1 parent de965c2 commit 7ebffac
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'exception_hierarchy',
'attributetable',
'resourcelinks',
'nitpick_file_ignorer',
]

autodoc_member_order = 'bysource'
Expand Down Expand Up @@ -140,6 +141,13 @@
#keep_warnings = False


# Nitpicky mode options
nitpick_ignore_files = [
"migrating_to_async",
"migrating",
"whats_new",
]

# -- Options for HTML output ----------------------------------------------

html_experimental_html5_writer = True
Expand Down
22 changes: 22 additions & 0 deletions docs/extensions/nitpick_file_ignorer.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 7ebffac

Please sign in to comment.