Skip to content

Commit

Permalink
Merge pull request #63 from jwage/code-cleanup
Browse files Browse the repository at this point in the history
Add phpstan, doctrine cs standards, travis ci updates, scrutinizer ci
  • Loading branch information
jwage authored May 23, 2018
2 parents 04da0d1 + 87bb711 commit fd3df29
Show file tree
Hide file tree
Showing 25 changed files with 3,275 additions and 787 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor
composer.lock
data/public-suffix-list.txt
phpunit.xml
.phpcs-cache

29 changes: 29 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
build:
nodes:
analysis:
environment:
php:
version: 7.1
cache:
disabled: false
directories:
- ~/.composer/cache
project_setup:
override: true
tests:
override:
- php-scrutinizer-run
- phpcs-run
dependencies:
override:
- composer install --ignore-platform-reqs --no-interaction

tools:
external_code_coverage:
timeout: 600

build_failure_conditions:
- 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed
- 'issues.label("coding-style").new.exists' # No new coding style issues allowed
- 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity
- 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection
53 changes: 45 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,56 @@
dist: trusty
sudo: false
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- nightly

matrix:
cache:
directories:
- $HOME/.composer/cache

before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
- travis_retry composer self-update
- travis_retry composer config --unset platform.php

install:
- rm composer.lock
- travis_retry composer update --prefer-dist

script:
- ./vendor/bin/phpunit

jobs:
allow_failures:
- php: nightly

include:
- php: 5.3
dist: precise
- stage: Test
env: DEPENDENCIES=low
install:
- rm composer.lock
- travis_retry composer update --prefer-dist --prefer-lowest

- stage: Test
env: COVERAGE
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
script:
- ./vendor/bin/phpunit --coverage-clover clover.xml
after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover clover.xml

- stage: Code Quality
env: CODING_STANDARDS
install: travis_retry composer install --prefer-dist
script: ./vendor/bin/phpcs

before_script: composer install
- stage: Code Quality
env: STATIC_ANALYSIS
install: travis_retry composer install --prefer-dist
script: vendor/bin/phpstan analyse -l 7 -c phpstan.neon src
15 changes: 13 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,22 @@
"autoload-dev": {
"psr-4": {"Purl\\Test\\": "tests/Purl/Test"}
},
"config": {
"sort-packages": true
},
"require": {
"php": ">=5.3.0",
"php": "^7.1",
"jeremykendall/php-domain-parser": "^1.3.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.5|^6.5|^7.0"
"doctrine/coding-standard": "^4.0",
"phpstan/phpstan": "^0.9.2",
"phpstan/phpstan-strict-rules": "^0.9",
"phpunit/phpunit": "^5.5|^6.5|^7.0"
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}
Loading

0 comments on commit fd3df29

Please sign in to comment.