WPThemeReview icon indicating copy to clipboard operation
WPThemeReview copied to clipboard

[Update existing sniff] Allow register_block_style

Open carolinan opened this issue 5 years ago • 1 comments

In https://github.com/WPTRT/WPThemeReview/blob/develop/WPThemeReview/Sniffs/PluginTerritory/ForbiddenFunctionsSniff.php The sniff for regestering blocks is too strict.

The existing sniff is for 'register_block_*', so an error is shown for register_block_style(). register_block_style() is allowed in themes, so it should not cause an error.

To do:

  • [ ] Add the rule in the Theme Review handbook to the Requirements page.
  • [ ] Add the rule in the Theme Review handbook to the Recommended page.
  • [ ] Move the rule in the Theme Review handbook to the Requirements page.
  • [ ] Create unit tests
  • [ ] Create new sniff
  • [ ] Adjust existing WPCS / PHPCS sniff and send in PR upstream.
  • [ ] Add existing sniffname sniff to the ruleset.

carolinan avatar Mar 18 '20 11:03 carolinan

A PR for this is straightforward:

Check https://developer.wordpress.org/?s=register_block_&post_type%5B%5D=wp-parser-function for all the register_block_* type functions, add them manually but exclude the style one.

Thanks for noticing this 👍

dingo-d avatar Mar 18 '20 11:03 dingo-d