Commit 4b6cd639 authored by Luke081515's avatar Luke081515

Add lint for release/2.0

* Added lint check
parent 66421192
Pipeline #3682 passed with stage
in 1 minute and 53 seconds
stages:
- lint
lint:lint-php5.4:
stage: lint
image: php:5.4
before_script:
- bash ci/docker_install.sh > /dev/null
script:
- bash ci/phplint.sh ./
lint:lint-php5.6:
stage: lint
image: php:5.6
before_script:
- bash ci/docker_install.sh > /dev/null
script:
- bash ci/phplint.sh ./
lint:lint-php7.0:
stage: lint
image: php:7.0
before_script:
- bash ci/docker_install.sh > /dev/null
script:
- bash ci/phplint.sh ./
lint:lint-php7.1:
stage: lint
image: php:7.1
before_script:
- bash ci/docker_install.sh > /dev/null
script:
- bash ci/phplint.sh ./
lint:lint-php7.2:
stage: lint
image: php:7.2
before_script:
- bash ci/docker_install.sh > /dev/null
script:
- bash ci/phplint.sh ./
\ No newline at end of file
#!/bin/bash
# We need to install dependencies only for Docker
[[ ! -e /.dockerenv ]] && exit 0
set -xe
# Install git (the php image doesn't have it) which is required by composer
apt-get update -yqq
apt-get install git -yqq
pear install PHP_CodeSniffer
\ No newline at end of file
#!/bin/bash
#Usage: `phplint.sh /path/to/dir` or `phplint.sh /path/to/file.php`
error=false
while test $# -gt 0; do
current=$1
shift
if [ ! -d $current ] && [ ! -f $current ] ; then
echo "Invalid directory or file: $current"
error=true
continue
fi
for file in `find $current -type f -name "*.php"` ; do
RESULTS=`php -l $file`
if [ "$RESULTS" != "No syntax errors detected in $file" ] ; then
echo $RESULTS
error=true
fi
done
done
if [ "$error" = true ] ; then
exit 1
else
exit 0
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment