This commit is contained in:
Nukeap committed 2025-02-06 09:40:26 +03:00
1 parent 24b4a76cf6
commit 3f23f4305b
6 files changed
+44 -54

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
#!/usr/bin/env sh
npm run commitlint --edit ${1}
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/python3
import re
import sys
green_color = "\033[1;32m"
red_color = "\033[1;31m"
color_off = "\033[0m"
blue_color = "\033[1;34m"
yellow_color = "\033[1;33m"
commit_msg_filepath = sys.argv[1]
regex = r"Add: |Created: |Fix: |Update: |Rework:"
error_msg = "Commit message format must match regex " + regex
with open(commit_msg_filepath, "r+") as file:
commit_msg = file.read()
if re.search(regex, commit_msg):
print(green_color + "Good Commit!" + color_off)
else:
print(red_color + "Bad commit " + blue_color + commit_msg)
print(yellow_color + error_msg)
print("`Заголовок должен содержать тип, номер задачи и название коммита. Формат: <тип> [<номер задачи>]: <название>
'feat' - Новый функционал
'fix' - Исправление ошибки
'docs' - Изменения в документации
'style' - Изменения, не влияющие на функциональность
'refactor' - Изменения кода, не исправляющие ошибки и не добавляющие функционал
'perf' - Изменения, улучшающие производительность
'test' - Добавление тестов
'chore' - Изменения в процессе сборки или вспомогательных инструментах.
Например: feat [X-01]: я тут накоммитил`")
sys.exit(1)