One point we know need more love and atenttion at DrupalConsole project is to increase the test coverage. Even when I had some previous experience using tools like PHPUnit and Behat. I decided to start researching for material related to this topic and how to automate test execution.
On this research I found this blog post Write your git hooks in PHP and keep them under git control and this resource of PHP QA related tools The PHP Quality Assurance Toolchain that I highly recomend you to read and visit.
After trying to include a variation of the code I found on the blog post mentioned above, you can see code at CodeQualityTool.php. I decided to decouple this feature and publish an advanced version of this on a separated project.
You can find the source code at github https://github.com/jmolivas/phpqa/ because you know, we all love Open Source.
This project aims to serve as a CLI tool to make easy the use of different PHP tools related to Quality Assurance and code analysis in PHP.
Every analyzer tool handles arguments and options using different formats, the goal of this project is to provide a single way to interact with those projects, you can also set options and arguments using a default configuration file when the project supports it.
This tool check syntax of PHP files faster then serial check with fancier output.
The PHP Coding Standards Fixer tool fixes most issues in your code when you want to follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents.
It is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly and easy to configure frontend for the raw metrics measured by PHP Depend.
is a tool for quickly measuring the size and analyzing the structure of a PHP project.
is a Dead Code Detector (DCD) for PHP code. It scans a PHP project for all declared functions and methods and reports those as being "dead code" that are not called at least once.
is a Copy/Paste Detector (CPD) for PHP code.
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.
|project||Available values `php`, `symfony` and `drupal`.|
|global||Copy configuration files to user home directory, instead of current working directory.|
|override||If this option is set, files are copied using override flag.|
|project||Available values php, symfony and drupal|
|files||Files or directories to analyze.|
|git||If this option is set, all files added to git index will be scanned. This is useful when setting executing this tool on a pre-commit git-hook.|
If you like to know about nice to have features, please visit the project page https://github.com/jmolivas/phpqa#nice-to-have-features
This is just the beginning of the project the real goal is to provide a tool to take advantage of all those great projects and make easy to customize and execute.
This project was built to be fully customizable. I will be working on the documentation related to override default configurations, but in the meantime please please visit https://github.com/jmolivas/phpqa#override-configuration and give a try and as usual, comments and suggestions are more than welcome.
NOTE: Image used on this bog post, originally from xkcd comic Quality Code at https://xkcd.com/1513/