Skip to content
Check code quality once PHPUnit tests pass
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PHPUnit Code Quality

Automatically check code quality once your PHPUnit tests pass.


Installation is performed via Composer.

composer require --dev drawmyattention/phpunit-code-quality

Register a test listener to your phpunit.xml file:

    <listener class="DrawMyAttention\CodeQuality\Listeners\ComplexityAnalysisListener">
            <object class="DrawMyAttention\CodeQuality\ComplexityAnalyser"/>

Configuring Project Settings

You can define which directories are scanned for code quality checking, as well as which directories and files are excluded. Sensible defaults are provided. By default, code stored in your src directory is checked, and any code in your tests directory is excluded.

You can create a complexity-analyser-config.php file in your project's root directory to specify alternative settings. See the provided config file, or copy and paste the following example:

return [

    // Directories which should be checked for code quality
    'scan_directories' => [

    // Directories which should not be checked
    'excluded_directories' => [

    // Files which should not be checked
    'excluded_files' => [


Because this application utilises PHP Mess Detector to check code quality, you can define which rules should be applied when checking code quality. A full list of rules is available here.


If you find a bug or would like to contribute to the development of this package, please submit a pull-request (with tests if possible).

You can’t perform that action at this time.