There are lots of code quality tools available! Some concentrate on coding style, some on test coverage, some on static analysis/type checking, and many more.
Chipper CI lets you download and install any tools you need! For example, you may want to install PHP Codesniffer and use it to generate a report of your code versus a coding style.
Note that Chipper CI currently doesn't have write-access to your repositories - it will not change your code and create PR's or commits against your repositories.
Some other tools to look into:
While PHPUnit can generate coverage reports, it does not plan on supporting a way to return errors (and thus fail a build) based on coverage.
This means we need some tools to help us!
To have your pipeline pass or fail a build based on test coverage, we can use a little utility as outlined here.
What we'll do is:
- Enable xDebug
- Have PHPUnit generate a coverage report
- Run a utility to check coverage and return a success or error response based on the coverage
# Download the coverage checker script wget https://gist.githubusercontent.com/fideloper/5c7934396530c40d346a027ebd942719/raw/be4ff1935208c534fd0f11fcab8ba9cf0ee8b7b6/coverage.php chmod +x coverage.php # Enable xdebug and run phpunit sudo phpenmod xdebug phpunit --coverage-clover clover.xml # Check the code coverage and return an error # if code coverage is below 80% ./coverage.php clover.xml 80