-
Notifications
You must be signed in to change notification settings - Fork 49
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 front page links and change check_links #318
Conversation
noursaidi
commented
Apr 29, 2022
•
edited
Loading
edited
- change check_links to work on hosted (GitHub pages or GitHub) links
- fix check_links so it works when there are two links on the same line
- change front page links to rendered version
bin/check_links
Outdated
# Rewrite hosted links (e.g. github pages) to local | ||
rewritten_link = blank_regex_substitutions(link, HOSTED_GITHUB, HOSTED_GITHUB_PAGES) | ||
|
||
if not re.match('https?://', rewritten_link): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: My personal preference is re.search and ^ in front of the regex because it's more clear, and also consistent with other re functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed all re.match
to re.search
and added ^
to start of regex
bin/check_links
Outdated
@@ -8,6 +8,8 @@ import glob | |||
import re | |||
import os | |||
|
|||
HOSTED_GITHUB_PAGES = r"https?:\/\/faucetsdn.github.io\/udmi\/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency I think it should be r'' ? (single quote)
I think both patterns should have a ^ in front and . for periods in the hostname?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made
@@ -60,12 +80,24 @@ def check_links(file_path): | |||
|
|||
if not os.path.exists(resolved_path): | |||
failing_links.append((file_path, 'link', link)) | |||
|
|||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add to the function docstring what we are accomplishing with this change. i.e. when do we need this to occur?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extended function docstring to describe new behaviour and added to incline comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you submit your changes?
@johnrandolph yes, there's a "changes from all commits" button on the files changed page which shows all changes, it seems to default to original commit for some reason. Let me know if I've missed something |