Skip to content

Commit

Permalink
chore(script): check message during commit
Browse files Browse the repository at this point in the history
- 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
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
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
18 changes: 18 additions & 0 deletions check_message.sh
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"

0 comments on commit e79cacc

Please sign in to comment.