[wp-trac] [WordPress Trac] #56794: Add linting for `gutenberg_*` functions

WordPress Trac noreply at wordpress.org
Thu Nov 24 13:12:07 UTC 2022


#56794: Add linting for `gutenberg_*` functions
------------------------------+-------------------------------
 Reporter:  desrosj           |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  6.2
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:  coding-standards
------------------------------+-------------------------------

Comment (by jrf):

 Replying to [comment:2 Bernhard Reiter]:
 > Replying to [comment:1 jrf]:
 > > We could possibly enable the WPCS `PrefixAllGlobals` sniff for select
 directories in Core ?
 >
 > I thought that only supported forcing the presence of a prefix (e.g. for
 a plugin)? We don't really want to mandate that every function in a given
 directory is prefixed with `wp_` (we do allow a few without that in
 Gutenberg blocks) but rather want to ban the `gutenberg_` prefix
 everywhere. Can the `PrefixAllGlobals` sniff do that?

 Correct. My response was based on @spacedmonkey mentioning enforcing the
 `wp_` prefix and for that the sniff could be turned on and the sniff would
 then flag all code in the global namespace not prefixed with `wp_` within
 the target directories (may need a minor change to make the sniff suitable
 for Core).

 >  rather want to ban the gutenberg_ prefix everywhere.

 Well, you wouldn't be able to do that in the normal CI PHPCS run, but you
 would be able to do that by using the sniff with some arbitrary prefix
 locally. Running PHPCS like that would give the person preparing the patch
 a checklist to use/verify.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56794#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list