From: Sébastien Han Date: Mon, 13 Aug 2018 12:34:52 +0000 (+0200) Subject: ceph-ansible-pr-syntax-check: add cbheck for coding convention X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1097%2Fhead;p=ceph-build.git ceph-ansible-pr-syntax-check: add cbheck for coding convention One of our convention in ceph-ansible is to not use capital letters in task's name. So let's hardcode it in the initial phase of the pipeline. ALso, this will let user discover what's wrong without us doing the review and finding the problem. Signed-off-by: Sébastien Han --- diff --git a/ceph-ansible-pr-syntax-check/build/build b/ceph-ansible-pr-syntax-check/build/build index 5b19523b..f561e58b 100644 --- a/ceph-ansible-pr-syntax-check/build/build +++ b/ceph-ansible-pr-syntax-check/build/build @@ -57,6 +57,17 @@ function test_sign_off { echo "Sign-off ok!" && return 0 } +function test_capital_letter { + for commit in $(git log --no-merges --pretty=format:"%h" origin/"${ghprbTargetBranch}"..HEAD); do + if git show "$commit" | grep -E "\\- name:" | grep '[[:upper:]]'; then + echo "'- name:' statement must not contain any capital letters!" + echo "Remove any capital letters from task's name." + return 1 + fi + done + echo "No capital letters found in task's name!" && return 0 +} + ######## # MAIN # @@ -66,3 +77,4 @@ syntax_check #ansible_lint group_vars_check test_sign_off +test_capital_letter