mi-schi / php-code-checker
Execute the tests and check the php code
Installs: 3 704
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 2
Open Issues: 0
Language:Python
Requires
- php: >=5.6.0
- df/php-coverfish: @stable
- mi-schi/phpmd-symfony2: @stable
- move-elevator/symfony-coding-standard: @stable
- pdepend/pdepend: @stable
- phploc/phploc: @stable
- phpmd/phpmd: @stable
- sebastian/phpcpd: @stable
- squizlabs/php_codesniffer: @stable
README
Features
Check your php project code with
and create metrics with
This script is a better alternative to configure ant on your jenkins. The python script is more flexible and can also be used on your local dev machine. You can define all settings in the composer.json
in your project, but you don't have to. The scripts also supports exclusion of multiple folders.
The scripts are tested with Python 2.6
and Python 3.5
.
Installation
Via git:
git clone git@github.com:mi-schi/php-code-checker.git
Via composer:
composer require mi-schi/php-code-checker
Usage
Use python to execute the script in the project folder:
checker.py all
checker.py check
checker.py metric
The all
argument executes the check
and metric
argument. You can set the second argument as project path:
checker.py all /path/to/your/project
checker.py all relative/path
If you want to execute tests with coverage, regardless your configuration, then use the checker.py coverage
argument.
You can update all internal dependencies with update.py path/to/php
.
Configuration
The configuration is simple. Just look in the default_configuration.json for usage. Add an extra property to the composer.json
in your project and overwrite the default configuration if you want.
The php-code-checker
comes with its own dependencies for phpunit
, phpcs
and so on. If you want to use another phpunit
, you can define the bin-dir
property and add phpunit
in your composer requirements.
If php-code-checker
find path/to/your/project/bin/phpunit
then this binary will be used. Otherwise your tests were executed with the phpunit
version which comes with php-code-checker
.
Jenkins integration
There is a huge configuration to process all these reports on Jenkins. First you have to install the following plugins:
Also useful:
Then, create a new empty job called default-job
. Copy the default-jenkins-config.xml to /var/lib/jenkins/jobs/default-job/config.xml
on your Jenkins.
That's it! Append the configuration and copy default-job
from now on.