Skip to content

Commit e79cacc

Browse files
author
Anis Da Silva Campos
committed
chore(script): check message during commit
- Add script that checks message from file - Add precommit hook to help python developers make goo commit messages
1 parent 3c34309 commit e79cacc

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.pre-commit-hooks.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- id: commit-message-validator
3+
name: Commit Message Validator
4+
description: Checks that commit messages are compliant with Lumapps rules.
5+
entry: check_message.sh
6+
language: script

check_message.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
if [[ -v ZSH_NAME ]]; then
6+
setopt BASH_REMATCH
7+
setopt RE_MATCH_PCRE
8+
setopt KSH_ARRAYS
9+
fi
10+
11+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
12+
source $DIR/validator.sh
13+
14+
MESSAGE=$(<"$1")
15+
echo "checking commit message: '${MESSAGE}'"
16+
validate "$MESSAGE"
17+
18+
echo "Message succesfully checked"

0 commit comments

Comments
 (0)