forked from Codiad/Codiad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
49 lines (43 loc) · 1.32 KB
/
.travis.yml
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
language: php
php:
- 5.6
- 7.0
env:
global:
# PHP Code Sniffer special rules
- R_CLASS="Squiz.Classes.ValidClassName" # must use CamleClasName
- R_CONST="Generic.NamingConventions.UpperCaseConstantName" # const must UPPERCASE
- R_FILE="PSR1.Files.SideEffects" # a file declare , or executes logic, not both
- R_LINE="Generic.Files.LineLength" #
- R_METHOD="PSR1.Methods.CamelCapsMethodName" # must use camleMethodName
- R_NS="PSR1.Classes.ClassDeclaration" # class must use Namespace
- CS_INGNORE="components/install/view.php" # ingore Files
matrix:
#strict mode to check formatting
- STRICT=true
# exclude some special or unsupported conventions
- STRICT=false
#allow failures
matrix:
allow_failures:
- env: STRICT=true
#install dependence
install:
- composer install --prefer-dist --verbose
#init the env to exclude
before_script:
# STRICT mode only exclude Namespace and LineLength
- if [[ "$STRICT" == "true" ]];then
export CS_EXCLUDE="$R_LINE,$R_NS";
else
export CS_EXCLUDE="$R_CLASS,$R_CONST,$R_FILE,$R_LINE,$R_METHOD,$R_NS";
fi
- echo $CS_EXCLUDE
# check formatting and Syntax
script:
- ./vendor/bin/phpcs components
--standard=PSR2
--exclude="$CS_EXCLUDE"
--ignore="$CS_INGNORE"
--colors
--extensions=php