Skip to content
Snippets Groups Projects
Commit c8db76b6 authored by Marius Burkard's avatar Marius Burkard
Browse files

- improved lint script

parent 22819ea8
No related branches found
No related tags found
No related merge requests found
......@@ -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}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment