From a0dbfa9357d7173122f3d70d6cdae8fc1a7f691d Mon Sep 17 00:00:00 2001 From: davd-gzl <60177543+davd-gzl@users.noreply.github.com> Date: Tue, 25 Aug 2026 18:48:09 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5(ci)=20drop=20the=20requests=20depe?= =?UTF-8?q?ndency=20from=20the=20gitmoji=20rule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rule downloaded the gitmoji list with requests, so lint-git had to install that package before the linter could run. urllib.request is in the standard library and answers the same call, leaving one fewer package fetched on the runner before the job's own command starts. --- gitlint/gitlint_emoji.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gitlint/gitlint_emoji.py b/gitlint/gitlint_emoji.py index fe3243da..f8306b65 100644 --- a/gitlint/gitlint_emoji.py +++ b/gitlint/gitlint_emoji.py @@ -3,14 +3,14 @@ Gitlint extra rule to validate that the message title is of the form "() " """ -from __future__ import unicode_literals - +import json import re - -import requests +import urllib.request from gitlint.rules import CommitMessageTitle, LineRule, RuleViolation +GITMOJIS_URL = "https://raw.githubusercontent.com/carloscuesta/gitmoji/master/packages/gitmojis/src/gitmojis.json" + class GitmojiTitle(LineRule): """ @@ -28,9 +28,8 @@ class GitmojiTitle(LineRule): Download the list possible gitmojis from the project's github repository and check that title contains one of them. """ - gitmojis = requests.get( - "https://raw.githubusercontent.com/carloscuesta/gitmoji/master/packages/gitmojis/src/gitmojis.json" - ).json()["gitmojis"] + with urllib.request.urlopen(GITMOJIS_URL, timeout=10) as response: + gitmojis = json.load(response)["gitmojis"] emojis = [item["emoji"] for item in gitmojis] pattern = r"^({:s})\(.*\)\s[a-z].*$".format("|".join(emojis)) if not re.search(pattern, title):