-
-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stylecheck: flag doc references to nonexisting objects #1182
Comments
Hi @dominikh, if this was implemented, presumably it would be reasonable to also flag if a URL link in the comment does not have a corresponding link URL definition at the bottom? (In other words, no Go identifier or symbol involved, just a URL).
(And maybe that is intended to be covered already -- I am just trying to be explicit). |
@thepudds Can we differentiate unresolved references from text which just wants to be enclosed in brackets and doesn't denote a link? Linking to identifiers has a number of restrictions to avoid false positives on godoc's end which would also aid us. For URLs, no such restrictions exist. |
Hi @dominikh, that’s a fair question. (And I see that you are of course right that the proposal only has the additional false positive safeguards for linking to identifiers). Perhaps a more robust check might be to flag if a properly formatted and positioned link URL definition does not have a corresponding URL link in the comment. The proposal already reformats those into a different group separated by a blank line, but that only helps if you have at least two total. At least for me, flagging an accidentally out of sync link definition (due to a typo, a subsequent inconsistent edit, bad copy/paste, …) seems useful, so maybe one additional way to cut down on noise might be to only report if there is at least one piece of text in the comment enclosed in brackets that is not covered by some link definition at the bottom. Alternatively, it could just flag any unused link definition. |
I'll definitely explore these things when I write the check. Thanks for making me aware that URLs are also worth checking. |
golang/go#51082 proposes to add new markup for Go documentation. Part of that is explicit syntax for linking to identifiers. We could flag references that do not resolve.
Suggested by @seankhliao
The text was updated successfully, but these errors were encountered: