Adding phpcs to travis-ci

Squashed commit of the following:

commit 5b958d42bcfdce94e742d9602217818c398fb993
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Mon Nov 20 15:56:54 2017 +0000

    pyrus has been dropped by travis, even thouhgt its still in the docs

commit 33cb7ac72ad16af3df2c7a10daeb99fbe3b0a08c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Mon Nov 20 15:45:14 2017 +0000

    Use pyrus/pear2 to install phpcs, and configure with phpcs.xml

commit 9781b036681e28ab9bb85f7a060e26d061118685
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Mon Nov 20 14:51:44 2017 +0000

    Fix phpcs issues

commit b165cd2a133113138a24c72a5df320a6ad397dac
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Mon Nov 20 13:48:18 2017 +0000

    Let’s read the whole travis help doc

commit e0f84ed388a83350fd76ac8586291a57c65df6c7
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Mon Nov 20 13:44:55 2017 +0000

    Try adding phpcs to travis
This commit is contained in:
Jonny Barnes 2017-11-20 17:10:31 +00:00
parent c65ab1bdcb
commit 77836dc739
4 changed files with 12 additions and 4 deletions

View file

@ -47,6 +47,7 @@ before_install:
- psql -U travis -c 'create database travis_ci_test' - psql -U travis -c 'create database travis_ci_test'
- psql -U travis -d travis_ci_test -c 'create extension postgis' - psql -U travis -d travis_ci_test -c 'create extension postgis'
- travis_retry composer self-update --preview - travis_retry composer self-update --preview
- pear install pear/PHP_CodeSniffer && phpenv rehash
install: install:
- if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi - if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi
@ -67,5 +68,6 @@ before_script:
script: script:
- php vendor/bin/phpunit --coverage-text - php vendor/bin/phpunit --coverage-text
- phpcs
#- php artisan dusk #- php artisan dusk
- php vendor/bin/security-checker security:check ./composer.lock --end-point=http://security.sensiolabs.org/check_lock - php vendor/bin/security-checker security:check ./composer.lock --end-point=http://security.sensiolabs.org/check_lock

View file

@ -31,8 +31,7 @@ class BookmarkService
$content = $request->input('properties.content.0'); $content = $request->input('properties.content.0');
$categories = $request->input('properties.category'); $categories = $request->input('properties.category');
} }
if ( if (($request->header('Content-Type') == 'application/x-www-form-urlencoded')
($request->header('Content-Type') == 'application/x-www-form-urlencoded')
|| ||
(str_contains($request->header('Content-Type'), 'multipart/form-data')) (str_contains($request->header('Content-Type'), 'multipart/form-data'))
) { ) {

View file

@ -21,8 +21,7 @@ class LikeService
//micropub request //micropub request
$url = normalize_url($request->input('properties.like-of.0')); $url = normalize_url($request->input('properties.like-of.0'));
} }
if ( if (($request->header('Content-Type') == 'x-www-url-formencoded')
($request->header('Content-Type') == 'x-www-url-formencoded')
|| ||
($request->header('Content-Type') == 'multipart/form-data') ($request->header('Content-Type') == 'multipart/form-data')
) { ) {

8
phpcs.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<ruleset name="jonnybarnes.uk">
<description>Custom configuration for code running jonnybarnes.uk</description>
<file>./app/</file>
<rule ref="PSR2">
<exclude name="PSR2.Namespaces.UseDeclaration" />
</rule>
</ruleset>