Repository navigation
Improve core library file detection - #1359
superdav42 wants to merge 3 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Several jQuery-library patterns omit JavaScript extensions and therefore cannot detect ordinary library filenames.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Refines core-library detection to reduce filename-only false positives while addressing #988.
Changes:
- Adds filename and content signature matching.
- Integrates signature checks into file-type validation.
- Adds positive and regression fixtures.
| File | Description |
|---|---|
includes/Checker/Checks/Plugin_Repo/Core_Library_File_Signature_Checker.php |
Implements signature detection. |
includes/Checker/Checks/Plugin_Repo/File_Type_Check.php |
Uses the new detector. |
tests/phpunit/tests/Checker/Checks/File_Type_Check_Tests.php |
Adds regression assertions. |
tests/phpunit/testdata/plugins/test-plugin-file-type-library-core-errors/PHPMailer.php |
Adds PHPMailer signature. |
tests/phpunit/testdata/plugins/test-plugin-file-type-library-core-errors/jquery.js |
Adds jQuery signature. |
tests/phpunit/testdata/plugins/test-plugin-file-type-library-core-errors/clipboard.js |
Adds ClipboardJS fixture. |
tests/phpunit/testdata/plugins/test-plugin-file-type-library-core-without-errors/load.php |
Defines the regression plugin. |
tests/phpunit/testdata/plugins/test-plugin-file-type-library-core-without-errors/includes/PHPMailer.php |
Tests custom namespace handling. |
tests/phpunit/testdata/plugins/test-plugin-file-type-library-core-without-errors/src/utils/clipboard.js |
Tests custom clipboard code. |
tests/phpunit/testdata/plugins/test-plugin-file-type-library-core-without-errors/assets/polyfill.js |
Tests custom polyfill code. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| 'file_pattern' => '~(?:^|/)jquery\.ui\.touch-punch$~i', | ||
| 'content_patterns' => array( '~jQuery UI Touch Punch~i' ), | ||
| ), | ||
| array( | ||
| 'file_pattern' => '~(?:^|/)jquery\.hoverintent$~i', |

Summary
library_core_filesso filenames are only candidate signals, not automatic failures.clipboard.js,polyfill.js, and custom-namespacedPHPMailer.phpso they are not flagged as bundled core libraries.Fixes #988.
Testing
composer lintcomposer phpmdcomposer phpstannpm run test-php -- --filter File_Type_Check_Testsnpm run test-phpFull PHPUnit result:
OK (477 tests, 1352 assertions).aidevops.sh v3.20.61 plugin for OpenCode v1.17.6 with gpt-5.5