Skip to content

Commit c704e8c

Browse files
committed
Merge branch 'stable-3.1' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.1
2 parents 5ffe9d8 + 90e6967 commit c704e8c

File tree

2 files changed

+98
-3
lines changed

2 files changed

+98
-3
lines changed

.git-scripts/syntax.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
IFS=$'\n'
4+
EX=0
5+
ERRS="" ;
6+
WARNS="" ;
7+
ERRCNT=0 ;
8+
WARNCNT=0 ;
9+
10+
OUTCNT=0 ;
11+
FILECNT=0 ;
12+
DONECNT=0 ;
13+
14+
CMD="find . -type f \( -name \"*.php\" -o -name \"*.lng\" \) -print" ;
15+
16+
if [[ "$1" == "commit" ]] ; then
17+
CMD="git diff-tree --no-commit-id --name-only -r ${CI_COMMIT_SHA} | grep -E '\.(php|lng)$'" ;
18+
fi
19+
20+
FILECNT=$(eval "${CMD} | wc -l") ;
21+
22+
for F in $(eval "$CMD") ; do
23+
if [[ ! -e "${F}" && -f "${F}" ]] ; then
24+
continue ;
25+
fi
26+
R=$(php -d error_reporting=E_ALL -d display_errors=On -l "$F" 2>/dev/null) ;
27+
RET=$? ;
28+
R=$(echo "${R}" | sed "/^$/d")
29+
if [ $RET -gt 0 ] ; then
30+
EX=1 ;
31+
echo -n "E" ;
32+
ERRS="${ERRS}${F}:"$'\n'"${R}"$'\n\n' ;
33+
ERRCNT=$((ERRCNT + 1)) ;
34+
else
35+
if [[ "$R" == "Deprecated: "* ]] ; then
36+
echo -n "W" ;
37+
WARNS="${WARNS}${F}:"$'\n'"${R}"$'\n\n' ;
38+
WARNCNT=$((WARNCNT + 1)) ;
39+
else
40+
echo -n "." ;
41+
fi
42+
fi
43+
OUTCNT=$((OUTCNT + 1)) ;
44+
DONECNT=$((DONECNT + 1)) ;
45+
if [ $OUTCNT -ge 40 ] ; then
46+
OUTCNT=0 ;
47+
echo "[${DONECNT}/${FILECNT}]" ;
48+
fi
49+
done
50+
51+
echo ""
52+
echo "--------------------------";
53+
echo "${DONECNT} Files done"
54+
echo "${ERRCNT} Errors"
55+
if [ $ERRCNT -gt 0 ] ; then
56+
echo "${ERRS}"
57+
echo ""
58+
fi
59+
60+
echo "${WARNCNT} Warnings"
61+
if [ $WARNCNT -gt 0 ] ; then
62+
echo ""
63+
echo "${WARNS}"
64+
echo ""
65+
fi
66+
67+
exit $EX

.gitlab-ci.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Defines stages which are to be executed
22
stages:
33
- syntax
4+
- syntax_diff
45

56
#
67
### Stage syntax
@@ -16,8 +17,35 @@ syntax:lint:
1617
- merge_requests
1718

1819
script:
19-
- composer require overtrue/phplint
2020
- echo "Syntax checking PHP files"
21-
- echo "For more information http://www.icosaedro.it/phplint/"
22-
- vendor/bin/phplint
21+
- bash ./.git-scripts/syntax.sh
22+
23+
24+
syntax_diff:lint:
25+
stage: syntax
26+
image: edbizarro/gitlab-ci-pipeline-php:7.2
27+
allow_failure: false
28+
only:
29+
- web
30+
- pushes
31+
- branches
32+
33+
script:
34+
- echo "Syntax checking PHP files"
35+
- bash ./.git-scripts/syntax.sh commit
36+
37+
#syntax:lint:
38+
# stage: syntax
39+
# image: edbizarro/gitlab-ci-pipeline-php:7.2
40+
# allow_failure: false
41+
# only:
42+
# - schedules
43+
# - web
44+
# - merge_requests
45+
#
46+
# script:
47+
# - composer require overtrue/phplint
48+
# - echo "Syntax checking PHP files"
49+
# - echo "For more information http://www.icosaedro.it/phplint/"
50+
# - vendor/bin/phplint
2351

0 commit comments

Comments
 (0)