-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allow to bail out extlink replacement suggestion #10112
Comments
This affected me too on other project and what I find it quite problematic for two reasons:
The only workaround that I see now is to pin-down sphinx to |
I agree it's needed to control the check feature (#10113 is a related story). I'm not sure it's really needed to control the check by file or individual URL. So I'd like to add an option to enable/disable the checks for the whole of the project. |
I for one like this feature for all my sphinx only files, but then there's an index file used by pypi.org where a file-level exclude list would be helpful. The individual URL disable would be there to bypass bugs of detection without needing to turn off the feature entirely. |
IMO, this feature is not related to the OS. So I'm not sure why it does not work on macOS. How about call
Understandable. The PyPI's case is one of them. |
Please let me know what case do you want to disable the check? I can understand the PyPI's case. But another one is not yet. |
See my first post here #10112 (comment) with the github actions link being suggested as a user link. |
I'm actually fine with reverting #9800 completely. While issuing the warnings actually makes sense for every hardcoded link that can be replaced with extlinks = {
"user": ("https://github.com/%s", "@"),
"feature": ("https://github.com/%s", "feat"),
} and rewriting the link to |
Hence why I was proposing that the suggestion should only apply if there's no |
Cap the version `Sphinx` below 4.4.0 The latest version of sphinx was causing the following errors, and therefore is being capped to version prior to the version causing the errors. /home/docs/checkouts/readthedocs.org/user_builds/ansible-navigator/checkouts/774/docs/changelog.md:16: WARNING: hardcoded link 'https://github.com/twisted/towncrier' could be replaced by an extlink (try using ':gh:`twisted/towncrier`' instead) /home/docs/checkouts/readthedocs.org/user_builds/ansible-navigator/checkouts/774/docs/installation.md:3: WARNING: hardcoded link 'containers/podman#8016' could be replaced by an extlink (try using ':gh:`containers/podman/issues/8016`' instead) Detailed information about the changes introduced in sphinx causing the errors can be found here: Related: sphinx-doc/sphinx#10112 The following issue was created to revert this PR once the sphinx error is fixed or can be avoided: See #776 Reviewed-by: Bradley A. Thornton <bthornto@redhat.com> Reviewed-by: None <None> Reviewed-by: Sviatoslav Sydorenko <webknjaz+github/profile@redhat.com>
Cap the version `Sphinx` below 4.4.0 The latest version of sphinx was causing the following errors, and therefore is being capped to version prior to the version causing the errors. /home/docs/checkouts/readthedocs.org/user_builds/ansible-navigator/checkouts/774/docs/changelog.md:16: WARNING: hardcoded link 'https://github.com/twisted/towncrier' could be replaced by an extlink (try using ':gh:`twisted/towncrier`' instead) /home/docs/checkouts/readthedocs.org/user_builds/ansible-navigator/checkouts/774/docs/installation.md:3: WARNING: hardcoded link 'containers/podman#8016' could be replaced by an extlink (try using ':gh:`containers/podman/issues/8016`' instead) Detailed information about the changes introduced in sphinx causing the errors can be found here: Related: sphinx-doc/sphinx#10112 The following issue was created to revert this PR once the sphinx error is fixed or can be avoided: See ansible#776 Reviewed-by: Bradley A. Thornton <bthornto@redhat.com> Reviewed-by: None <None> Reviewed-by: Sviatoslav Sydorenko <webknjaz+github/profile@redhat.com>
Cap the version `Sphinx` below 4.4.0 The latest version of sphinx was causing the following errors, and therefore is being capped to version prior to the version causing the errors. /home/docs/checkouts/readthedocs.org/user_builds/ansible-navigator/checkouts/774/docs/changelog.md:16: WARNING: hardcoded link 'https://github.com/twisted/towncrier' could be replaced by an extlink (try using ':gh:`twisted/towncrier`' instead) /home/docs/checkouts/readthedocs.org/user_builds/ansible-navigator/checkouts/774/docs/installation.md:3: WARNING: hardcoded link 'containers/podman#8016' could be replaced by an extlink (try using ':gh:`containers/podman/issues/8016`' instead) Detailed information about the changes introduced in sphinx causing the errors can be found here: Related: sphinx-doc/sphinx#10112 The following issue was created to revert this PR once the sphinx error is fixed or can be avoided: See ansible#776 Reviewed-by: Bradley A. Thornton <bthornto@redhat.com> Reviewed-by: None <None> Reviewed-by: Sviatoslav Sydorenko <webknjaz+github/profile@redhat.com>
A recent change in Sphinx introduced a new warning about missed extlink opportunities: sphinx-doc/sphinx#10112 These warnings are causing spurious CI failures. Some of these suggestions are good but many of them are not, and there is not currently a way to disable the warning (globally or locally). So the only workable solution currently seems to be to pin an old version of Sphinx in CI for now. Hopefully there will be an option to disable this in 4.4.1, at which point we can unpin.
… default This disables hardcoded links detector by default. Instead, a new configuration `extlinks_detect_hardcoded_links` to enable it explicitly.
… default The hardcoded links detector added since 4.4.0 causes troubles in many projects. Therefore, this disables it by default, and adds a new configuration `extlinks_detect_hardcoded_links` to enable it explicitly.
I think extlinks can accept shortcuts contains |
Be that so, but I don't think your commit solves this issue. Adding a global disable flag is not what this issue is about. I purposefully formulated it to keep the feature but allow disabling it where the check makes invalid suggestions 🤔 |
Indeed. My PR and your trouble are different topics. So the title of the PR is not good. |
I'd also like to keep the possibility of using |
I don't think github is special here -- the same could be said for any other vcs, or really any other popular website. I do think that the heuristic of "contains a slash" is a pretty good approximation for disabling the warning (that would solve 99% of the false positive warnings) |
Here is a workaround. Add the following lines to conf.py to suppress the warnings: from sphinx.util import logging
linklogger = logging.getLogger('sphinx.ext.extlinks')
linklogger.setLevel(40) # Ignore messages less severe than ERROR |
Are you saying all case of extlink usage does not contain a slash or it's a special case? If so, we should mention the restrictions on the document of extlink. But I'm not sure the rule is a standard rule... |
no, you're not understanding me or gaborbernat we are merely suggesting that the WARNING should not fire if the replacement contains a slash that would eliminate the frustration with the new warning which has a very high false positive rate in its current implementation we are not talking about disallowing slashes in extlinks or changing how extlinks work at all -- merely the warning #10137 implements that and contains a test demonstrating this behaviour |
Really? The recommendation logic you proposed will never warn for references containing a slash. It means it does not consider URLs containing a slash are not candidates of extlink, right?
I understand the current implementation is very noisy for some people. So I thought disable it by default via #10126, and improve the logic in the next step. If you're proposing #10137 as a workaround, I can understand. But the current implementation causes other troubles. So I'd like to disable it by default. |
again, I'm not proposing to change how extlinks works -- just eliminating the warning in a common case extlinks would still support slashes in replacements -- but from some searching on sourcegraph this feature seems to be scarcely or never used (I could not find an example in any projects from my search -- though I only scrolled through projects 5k stars and above) the search I used:
so my proposal would leave the warning on (since I think the warning is useful -- it certainly helped me find a mistake in flake8) but it would eliminate a high false positive case that's almost always not intended to use extlinks |
I like the proposal from @gaborbernat and @asottile as this would silence most of the false positives for me too. But I still have an issue which would be better solved by a file exclusion list. In the config.py I have With the proposal the compare links would be silent, but the release link would still fire a warning. I do not want to replace any link in the changelog, because it should also be usable outside of the docs context. |
Just want to make a note that these warnings are unavoidable when mixing RST (documentation) and MarkDown (release notes) in a project.
The markdown release notes generate this warning on extlink replacement:
This is a shame as I enjoyed being able to cut and paste markdown out of issue tracker. |
We have the same issue while pulling in As the included |
The warning is overaggressive: sphinx-doc/sphinx#10112 and RST does not support nesting of directives/prefixes so we cannot use both :bdg-link-primary: and :nwb_extension_git:
Maybe I am missing something but seeing that no1 regression I observed as being introduced by Sphinx 4.4.0, not only as not being fixed in 4.4.1 or 4.5.0, but postponed for 5.0.0. That is something that will make people stick with older and older sphinx and avoid upgrading it. |
I'm no longer seeing the warning in Sphinx 4.5.0, and there is a mention of a change in the 4.5.0 changelog. So that part appears to have been resolved. I assume the issue remains open to track more complex future configuration support. |
Feature added via #9800. Consider the following ext link:
and the following text:
Can we somehow bailout out the check here, or perhaps the suggestion should only apply if there's no
/
in the extlink, @tk0miya what do you think? cc @hoeflingThe text was updated successfully, but these errors were encountered: