-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.sh
executable file
·61 lines (51 loc) · 1.37 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set +e
if hash php 2>/dev/null
then
info "PHP found."
else
fail "PHP not found!"
fi
if which phpcs
then
info "PHP CodeSniffer Found."
PHPCS_PATH="phpcs"
elif [ -f $WERCKER_SOURCE_DIR/vendor/bin/phpcs ]
then
info "PHP CodeSniffer Found."
PHPCS_PATH="$WERCKER_SOURCE_DIR/vendor/bin/phpcs"
else
composer require squizlabs/php_codesniffer:1.*
PHPCS_PATH="$WERCKER_SOURCE_DIR/vendor/bin/phpcs"
fi
if [ $? -ne "0" ] || [ -z "$PHPCS_PATH" ]
then
fail "Unable to locate or install PHP CodeSniffer.";
fi
if [ -z "$WERCKER_PHPCS_DIRECTORY" ]
then
fail "missing 'directory' option, please add this to the phpcs step in your wercker.yml"
fi
if [ -z "$WERCKER_PHPCS_STANDARD" ]
then
info "missing 'standard' option, using PSR2. You can specify the standard in the phpcs step in your wercker.yml"
WERCKER_PHPCS_STANDARD="PSR2"
fi
if [ -z "$WERCKER_PHPCS_REPORT" ]
then
WERCKER_PHPCS_REPORT="full"
fi
if [ -z "$WERCKER_PHPCS_IGNORE" ]
then
WERCKER_PHPCS_IGNORE=""
else
WERCKER_PHPCS_IGNORE="--ignore='$WERCKER_PHPCS_IGNORE'"
fi
info "Starting PHP CodeSniffer scanning."
$PHPCS_PATH -p --extensions=php --standard=$WERCKER_PHPCS_STANDARD --report=$WERCKER_PHPCS_REPORT $WERCKER_PHPCS_IGNORE $WERCKER_PHPCS_DIRECTORY
if [ $? -ne "0" ]
then
fail "PHP CodeSniffer failed."
else
success "PHP CodeSniffer completed successfully!"
fi