From 02a355136f5c31670add00e6f8c68b6717756b87 Mon Sep 17 00:00:00 2001 From: davd-gzl <60177543+davd-gzl@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:57:09 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F(ci)=20escape=20the=20down?= =?UTF-8?q?loaded=20gitmojis=20before=20the=20regex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rule joins the list it fetches into an alternation, so any regex character in a gitmoji entry would change what the pattern matches. re.escape treats each one as a literal, which is what the match was always meant to do. --- gitlint/gitlint_emoji.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlint/gitlint_emoji.py b/gitlint/gitlint_emoji.py index f8306b65..f98d4f1a 100644 --- a/gitlint/gitlint_emoji.py +++ b/gitlint/gitlint_emoji.py @@ -30,7 +30,7 @@ class GitmojiTitle(LineRule): """ with urllib.request.urlopen(GITMOJIS_URL, timeout=10) as response: gitmojis = json.load(response)["gitmojis"] - emojis = [item["emoji"] for item in gitmojis] + emojis = [re.escape(item["emoji"]) for item in gitmojis] pattern = r"^({:s})\(.*\)\s[a-z].*$".format("|".join(emojis)) if not re.search(pattern, title): violation_msg = 'Title does not match regex "() "'