forked from 2600hz/kazoo-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phplint
executable file
·46 lines (36 loc) · 863 Bytes
/
phplint
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
#!/usr/bin/env bash
cd `dirname $0`
#print formatting and logging func
green='\e[0;32m'
red='\e[0;31m'
yellow='\e[0;33m'
NC='\e[0m'
blue='\e[0;36m'
dbg(){
echo -e " - ${green}$* ${NC} "
}
info(){
echo -e "${blue}$* ${NC} "
}
error(){
error_msg="$*"
echo
error="${red}${error_msg} ${NC} "
echo -e "$error" 1>&2
}
warn(){
echo -e "${yellow}$* ${NC} ";
echo -e "${yellow}$* ${NC} " >> $logfile
}
info "Searching for php syntax errors..."
err=$( { find lib/ -type f -name '*.php' -exec php -l {} \; | egrep -v "No syntax"; } 2>&1 )
error "$err"
info "Searching for vim swap files..."
err=$(find lib/ -regex ".*\.sw." -print | xargs -r ls -l)
error "$err"
info "Searching for echos..."
err=$(grep -iRn echo lib/*)
error "$err"
info "Searching for var_dumps..."
err=$(grep -iRn var_dump src/*)
error "$err"