Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Detect invalid role targets #28

Open
ezio-melotti opened this issue May 6, 2022 · 3 comments
Open

Detect invalid role targets #28

ezio-melotti opened this issue May 6, 2022 · 3 comments

Comments

@ezio-melotti
Copy link
Collaborator

Currently it's possible to refer to functions, methods, classes, etc. that don't exist, using :func:`not_existing_function()`. This is sometimes done intentionally, but other times the target is invalid because of a misspelling or because the package/module/class name is missing.

It might be helpful to detect and report these, perhaps with severity=0.

This came up in python/cpython#92309 (comment)

@JulienPalard
Copy link
Collaborator

TIL it's already handled by Sphinx but not enabled by default: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-nitpicky

Sadly on cpython it detects thousands of them, most are expected, like:

c:identifier reference target not found: va_list
c:func reference target not found: malloc
c:func reference target not found: free

Many removed things in old whatsnew, and so on...

I don't know if there's any value in using :c:func:`malloc` over ``malloc`` though.

@ezio-melotti
Copy link
Collaborator Author

If something is already reported by Sphinx as an error/warning, should sphinx-lint still check for it?
On one hand it would be useful since it will allow to catch mistakes early without having to build the docs, on the other hand it makes the implementation of sphinx-lint more complex.

I was wondering the same thing in #27 (comment), where several cases are already caught by Sphinx.

@JulienPalard
Copy link
Collaborator

There's a way to choose: as sphinx-lint could be used by an IDE to highlight errors, all errors are usefull but it have to be fast and it have to be able to work on a single file.

Detecting invalid targets is not fast and does not work on a single file, so I would be against implementing it in sphinx-lint, but other fast tests are OK (but not a priority) to me even if they duplicate errors already seen by Sphinx.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants