Allow namespaces in plugin entrypoints named after the plugin#344
Allow namespaces in plugin entrypoints named after the plugin#344kadamwhite wants to merge 2 commits into
Conversation
…heir plugin folder This is a relatively common pattern and should be allowed in the same way we permit plugin.php, above
Will cause an error (expected) because it is neither plugin.php nor named for its folder.
|
Noting here explicitly: this marks a departure from the existing coding standard requirement that plugin entry points be named In many cases the areas that our projects have organically drifted from our coding standards show reveal where we need to improve messaging or communication about why we think we should hold to a singular pattern. However, in this case I feel it is pragmatic to permit the external standard that gets used regularly in practice alongside the plugin.php convention. |
|
This original behaviour was intentional, so if we're going to change it, we should consider what and why to change our standards; that change should happen in the documented standards before/simultaneously with the standards here. Our standards require the use of a commonly-named entrypoint across our projects:
This, and other naming standards like For plugins specifically, you can call them anything you want - the same-as-directory pattern is common in the ecosystem - as WP scans for all files with a plugin header. It's also not uncommon for these directories to be renamed, either when installed by a build system or for other conflict-avoidance reasons; the directory name may also not match the repository name. The idea of picking one name here was specifically to make it predictable. Every plugin can have a
We already deviate pretty substantially from the wpcs standard, and I'd expect most plugins to fail our checks anyway - that's because we generally hold ourselves to a higher standard. In this case, it's also because we're aiming to achieve things (as noted above) that most of the ecosystem don't really care about. |
This expands the existing exceptions for "main files" (functions.php, plugin.php) to be able to recognize plugin entrypoints named after the plugin itself, e.g. query-monitor/query-monitor.php instead of
plugin.php.Supersedes #343