pre-commit-php
pre-commit-php copied to clipboard
Add new php-md commit hook
Feature
PHP Mess Detector is a QA tool that can be used to test for cyclomatic and NPath complexity, naming conventions, and a collection of potential bugs. This adds a new pre-commit-php hook for calling phpmd.
Implementation
This is fairly straightforward and follows the general pattern of php-cs-fixer. There is one extra bit of code in the php-md.sh on line 63 to clean up the output of phpmd. By default, it includes the full path to the file in each error line. I've trimmed that out and instead we're showing the relative path as a file grouping.
Sample Output

Here's the next one on my checklist. I've just got phpcpd on my todo list, and then I think we'll have the whole collection.
Thanks again for all your work in maintaining this!