]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-ansible-pr-syntax-check: add cbheck for coding convention 1097/head
authorSébastien Han <seb@redhat.com>
Mon, 13 Aug 2018 12:34:52 +0000 (14:34 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 13 Aug 2018 12:35:31 +0000 (14:35 +0200)
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 <seb@redhat.com>
ceph-ansible-pr-syntax-check/build/build

index 5b19523bcea788d636bbfd5bc54e5718fdf9bc2b..f561e58b8f5be86d9246b02c5daa6aaacf8e564a 100644 (file)
@@ -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