Skip to content

Commit

Permalink
added code quality scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Zamponi committed Mar 12, 2017
1 parent ea21993 commit 5bcc88b
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,38 @@
before_commands:
- "composer update --prefer-source"

tools:
external_code_coverage:
timeout: 1800
php_code_coverage:
enabled: true
php_code_sniffer:
enabled: false
php_cpd:
enabled: true
excluded_dirs: ["tests", "vendor"]
php_cs_fixer:
enabled: true
config:
level: all
filter:
paths: ["src/*", "tests/*"]
php_loc:
enabled: true
excluded_dirs: ["tests", "vendor"]
php_mess_detector:
enabled: true
filter:
paths: ["src/*"]
php_pdepend:
enabled: true
excluded_dirs: ["tests", "vendor"]
php_analyzer:
enabled: true
filter:
paths: ["src/*", "tests/*"]
php_hhvm:
enabled: true
filter:
paths: ["src/*", "tests/*"]
sensiolabs_security_checker: true
35 changes: 35 additions & 0 deletions .travis.yml
@@ -0,0 +1,35 @@
language: php

cache: false
sudo: false

php:
- 5.6
- 7.0
- 7.1
- hhvm

before_script:
- composer update
- if [ "$DEPENDENCIES" = 'low' ] ; then composer update --prefer-source --prefer-lowest --prefer-stable; fi
- git clone https://github.com/padraic/humbug.git && cd humbug && composer install && cd ..

script:
- ./vendor/bin/phpunit --disallow-test-output --report-useless-tests --coverage-clover ./clover.xml
- ./vendor/bin/phpcs
- ./humbug/bin/humbug
- ./build/check-humbug-mutators.php

env:
matrix:
- DEPENDENCIES="high"
- DEPENDENCIES="low"

matrix:
allow_failures:
- php: hhvm

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover ./clover.xml

18 changes: 18 additions & 0 deletions build/check-humbug-mutators.php
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

call_user_func(function () {
$log = json_decode(file_get_contents(__DIR__ . '/../humbug-log.json'), true);

if (! array_key_exists('escapes', $log['summary'])) {
throw new \UnexpectedValueException('Could not find "escapes" in summary');
}

echo file_get_contents(__DIR__ . '/../humbug-log.txt');

if ($log['summary']['escapes']) {
throw new \UnexpectedValueException('Humbug reported escaped mutants');
}
});
12 changes: 12 additions & 0 deletions humbug.json.dist
@@ -0,0 +1,12 @@
{
"timeout": 30,
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "humbug-log.txt",
"json": "humbug-log.json"
}
}
9 changes: 9 additions & 0 deletions phpcs.xml.dist
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="Custom">
<description>custom code-style</description>
<file>./src</file>
<file>./tests</file>
<rule ref="PSR2">
<exclude name="Generic.Files.LineLength"/>
</rule>
</ruleset>
22 changes: 22 additions & 0 deletions phpunit.xml.dist
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/InvoiceNinjaModuleTest/Bootstrap.php"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
backupGlobals="false"
backupStaticAttributes="false"
stopOnFailure="false"
syntaxCheck="true" >
<testsuites>
<testsuite name="InvoiceNinjaModule tests">
<directory suffix=".php">./tests/InvoiceNinjaModuleTest/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit 5bcc88b

Please sign in to comment.