This commit is contained in:
Nukeap committed 2025-02-06 10:16:37 +03:00
1 parent 3f23f4305b
commit 78c43e7c71
5 files changed
+93 -143

No files matched your search

+2 -37
View File
@@ -1,38 +1,3 @@
#!/usr/bin/python3
#!/usr/bin/env sh
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)
npm run commitlint --edit ${1}