duplication-notes.md
1 month ago
flow-test-matrix.md
1 month ago
php-file-metrics.tsv
1 month ago
security-checklist-results.md
1 month ago
duplication-notes.md
29 lines
| 1 | # Duplication signals (Wave B — structural) |
| 2 | |
| 3 | ## 1. Entity abstraction family |
| 4 | |
| 5 | High churn and parallel structure across: |
| 6 | |
| 7 | - `includes/abstracts/abstract-ad.php` |
| 8 | - `includes/abstracts/abstract-group.php` |
| 9 | - `includes/abstracts/abstract-placement.php` |
| 10 | - `includes/abstracts/abstract-data.php` |
| 11 | |
| 12 | **Observation:** Shared patterns (lifecycle, meta, repositories) are expected, but repeated boilerplate across entities increases the cost of consistent security and API changes. **Recommendation:** When touching one abstract, scan siblings for the same pattern and add a shared trait or small service only if a second identical change is required (YAGNI until second use). |
| 13 | |
| 14 | ## 2. Function barrels |
| 15 | |
| 16 | `includes/functions-ad.php`, `includes/functions-group.php`, `includes/functions-placement.php` show similar churn (15 commits in 24m in snapshot). **Recommendation:** Prefer thin wrappers delegating to classes already covered by PHPUnit (`tests/Unit/*`) to shrink global surface. |
| 17 | |
| 18 | ## 3. Display / frontend checks |
| 19 | |
| 20 | `classes/display-conditions.php` and `classes/frontend_checks.php` are large and churned. **Recommendation:** Any new condition type should ship with a **PHPUnit** case near `tests/Unit/Core/` patterns before refactors. |
| 21 | |
| 22 | ## 4. Build artifact noise |
| 23 | |
| 24 | `assets/dist/*.asset.php` (1 line each) appear in churn metrics because build commits touch them. **Recommendation:** Optionally exclude `assets/dist/*.asset.php` from future metrics export, or filter in reports, so “top churn” highlights source files. |
| 25 | |
| 26 | ## Automated clone detection |
| 27 | |
| 28 | No PMD-CPD / jscpd run in this pass. **Next step:** Add optional `npm`/`composer` duplicate-finder job in CI if the team wants numeric duplication debt metrics. |
| 29 |