From 2a84578a21a7d4e68f03260b87d601d1df82d804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Corr=C3=AAa=20da=20Silva=20Sanches?= Date: Tue, 24 Oct 2023 16:47:15 +0100 Subject: [PATCH] Fix check/metadata/consistent_repo_urls Git URLs can contain dashes and also there may be multiple URLs in a single description file. com.google.fonts/check/metadata/consistent_repo_urls On the Google Fonts Profile (issue #4316) --- CHANGELOG.md | 4 ++++ Lib/fontbakery/profiles/googlefonts.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58d763f869..9bfd61c7df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ A more detailed list of changes is available in the corresponding milestones for #### Added to the Google Fonts Profile - **EXPERIMENTAL - [com.google.fonts/check/glyphsets/shape_languages]:** This check uses a heuristic to determine which GF glyphsets a font supports. Then it checks the font for correct shaping behaviour for all languages in those glyphsets. (issue #4147) +### Changes to existing checks +#### On the Google Fonts Profile + - **[com.google.fonts/check/metadata/consistent_repo_urls]:** Git URLs can contain dashes and also there may be multiple URLs in a single description file. (issue #4316) + ## 0.10.2 (2023-Oct-20) ### New checks diff --git a/Lib/fontbakery/profiles/googlefonts.py b/Lib/fontbakery/profiles/googlefonts.py index 97c654933c..0c0a6cf5d7 100644 --- a/Lib/fontbakery/profiles/googlefonts.py +++ b/Lib/fontbakery/profiles/googlefonts.py @@ -3350,7 +3350,7 @@ def com_google_fonts_check_metadata_consistent_repo_urls( import re - A_GITHUB_URL = r"github.com/\w+/\w+" + A_GITHUB_URL = r"github.com/[\w-]+/[\w-]+" def clean_url(url): if ")" in url: @@ -3384,7 +3384,7 @@ def clean_url(url): if a_url and description: headless = re.sub(r"^https?://", "", a_url) - for match in re.findall(A_GITHUB_URL, description): + for match in set(re.findall(A_GITHUB_URL, description)): if clean_url(match) != headless: bad_urls.append(("HTML description", match))