Add code sniffer

Add copy-paste detected
Fix version dev library
Add script checker
This commit is contained in:
Vasily Komrakov 2016-05-22 01:14:14 +03:00
commit f4388c8907
2 changed files with 39 additions and 2 deletions

View file

@ -46,7 +46,9 @@
"doctrine/cache": "^1.6" "doctrine/cache": "^1.6"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8" "phpunit/phpunit": "4.8.*",
"squizlabs/php_codesniffer": "2.5.*",
"sebastian/phpcpd": "2.0.*"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@ -54,5 +56,24 @@
} }
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"prefer-stable": true "prefer-stable": true,
"scripts": {
"test": [
"composer test:lint",
"composer test:unit",
"composer test:cpd"
],
"test:lint": [
"vendor/bin/phpcs --colors --report-full --standard=PSR2 src tests"
],
"test:unit": [
"vendor/bin/phpunit --configuration phpunit.xml --coverage-text"
],
"test:unit:html": [
"vendor/bin/phpunit --configuration phpunit.xml --coverage-html=internal_data/report"
],
"test:cpd": [
"vendor/bin/phpcpd --exclude=vendor --exclude=internal_data ."
]
}
} }

16
phpcs.xml Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<ruleset name="TorrentPier">
<description>Codestyle ruleset for TorrentPier</description>
<rule ref="PSR2"/>
<file>src</file>
<arg name="encoding" value="UTF-8"/>
<arg name="extensions" value="php"/>
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
</ruleset>