X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=build-root%2Fscripts%2Fcheckstyle.sh;h=55fe4ab53ae016d0c56e89054d4d4dcbed508a02;hb=0fc6595addd3dde0883896ef15c6b783da64e3a0;hp=df72cdb2d8aa8d069d3df0d97c6d1c7b8da4b770;hpb=607de1a0638fa45db49295f9ed51a7f9a5e38706;p=vpp.git diff --git a/build-root/scripts/checkstyle.sh b/build-root/scripts/checkstyle.sh index df72cdb2d8a..55fe4ab53ae 100755 --- a/build-root/scripts/checkstyle.sh +++ b/build-root/scripts/checkstyle.sh @@ -3,14 +3,29 @@ VPP_DIR=`dirname $0`/../../ EXIT_CODE=0 FIX="0" +FULL="0" CHECKSTYLED_FILES="" UNCHECKSTYLED_FILES="" # If the user provides --fix, then actually fix things # Note: this is meant for use outside of the CI Jobs, by users cleaning things up -if [ $# -gt 0 ] && [ ${1} == '--fix' ]; then - FIX="1" +while true; do + case ${1} in + --fix) + FIX="1" + ;; + --full) + FULL="1" + ;; + esac + shift || break +done + +if [ "${FULL}" == "1" ]; then + FILELIST=$(git ls-tree -r HEAD --name-only) +else + FILELIST=$((git diff HEAD~1.. --name-only; git ls-files -m ) | sort -u) fi # Check to make sure we have indent. Exit if we don't with an error message, but @@ -24,8 +39,8 @@ indent --version cd ${VPP_DIR} git status -for i in `git ls-tree -r HEAD --name-only`;do - if [ -f ${i} ] && [ ${i} != "build-root/scripts/checkstyle.sh" ] && [ ${i} != "build-root/emacs-lisp/fix-coding-style.el" ]; then +for i in ${FILELIST}; do + if [ -f ${i} ] && [ ${i} != "build-root/scripts/checkstyle.sh" ] && [ ${i} != "extras/emacs/fix-coding-style.el" ]; then grep -q "fd.io coding-style-patch-verification: ON" ${i} if [ $? == 0 ]; then CHECKSTYLED_FILES="${CHECKSTYLED_FILES} ${i}"