3 VPP_DIR=`dirname $0`/../../
9 # If the user provides --fix, then actually fix things
10 # Note: this is meant for use outside of the CI Jobs, by users cleaning things up
12 if [ $# -gt 0 ] && [ ${1} == '--fix' ]; then
16 # Check to make sure we have indent. Exit if we don't with an error message, but
18 command -v indent > /dev/null
20 echo "Cound not find required commend \"indent\". Checkstyle aborted"
27 for i in `git ls-tree -r HEAD --name-only`;do
28 if [ -f ${i} ] && [ ${i} != "build-root/scripts/checkstyle.sh" ] && [ ${i} != "build-root/emacs-lisp/fix-coding-style.el" ]; then
29 grep -q "fd.io coding-style-patch-verification: ON" ${i}
31 CHECKSTYLED_FILES="${CHECKSTYLED_FILES} ${i}"
32 if [ ${FIX} == 0 ]; then
33 indent ${i} -o ${i}.out1 > /dev/null 2>&1
34 indent ${i}.out1 -o ${i}.out2 > /dev/null 2>&1
35 diff -q ${i} ${i}.out2
43 echo "Checkstyle failed for ${i}."
44 echo "Run indent (twice!) as shown to fix the problem:"
45 echo "indent ${VPP_DIR}${i}"
46 echo "indent ${VPP_DIR}${i}"
48 if [ -f ${i}.out1 ]; then
51 if [ -f ${i}.out2 ]; then
55 UNCHECKSTYLED_FILES="${UNCHECKSTYLED_FILES} ${i}"
58 UNCHECKSTYLED_FILES="${UNCHECKSTYLED_FILES} ${i}"
62 if [ ${EXIT_CODE} == 0 ]; then
63 echo "*******************************************************************"
64 echo "* VPP CHECKSTYLE SUCCESSFULLY COMPLETED"
65 echo "*******************************************************************"
67 echo "*******************************************************************"
68 echo "* VPP CHECKSTYLE FAILED"
69 echo "* CONSULT FAILURE LOG ABOVE"
70 echo "* NOTE: Running 'build-root/scripts/checkstyle.sh --fix' *MAY* fix the issue"
71 echo "*******************************************************************"