#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
|
||||
21
Webzine.Documentation/git_hooks/pre-commit
Normal file
21
Webzine.Documentation/git_hooks/pre-commit
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hook: pre-commit
|
||||
# Runs dotnet format on staged files, then verifies documentation warnings.
|
||||
|
||||
echo "🔧 Running dotnet format..."
|
||||
dotnet format --severity warn
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Erreur : dotnet format a échoué."
|
||||
exit 1
|
||||
fi
|
||||
git add -u
|
||||
|
||||
echo "📄 Vérification de la documentation..."
|
||||
dotnet format style --severity warn --verify-no-changes
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Erreur : Documentation manquante (classes/méthodes non commentées)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user