Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

🔥(ci) drop the requests dependency from the gitmoji rule

davd-gzla0dbfa9357d7
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
"<gitmoji>(<scope>) <subject>"
"""
-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):