Skip to content
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

extlink: Add support for suppressing 'hardcoded link' warnings #10123

Closed
wants to merge 1 commit into from
Closed

extlink: Add support for suppressing 'hardcoded link' warnings #10123

wants to merge 1 commit into from

Conversation

progval
Copy link
Contributor

@progval progval commented Jan 20, 2022

Subject: Add support for suppressing 'hardcoded link' warnings

Feature or Bugfix

  • Bugfix

Purpose

These warnings were added in v4.4.0, but some projects may prefer to hide them,
eg. if hardcoded links appear in docstrings.

Relates

  • PR 9800, which introduced these warnings

They were added in v4.4.0, but some projects may prefer to hide them,
eg. if hardcoded links appear in docstrings.
@@ -76,7 +76,8 @@ def check_uri(self, refnode: nodes.reference) -> None:
msg = __('hardcoded link %r could be replaced by an extlink '
'(try using %r instead)')
replacement = f":{alias}:`{match.groupdict().get('value')}`"
logger.warning(msg, uri, replacement, location=refnode)
logger.warning(msg, uri, replacement, location=refnode,
type="extlink", subtype="hardcoded")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm no maintainer, just someone lurking around.)

I think you also need to update the list of warnings in the documentation of suppress_warnings here:

https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-suppress_warnings

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I'm blind. Sorry.

@tk0miya
Copy link
Member

tk0miya commented Jan 22, 2022

I think it's better to disable the detector instead of suppressing warnings. So I'll adopt #10126 instead of this.
Thank you for your contribution.

@tk0miya tk0miya closed this Jan 22, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants