Skip to content

Commit

Permalink
Add expected location to resolve warning (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-hilden committed Apr 11, 2022
1 parent 84e83ed commit 2c0e1d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ These release notes are based on
sphinx-codeautolink adheres to
`Semantic Versioning <https://semver.org>`_.

Unreleased
----------
- Include the expected location of a type in
:confval:`codeautolink_warn_on_failed_resolve` for debugging (:issue:`106`)

0.10.0 (2022-01-25)
-------------------
- Don't try to link empty name between two subsequent calls (:issue:`96`)
Expand Down
7 changes: 6 additions & 1 deletion src/sphinx_codeautolink/extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,13 @@ def filter_and_resolve(
key = resolve_location(name, self.inventory)
except CouldNotResolve:
if self.warn_failed_resolve:
path = '.'.join(name.import_components).replace('.()', '()')
msg = (
f'Could not resolve {self._resolve_msg(name)}'
f' using path `{path}`'
)
logger.warning(
f'Could not resolve {self._resolve_msg(name)}',
msg,
type=warn_type,
subtype='failed_resolve',
location=(doc, transform.doc_lineno),
Expand Down

0 comments on commit 2c0e1d0

Please sign in to comment.