From ab32618002079d4ef58d10bcf14ef0ad8c76c8f8 Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Fri, 12 Nov 2021 20:11:28 +0100 Subject: [PATCH] apply suggestions from #9800 here as well Signed-off-by: oleg.hoefling --- sphinx/ext/intersphinx.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index d44c4d5488b..8d95a055056 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -87,7 +87,7 @@ class ExternalLinksChecker(SphinxPostTransform): We treat each ``reference`` node without ``internal`` attribute as an external link. """ - default_priority = 900 + default_priority = 100 def run(self, **kwargs: Any) -> None: for refnode in self.document.traverse(reference): @@ -102,8 +102,7 @@ def check_uri(self, refnode: reference) -> None: return uri = refnode['refuri'] - lineno = sphinx.util.nodes.get_node_line(refnode) - cache = getattr(self.app.env, 'intersphinx_cache', dict()) + cache = self.app.env.intersphinx_cache for inventory_uri, (inventory_name, size, inventory) in cache.items(): if uri.startswith(inventory_uri): @@ -111,16 +110,15 @@ def check_uri(self, refnode: reference) -> None: replacements = find_replacements(self.app, uri) try: suggestion = f'try using {next(replacements)!r} instead' - location = (self.env.docname, lineno) logger.warning( - ( + __( 'hardcoded link %r could be replaced by ' 'a cross-reference to %r inventory (%s)' ), uri, inventory_name, suggestion, - location=location, + location=refnode, ) except StopIteration: pass