-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(script): check message during commit
- Add script that checks message from file - Add precommit hook to help python developers make goo commit messages
- Loading branch information
Anis Da Silva Campos
committed
Sep 3, 2020
1 parent
3c34309
commit e79cacc
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- id: commit-message-validator | ||
name: Commit Message Validator | ||
description: Checks that commit messages are compliant with Lumapps rules. | ||
entry: check_message.sh | ||
language: script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
if [[ -v ZSH_NAME ]]; then | ||
setopt BASH_REMATCH | ||
setopt RE_MATCH_PCRE | ||
setopt KSH_ARRAYS | ||
fi | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
source $DIR/validator.sh | ||
|
||
MESSAGE=$(<"$1") | ||
echo "checking commit message: '${MESSAGE}'" | ||
validate "$MESSAGE" | ||
|
||
echo "Message succesfully checked" |