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

Fix hyperlinks and define redirects & anchors to avoid checking #1267

Merged
merged 24 commits into from
Sep 27, 2021

Conversation

namurphy
Copy link
Member

To get ready for a time when we can have make linkcheck be part of our test suite (#1266), this PR fixes hyperlinks, defines allowable redirects (like for doi.org, to latest or stable or `v3.9.3 versions of docs, and login pages for GitHub and Google), and specifies anchors to avoid checking (like for specific lines in a page showing source code or for our Matrix room).

This should be a fairly quick review, so if it looks good to you, feel free to merge it so it can go in 0.7.0.

@namurphy namurphy added docs PlasmaPy Docs at http://docs.plasmapy.org status: ready for review PRs that are ready for code review testing labels Sep 18, 2021
@namurphy namurphy added this to the 0.7.0 milestone Sep 18, 2021
@github-actions github-actions bot added plasmapy.formulary Related to the plasmapy.formulary subpackage Mathematics labels Sep 18, 2021
@@ -91,7 +91,7 @@ Features
- For `plasmapy.plasma.grids` functionality, improve interpolation performance on
non-uniform grids. (`#963 <https://github.com/plasmapy/plasmapy/pull/963>`__)
- Added the `~plasmapy.formulary.drifts.diamagnetic_drift` function to
`~plasmapy.formulary.drifts`. (`#966 <https://github.com/plasmapy/plasmapy/pull/966>`__)
`~plasmapy.formulary.drifts`. (`#972 <https://github.com/plasmapy/plasmapy/pull/972>`__)
Copy link
Member Author

Choose a reason for hiding this comment

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

It turns out that #966 was the issue being addressed, and #972 was the pull request that addressed it.

@codecov
Copy link

codecov bot commented Sep 18, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@bcfa2c2). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1267   +/-   ##
=======================================
  Coverage        ?   97.06%           
=======================================
  Files           ?       73           
  Lines           ?     7093           
  Branches        ?        0           
=======================================
  Hits            ?     6885           
  Misses          ?      208           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcfa2c2...4683e03. Read the comment docs.

docs/conf.py Outdated
Comment on lines 160 to 164
linkcheck_allowed_redirects = {
r"https://.+\.(org|io|com)": r".+(org|io|com)/en/.+", # to different doc branches
r"https://doi\.org/.+": r"https://.+", # DOI links are more persistent
r"https://.+": r".+(google|github).+[lL]ogin.+", # some links require logins
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Since I didn't know this beforehand, .+ is effectively a wildcard marker, (...|...) is either/or, and [ ] means matching any one of these characters.

Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

PDD label much? :D

One quick question, otherwise LGTM!

docs/conf.py Outdated
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

default_role = "obj"

# Customizations for make linkcheck using regular expressions
linkcheck_allowed_redirects = {
r"https://.+\.(org|io|com)": r".+(org|io|com)/en/.+", # to different doc branches
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this allow redirects to any website on the top level .org, .io or .com domains, rather than just different doc branches?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I had been wondering how to handle this. I couldn't find a way in the linkcheck configuration options to specify that the domain name be the same between the link and the redirect without giving every domain name. My thinking has been that with the /en/ in the second part, chances are the redirect is going to be for a docs page or otherwise somehow related to internationalization. I'll make this a bit more specific...we'll catch more things links that need to be updated, with the caveat that we'll need to add some special cases in there.

@namurphy
Copy link
Member Author

PDD label much? :D

Me? No, never! 😶

@namurphy namurphy enabled auto-merge (squash) September 27, 2021 19:42
@namurphy namurphy merged commit 55034bc into PlasmaPy:main Sep 27, 2021
Tlord18 pushed a commit to Tlord18/PlasmaPy that referenced this pull request Oct 6, 2021
…maPy#1267)

* Fix broken links in braginskii.py

* Update redirects & anchors to ignore in make linkcheck

* Update hyperlinks in testing_guide.rst

* Update hyperlinks in vision_statement.rst

* Update hyperlinks in mathematics.py

* Update hyperlinks in install.rst

* Update hyperlinks in install_dev.rst

* Update hyperlinks in particles/index.rst

* Update hyperlinks in docs.rst

* Update hyperlinks in CONTRIBUTING.rst

* Update hyperlinks in collisions.py

* Update hyperlinks in code of conduct

* Update hyperlinks in code guide

* Add chat room to common links

* Fix pull request number

Before this, the change log linked to the issue being addressed rather
than the pull request.

* Add changelog entries

* Use past tense

* Minor updates to links

* Minor updates to common links

* Be more specific about allowed redirects

* Minor updates to links

* Point out make linkcheck in doc guide
Tlord18 pushed a commit to Tlord18/PlasmaPy that referenced this pull request Oct 6, 2021
…maPy#1267)

* Fix broken links in braginskii.py

* Update redirects & anchors to ignore in make linkcheck

* Update hyperlinks in testing_guide.rst

* Update hyperlinks in vision_statement.rst

* Update hyperlinks in mathematics.py

* Update hyperlinks in install.rst

* Update hyperlinks in install_dev.rst

* Update hyperlinks in particles/index.rst

* Update hyperlinks in docs.rst

* Update hyperlinks in CONTRIBUTING.rst

* Update hyperlinks in collisions.py

* Update hyperlinks in code of conduct

* Update hyperlinks in code guide

* Add chat room to common links

* Fix pull request number

Before this, the change log linked to the issue being addressed rather
than the pull request.

* Add changelog entries

* Use past tense

* Minor updates to links

* Minor updates to common links

* Be more specific about allowed redirects

* Minor updates to links

* Point out make linkcheck in doc guide
@namurphy namurphy deleted the linkcheck2 branch March 16, 2022 15:47
@namurphy namurphy removed the status: ready for review PRs that are ready for code review label Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs PlasmaPy Docs at http://docs.plasmapy.org plasmapy.formulary Related to the plasmapy.formulary subpackage testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants