WordPress / plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
https://wordpress.org/plugins/plugin-check/
GNU General Public License v2.0
240 stars 46 forks source link

Requires related plugin header check in readme #405

Closed ernilambar closed 3 months ago

ernilambar commented 8 months ago

Related: https://github.com/WordPress/plugin-check/issues/198

For following two headers, we accept fields either in readme file or main plugin file.

We could raise ERROR or WARNING if those fields are missing from both files.

It seems preference is given to plugin file header. May be we could create separate Check instead of keeping inside plugin_readme check.

ernilambar commented 8 months ago

@foosantos Please provide confirmation on this one also.

swissspidy commented 8 months ago

Some context:

Since WordPress 5.8, plugin readme files are not parsed for requirements. This means that, in core, Requires PHP and Requires at least are always parsed from plugin’s main PHP file. The place for the Tested up to header remains in readme.txt for the time being, as it's not used by WordPress core.

IMHO these headers are not mandatory and should never trigger an error. Not sure they should even trigger a warning, after all they are optional.

What could be useful to check is that Requires PHP and Requires at least (if present) follow the right format. These should be numbers only, so 7.0 and not PHP 7.0. Or 6.5 and not WP 6.5.

ernilambar commented 8 months ago

In the readme validator, message is shown in Notes like:

The Requires at least field is missing. It should be defined here, or in your main plugin file.
The Requires PHP field is missing. It should be defined here, or in your main plugin file.

There is should in the message. So I assumed it is required. May be it is required in the directory?

Screenshot 2024-01-30 at 2 28 38 PM

swissspidy commented 3 months ago

There is should in the message. So I assumed it is required. May be it is required in the directory?

I think this is just outdated. Again, all the data is parsed from the main plugin file.

ernilambar commented 3 months ago

Closing this for now. We can reopen in the future if needed.