PackageTrack
Sign in Get early access

shipmonk/coverage-guard

Enforce code coverage in your CI. Not by percentage, but target core methods. No more untested Facades, Controllers, or Repositories. Allows you to start enforcing coverage for new code only!

1.1.0 118K downloads/mo #2777 most downloaded on Packagist shipmonk-rnd/coverage-guard

What this package is like to depend on

Last release 1 months ago

17 Jul 2026

Release timing varies

gaps range from 4 weeks to 6 months

Nearly every release is documented

notes for 4 of 4 stable releases

Nothing withdrawn

no release was ever pulled

8 months old

4 releases · first in 2025

4 releases in the last 12 months

see the full history below

Release timeline

4 releases · Dec 2025 to Jul 2026
2026
Release Pre-release

Releases

latest 4
  1. 1.1.0 17 Jul 2026
    Release notes

    New features:

    • Executable line excluders: exclude lines you don't want to enforce coverage for (#67)
      • register via Config::addExecutableLineExcluder()
      • prepared IgnoreThrowNewExceptionLineExcluder allows excluding e.g. all throw new LogicException(...) lines
      • honored by both check and patch-coverage commands
      • excluded lines are rendered with gray background in check output
    // coverage-guard.php
    use ShipMonk\CoverageGuard\Config;
    use ShipMonk\CoverageGuard\Excluder\IgnoreThrowNewExceptionLineExcluder;
    
    $config = new Config();
    $config->addExecutableLineExcluder(new IgnoreThrowNewExceptionLineExcluder([
        LogicException::class,
    ]));
    
    return $config;

    Fixes:

    • Methods with nothing to cover are no longer reported as uncovered; CodeBlock::getCoveragePercentage() returns 100% when there are no executable lines (#67)
      • Previously, it wrongly reported 0%
    • Make coverage path mapping insensitive to trailing slashes (#82)
    Open source →
  2. 1.0.2 02 Jan 2026
    Release notes

    Fixes:

    • export-ignore useless files for composer package (#76)
    Open source →
  3. 1.0.1 10 Dec 2025
    Release notes

    Fixes:

    • Internal error output to print file:line (#73)
    • Better support for light-theme terminals (#75)
    Open source →
  4. 1.0.0 08 Dec 2025
    Release notes

    Initial release

    • Enforce code coverage in your CI by targetting core methods (not by percentage)
    • Supports all PHPUnit coverage formats
    • Supports all PHPUnit versions
    • Fully customizable
    • PHP 8.1+

    Example config:

    // coverage-guard.php
    use ShipMonk\CoverageGuard\Config;
    use ShipMonk\CoverageGuard\Rule\EnforceCoverageForMethodsRule;
    
    $config = new Config();
    $config->addRule(new EnforceCoverageForMethodsRule(
        requiredCoveragePercentage: 50,
        minExecutableLines: 5, 
    ));
    
    return $config;

    Example run:

    # Run tests, collect coverage, generate report:
    XDEBUG_MODE=coverage vendor/bin/phpunit tests --coverage-filter src --coverage-clover clover.xml
    
    # Verify coverage:
    vendor/bin/coverage-guard check clover.xml
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive