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
198 stars 39 forks source link

Introduce proper user-facing names for check categories #373

Closed felixarntz closed 6 months ago

felixarntz commented 6 months ago

The available check categories are currently only defined as a slug, via class constants on Check_Categories. While those slugs are the key to the functionality, the categories are also displayed to end users. Right now this is accomplished via ucfirst( str_replace( '_', ' ', $category ) ), which really isn't right. We need to use a proper i18n string for each category.

In other words, each available category should also have a label. Here's what I'd suggest:

Another related observation is that the Check_Categories::get_categories() method is unnecessarily complex, using ReflectionClass to dynamically get the class constants. I think that's a bit "too smart" and more importantly inefficient, so I think it would be better to simply return a "hard-coded" array including the class constants in there. I think it would be worth making that change here too, while we're enhancing that class anyway.

cc @mukeshpanchal27 @swissspidy @ernilambar