Repository navigation
Measure coverage of the main plugin file's top-level code - #160
Conversation
The test bootstrap loads the main plugin file before coverage starts, so its constants, class loading, and hook registrations counted as missed. New tests load the file in a separate process, where the bootstrap skips it (OAM_TEST_DEFER_PLUGIN_LOAD, set by the test's class setup): one checks the constants and hooks, one that a load during uninstall does not register the uninstall hook again. Line coverage rises from about 90% to 97%, so the CI floor rises from 85% to 94%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
| Duplication | 0 |
🟢 Coverage ∅ diff coverage · +6.84% coverage variation
Metric Results Coverage variation ✅ +6.84% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (818389c) 263 238 90.49% Head commit (cb0eced) 263 (+0) 256 (+18) 97.34% (+6.84%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#160) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Thanks for contributing to Optimizations ACE MC! Before we review:
Security Reminder
We'll review your PR soon. |
Summary
The test bootstrap loads
optimizations-ace-mc.phpbefore PHPUnit starts recording coverage. Its constants,require_oncelines and hook registrations therefore counted as missed: 13 of the file's 15 lines.tests/unit/PluginFileLoadTest.phploads the plugin file in separate processes. The bootstrap skips loading the plugin there: the test's class setup setsOAM_TEST_DEFER_PLUGIN_LOAD, and the child process inherits it.plugins_loadedhook, the uninstall hook and the coordinator instance.MINIMUM_LINE_COVERAGErises from 85 to 94.The remaining missed lines are the "stop when loaded directly" guards, one per file, which no test can run without ending the process.
Testing
composer check-all, yamllint, actionlint and gitleaks pass.🤖 Generated with Claude Code