summaryrefslogtreecommitdiffstats
path: root/scripts/checkstyle.sh
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-09-21 12:24:33 +0200
committerMauro Sardara <msardara@cisco.com>2022-09-21 10:31:17 +0000
commit45da502db58f712b78e59c214f05c44aa01ea8d0 (patch)
tree34acf756801cd7d1c697f6803312c6129dcd0d82 /scripts/checkstyle.sh
parent6233c9ce9808a82894d85a9774d71ee6dfc53921 (diff)
ci: add commit check
Check the format of commit is conventional commit compliant Ticket: HICN-791 Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I56b0884c1bb84ef29adc55a5f07eafb3763eff43
Diffstat (limited to 'scripts/checkstyle.sh')
-rw-r--r--scripts/checkstyle.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/checkstyle.sh b/scripts/checkstyle.sh
index 786e81cfe..4d3413c67 100644
--- a/scripts/checkstyle.sh
+++ b/scripts/checkstyle.sh
@@ -16,6 +16,7 @@
set -eEo pipefail
sudo apt-get install -y clang-format-12
+sudo pip3 install -U Commitizen
CLANG_FORMAT_VER_REGEX='([0-9]+)\.[0-9]+\.[0-9]+'
CLANG_FORMAT_DIFF="/usr/share/clang/clang-format-diff.py"
@@ -26,6 +27,16 @@ else
DIFF_TARGET="origin/${CHANGE_TARGET}...HEAD"
fi
+###############################################
+# Check commit mesage
+###############################################
+
+cz check --rev-range HEAD~1...HEAD
+
+###############################################
+# Check code style
+###############################################
+
CLANG_FORMAT_VER=${CLANG_FORMAT_VER:-12}
GIT_DIFF_ARGS="-U0 --no-color --relative ${DIFF_TARGET}"
CLANG_FORMAT_DIFF_ARGS="-style file -p1"