From c37a81857db67d9b2d8c27058d3b05a18b40f944 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Mon, 19 Feb 2024 15:53:26 +0000 Subject: [PATCH] Flag all 400 errors --- .github/workflows/knowledge_graph.py | 48 ++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/.github/workflows/knowledge_graph.py b/.github/workflows/knowledge_graph.py index 569fa62798..ee5899617d 100644 --- a/.github/workflows/knowledge_graph.py +++ b/.github/workflows/knowledge_graph.py @@ -190,21 +190,51 @@ def _check_md_file_contents(repo_root: Path, md_file: Path, ast: List[MdValue]) @lru_cache() def _check_outbound_link(url: str): - # Following urls work correctly on a web browser but 404 when using python requests - whitelist = frozenset(["https://www.jessicahische.is/talkingtype"]) + # Following urls work correctly on a web browser but raise a 400 code when using python requests + whitelist = frozenset([ + "https://www.jessicahische.is/talkingtype", + "http://www.layoutgridcalculator.com/typographic-scale/", + "https://www.figma.com/community/plugin/1088610476491668236/Material-Symbols", + "https://www.researchgate.net/publication/274013793_Legibility_in_Industrial_AR_Text_Style_Color_Coding_and_Illuminance", + "https://www.researchgate.net/figure/Biblia-latina-The-42-Line-Bible-Mainz-Johannes-Gutenberg-for-Johann-Fust-ca_fig3_317915502", + "https://www.nytimes.com/2003/10/21/business/the-media-business-a-face-lift-for-the-times-typographically-that-is.html", + "https://www.circuitousroot.com/artifice/letters/pantocut/benton/vertical/index.html", + "https://www.circuitousroot.com/artifice/letters/press/typemaking/after-casting/mortising/rouse/inst-and-print/index.html", + "https://www.paulshawletterdesign.com/2011/11/tutorial-no-6%E2%80%94tight-but-not-touching-kerning/", + "https://codepen.io/mandymichael/pen/pxXNbr", + "https://typetura.com", + "https://gigapress.net/reduce-http-requests/", + "https://help.figma.com/hc/en-us/articles/5579502031511-Use-variable-fonts#Replace_static_fonts", + "https://twitter.com/romanshamin_en/status/1562801657691672576", + "https://www.sciencedirect.com/science/article/pii/S0042698907005561", + "https://doi.org/10.1002/rrq.411", + "https://www.webmd.com/healthy-aging/news/20140318/color-vision-tends-to-fade-with-age-study#1", + "https://support.google.com/accessibility/android/answer/12159181?hl=en", + "http://www.languagegeek.com/typography/syllabics/syllabic_variation.pdf", + "https://www.freepik.com/free-photos-vectors/travel", + "https://psycnet.apa.org/record/2018-13691-001", + "https://www.cortezlawfirmpllc.com/wp-content/uploads/sites/1600711/2020/05/glare_congressional_report.pdf", + "http://kupferschrift.de/cms/2012/03/on-classifications/", + "https://medium.engineering/typography-is-impossible-5872b0c7f891", + "https://medium.com/microsoft-design/leading-trim-the-future-of-digital-typesetting-d082d84b202", + "https://medium.com/eightshapes-llc/space-in-design-systems-188bcbae0d62#:~:text=Solve%20Collisions%20like%20Line%20Height%20Systematically", + "https://nedwin.medium.com/the-1-5m-napkin-abd2702927d0", + "https://www.colourblindawareness.org/colour-blindness/types-of-colour-blindness/", + "https://medium.com/the-readability-group/whats-in-a-word-53bcf217d5c1", + "https://medium.com/the-readability-group/a-guide-to-understanding-what-makes-a-typeface-accessible-and-how-to-make-informed-decisions-9e5c0b9040a0", + "https://medium.com/@mcpflug/whats-in-a-name-the-perception-of-pro-7fffa6cddcb8", + "https://medium.com/@tilougarou/the-typographic-scale-reworked-a1b441b2beb2", + ]) # Following urls will be fixed at a later date. If the CI is failing and a suitable # replacement url cannot be found, please add them to this set. to_fix = frozenset() if url in whitelist | to_fix: return True - response = requests.get(url, allow_redirects=True) - if response.status_code == 404: - print(f"INVALID url '{url}' returned response status code '{response.status_code}'") - return False - elif response.status_code == 495: - print(f"INVALID SSL '{url}'") - return True + response = requests.head(url, allow_redirects=True) + if not response.ok: + print(f"INVALID url {url}' returned response status code '{response.status_code}'") + return response.ok def _check_md_files(knowledge: KnowledgeContent) -> bool: -- 2.47.2