summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavey Shafik <me@daveyshafik.com>2015-12-06 02:25:27 -0500
committerDavey Shafik <me@daveyshafik.com>2015-12-06 02:41:16 -0500
commit84e9aa941c7091eae80e202bb6c9b40de970d6c5 (patch)
treefa6c0abe5a2e803da7948e0b31945866899be7d4
parentc8e04f5038999573f44a32527a47e0f5a0121b59 (diff)
downloadphp7-mysql-shim-84e9aa941c7091eae80e202bb6c9b40de970d6c5.zip
php7-mysql-shim-84e9aa941c7091eae80e202bb6c9b40de970d6c5.tar.gz
php7-mysql-shim-84e9aa941c7091eae80e202bb6c9b40de970d6c5.tar.bz2
Add scruitinizer config, fix CS issues
-rw-r--r--.scrutinizer.yml25
-rw-r--r--.travis.yml2
-rwxr-xr-xtools/fix-cs.sh24
3 files changed, 50 insertions, 1 deletions
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 0000000..b175899
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,25 @@
+filter:
+ paths: [lib/*]
+ excluded_paths: [tests/*, vendor/*, build/*, tools/*, docs/*]
+checks:
+ php:
+ code_rating: true
+tools:
+ php_analyzer:
+ enabled: true
+ extensions:
+ - php
+ external_code_coverage:
+ timeout: 1200
+ runs: 1
+ php_code_coverage: false
+ php_code_sniffer:
+ config:
+ standard: PSR2
+ filter:
+ paths: ['lib']
+ php_loc:
+ enabled: true
+ excluded_dirs: [vendor, spec]
+ sensiolabs_security_checker:
+ enabled: true
diff --git a/.travis.yml b/.travis.yml
index 3112539..e453f19 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,4 +13,4 @@ before_install:
- composer self-update
install: travis_retry composer install --no-interaction --prefer-source
script: phpunit
-after_script: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/coverage/coverage.clover
+after_script: if (( `php -r 'echo PHP_MAJOR_VERSION;'` == 7 )); then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/coverage/coverage.clover; fi;
diff --git a/tools/fix-cs.sh b/tools/fix-cs.sh
new file mode 100755
index 0000000..d304da3
--- /dev/null
+++ b/tools/fix-cs.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+export PATH=vendor/bin:$PATH
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+if [[ $# -eq 1 ]]
+then
+ RUNDIR=$@
+else
+ RUNDIR=$(cd $DIR && cd ../ && pwd)/src
+fi
+RESULT=$(phpcs --colors --standard=PSR1,PSR2 $RUNDIR)
+echo "$RESULT"
+echo $RESULT | grep "PHPCBF CAN FIX" > /dev/null
+if [[ $? -eq 0 ]]
+then
+ printf "Would you like to fix errors? [Y/n] "
+ read answer
+ if [[ $answer != "n" ]]
+ then
+ echo "Running phpcbf: "
+ phpcbf --standard=PSR1,PSR2 $RUNDIR
+ fi
+fi
+echo "Running php-cs-fixer: "
+php-cs-fixer fix $RUNDIR --level=psr2