Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpunit File Coverage Inspection Laravel Package

digitalrevolution/phpunit-file-coverage-inspection

Define per-file code coverage thresholds from Clover coverage.xml, with directory/file overrides and optional uncovered-method rules. Fails builds with checkstyle or GitLab formatted reports so a single file can’t hide behind high overall coverage.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Granular Code Quality Enforcement: Implement per-file coverage thresholds to ensure critical components (e.g., core logic, security-sensitive modules) meet higher standards than legacy or less critical code. Aligns with shift-left testing and technical debt reduction initiatives.
  • CI/CD Pipeline Integration: Replace or augment existing coverage checks with file-level validation, enabling faster feedback loops for developers and blocking builds on violations (via --exit-code-on-failure).
  • Legacy Code Modernization: Use the baseline command to gradually enforce coverage on legacy files by setting temporary lower thresholds (e.g., min="70" for src/Legacy/), then incrementally raising them.
  • Compliance & Audits: Generate Checkstyle/GitLab-compatible reports for internal audits or third-party compliance (e.g., SOC 2, ISO 27001), where granular coverage metrics are required.
  • Developer Productivity: Reduce false positives in global coverage reports by excluding low-priority files (e.g., ignore-uncovered-methods for utility classes) while maintaining strict rules for high-impact areas.
  • Roadmap Prioritization:
    • Phase 1: Pilot in high-risk modules (e.g., payment processing, auth) with min="100".
    • Phase 2: Roll out directory-based rules (e.g., src/Api/ = 95%, src/Jobs/ = 85%).
    • Phase 3: Integrate with code review tools (e.g., GitHub/GitLab merge checks) using the GitLab format output.

When to Consider This Package

  • Adopt if:

    • Your team struggles with global coverage percentages masking under-covered critical files (e.g., a single file at 0% coverage inflates overall metrics).
    • You need fine-grained control over coverage thresholds (e.g., 100% for security layers, 80% for utilities).
    • Your CI/CD pipeline lacks actionable coverage feedback (e.g., no file-level breakdowns in reports).
    • You’re migrating legacy code and need gradual enforcement (baseline command).
    • You require compliance-ready reports (Checkstyle/GitLab formats for audits).
  • Look elsewhere if:

    • Your team doesn’t prioritize coverage (this tool enforces discipline).
    • You’re using Java/Kotlin (consider JaCoCo or similar).
    • Your project is small-scale (<5K LOC) with homogeneous coverage needs (global thresholds suffice).
    • You lack PHP 8.1+ or PHPUnit in your stack.
    • You need real-time IDE integration (e.g., PHPStorm plugins) rather than CLI-based checks.

How to Pitch It (Stakeholders)

For Executives:

*"This tool lets us enforce surgical precision in code quality—no more hiding under-covered critical files behind high-level metrics. By setting per-file coverage thresholds, we can:

  • Protect high-risk areas (e.g., payments, auth) with 100% coverage while allowing flexibility for low-priority code.
  • Unblock legacy modernization by gradually raising coverage standards via the baseline feature.
  • Automate compliance reporting with GitLab/Checkstyle outputs for audits. Investment: Minimal (open-source, MIT-licensed). ROI: Fewer production bugs, faster audits, and happier devs with clear quality rules."*

For Engineering Leaders:

*"This replaces vague ‘80% coverage’ goals with actionable, file-level enforcement. Key wins:

  • CI/CD Integration: Fails builds on specific under-covered files, not just global stats. Example:
    php vendor/bin/phpfci inspect coverage.xml --exit-code-on-failure
    
  • Legacy Love: Use the baseline command to temporarily lower thresholds for old code, then ramp up:
    php vendor/bin/phpfci baseline old_coverage.xml --config phpfci.xml
    
  • Developer Empowerment: Configurable rules let teams exclude utility files while keeping strict rules for core logic. Example config:
    <directory path="src/Core/" min="100"/>
    <file path="src/Helpers/StringHelper.php" min="50"/>
    

Effort: 1–2 hours to configure. Impact: Fewer ‘oops’ in production, clearer quality standards."*

For Developers:

*"Tired of global coverage hiding your under-tested files? This tool:

  • Shows exactly which files/methods are missing tests (with method names!).
  • Lets you set rules per file/directory (e.g., src/Api/ = 95%, src/Jobs/ = 80%).
  • Works with your existing PHPUnit setup—just add it to composer.json:
    composer require --dev digitalrevolution/phpunit-file-coverage-inspection
    
  • Integrates with GitLab/CI for automated checks. Example workflow:
    # .gitlab-ci.yml
    test:
      script:
        - php vendor/bin/phpfci inspect coverage.xml --reportGitlab=gl-coverage.json
    ```"*
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky