This commit introduces a boilerplate inspired by https://github.com/numerique-gouv/impress. The code has been cleaned to remove unnecessary Impress logic and dependencies. Changes made: - Removed Minio, WebRTC, and create bucket from the stack. - Removed the Next.js frontend (it will be replaced by Vite). - Cleaned up impress-specific backend logics. The whole stack remains functional: - All tests pass. - Linter checks pass. - Agent Connexion sources are already set-up. Why clear out the code? To adhere to the KISS principle, we aim to maintain a minimalist codebase. Cloning Impress allowed us to quickly inherit its code quality tools and deployment configurations for staging, pre-production, and production environments. What’s broken? - The tsclient is not functional anymore. - Some make commands need to be fixed. - Helm sources are outdated. - Naming across the project sources are inconsistent (impress, visio, etc.) - CI is not configured properly. This list might be incomplete. Let's grind it.
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""
|
|
Gitlint extra rule to validate that the message title is of the form
|
|
"<gitmoji>(<scope>) <subject>"
|
|
"""
|
|
from __future__ import unicode_literals
|
|
|
|
import re
|
|
|
|
import requests
|
|
|
|
from gitlint.rules import CommitMessageTitle, LineRule, RuleViolation
|
|
|
|
|
|
class GitmojiTitle(LineRule):
|
|
"""
|
|
This rule will enforce that each commit title is of the form "<gitmoji>(<scope>) <subject>"
|
|
where gitmoji is an emoji from the list defined in https://gitmoji.carloscuesta.me and
|
|
subject should be all lowercase
|
|
"""
|
|
|
|
id = "UC1"
|
|
name = "title-should-have-gitmoji-and-scope"
|
|
target = CommitMessageTitle
|
|
|
|
def validate(self, title, _commit):
|
|
"""
|
|
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"]
|
|
emojis = [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 "<gitmoji>(<scope>) <subject>"'
|
|
return [RuleViolation(self.id, violation_msg, title)]
|