#144 Ajout des fichiers commit-msg et pre-commit. Modification de .editorconfig pour ajouter des règles personnalisées. Exclusion de Progam.cs pour l'erreur SA1200.
This commit is contained in:
24
Webzine.Documentation/git_hooks/commit-msg
Normal file
24
Webzine.Documentation/git_hooks/commit-msg
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hook: commit-msg
|
||||
# Validates the commit message format.
|
||||
# Git passes the path to the temp message file as $1.
|
||||
|
||||
COMMIT_MSG=$(cat "$1")
|
||||
|
||||
if [ ${#COMMIT_MSG} -le 10 ]; then
|
||||
echo "❌ Erreur : Le message doit faire plus de 10 caractères."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! echo "$COMMIT_MSG" | grep -q "\.$"; then
|
||||
echo "❌ Erreur : Le commit doit se terminer par un point."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! echo "$COMMIT_MSG" | grep -q "#[0-9]\+"; then
|
||||
echo "❌ Erreur : Vous devez faire référence à un ticket (ex: #123)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user