diff --git a/test/test-commit-message.sh b/test/test-commit-message.sh index 6b544c3b..2ca606f4 100755 --- a/test/test-commit-message.sh +++ b/test/test-commit-message.sh @@ -59,6 +59,20 @@ test_commit_message() { fi } +test_commit_message_common_bugs() { + echo "Testing commit message for common bugs $1" + if git log --format=%s $1 | head -n 1 | grep -q "^resource:" + then + echo 'FAIL: Commit message starts with `resource:`, did you mean `resources:` ?' + exit 1 + fi + if git log --format=%s $1 | head -n 1 | grep -q "^tests:" + then + echo 'FAIL: Commit message starts with `tests:`, did you mean `test:` ?' + exit 1 + fi +} + if [[ -n "$TRAVIS_PULL_REQUEST_SHA" ]] then commits=$(git log --format=%H origin/${TRAVIS_BRANCH}..${TRAVIS_PULL_REQUEST_SHA}) @@ -67,6 +81,7 @@ then for commit in $commits do test_commit_message $commit + test_commit_message_common_bugs $commit done fi echo 'PASS'