From c8db76b6f7bf85483e99733fe29de791d56727cd Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Tue, 9 Jun 2020 13:41:38 +0200 Subject: [PATCH] - improved lint script --- .git-scripts/syntax.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.git-scripts/syntax.sh b/.git-scripts/syntax.sh index efc48ae4b3..e584e2ef10 100644 --- a/.git-scripts/syntax.sh +++ b/.git-scripts/syntax.sh @@ -7,39 +7,50 @@ WARNS="" ; ERRCNT=0 ; WARNCNT=0 ; +OUTCNT=0 ; +FILECNT=0 ; +DONECNT=0 ; + CMD="find . -type f \( -name \"*.php\" -o -name \"*.lng\" \) -print" ; if [[ "$1" == "commit" ]] ; then CMD="git diff-tree --no-commit-id --name-only -r ${CI_COMMIT_SHA} | grep -E '\.(php|lng)$'" ; fi +FILECNT=$(eval "${CMD} | wc -l") ; + for F in $(eval "$CMD") ; do if [[ ! -e "${F}" && -f "${F}" ]] ; then continue ; fi - echo -n "${F} ... " ; R=$(php -d error_reporting=E_ALL -d display_errors=On -l "$F" 2>/dev/null) ; RET=$? ; R=$(echo "${R}" | sed "/^$/d") if [ $RET -gt 0 ] ; then EX=1 ; - echo "[ERROR]" ; + echo -n "E" ; ERRS="${ERRS}${F}:"$'\n'"${R}"$'\n\n' ; ERRCNT=$((ERRCNT + 1)) ; else if [[ "$R" == "Deprecated: "* ]] ; then - echo "[WARN]" ; + echo -n "W" ; WARNS="${WARNS}${F}:"$'\n'"${R}"$'\n\n' ; WARNCNT=$((WARNCNT + 1)) ; else - echo "[OK]" ; + echo -n "." ; fi fi + OUTCNT=$((OUTCNT + 1)) ; + DONECNT=$((DONECNT + 1)) ; + if [ $OUTCNT -ge 40 ] ; then + OUTCNT=0 ; + echo "[${DONECNT}/${FILECNT}]" ; + fi done echo "" echo "--------------------------"; -echo "" +echo "${DONECNT} Files done" echo "${ERRCNT} Errors" if [ $ERRCNT -gt 0 ] ; then echo "${ERRS}" -- GitLab