[wp-trac] [WordPress Trac] #43150: Update Emoji build step to follow WP Coding Standards.

WordPress Trac noreply at wordpress.org
Wed Jan 24 07:50:58 UTC 2018


#43150: Update Emoji build step to follow WP Coding Standards.
------------------------------+-------------------------------
 Reporter:  peterwilsoncc     |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  5.0
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:  coding-standards
------------------------------+-------------------------------
Changes (by netweb):

 * keywords:  needs-patch => has-patch commit


Comment:

 Patch [attachment:43150.diff]  updates the formmatting within the Grunt
 `replace` emoji task .

 This change updates the Grunt task to print the array of Twemoji imported
 to match that of WordPress' PHP Coding Standards.


 Here's a truncated view of `_wp_emoji_list()` after running `grunt
 replace` using the [attachment:43150.diff] patch:

 {{{#!php
 <?php
 function _wp_emoji_list( $type = 'entities' ) {
         // Do not remove the START/END comments - they're used to find
 where to insert the arrays.

         // START: emoji arrays
         $entities = array(
 '&#x1f469;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f469;',
 '&#x1f469;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;',
 '&#x1f468;&#x200d;&#x2764;&#xfe0f;&#x200d;&#x1f48b;&#x200d;&#x1f468;',
                 ...
                 ...
                 '&#x2049;',
                 '&#x203c;',
                 '&#xe50a;',
         );
         $partials = array(
                 '&#x1f004;',
                 '&#x1f0cf;',
                 '&#x1f170;',
                 ...
                 ...
                 '&#x3297;',
                 '&#x3299;',
                 '&#xe50a;',
         );
         // END: emoji arrays
 }}}

 PHPCS Stats via: `phpcs --standard=phpcs.xml.dist --report-summary
 --report-source src/wp-includes/formatting.php -v`

 Before:
 {{{
 ----------------------------------------------------------------------------
     SOURCE
 COUNT
 ----------------------------------------------------------------------------
 [x] WordPress.Arrays.CommaAfterArrayItem.NoSpaceAfterComma
 3863
 [ ] WordPress.PHP.YodaConditions.NotYoda                               19
 [ ] Squiz.PHP.DisallowMultipleAssignments.Found                        4
 [ ] Generic.PHP.NoSilencedErrors.Discouraged                           3
 [x] WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceBeforeArrayCloser  2
 [x] WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceAfterArrayOpener   2
 [ ] WordPress.Variables.GlobalVariables.OverrideProhibited             2
 [ ] WordPress.NamingConventions.ValidVariableName.NotSnakeCase         2
 [ ] WordPress.WhiteSpace.PrecisionAlignment.Found                      2
 [ ] WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid  1
 ----------------------------------------------------------------------------
 A TOTAL OF 3900 SNIFF VIOLATIONS WERE FOUND IN 10 SOURCES
 }}}

 After:
 {{{
 PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
 ----------------------------------------------------------------------------
 SOURCE
 COUNT
 ----------------------------------------------------------------------------
 WordPress.PHP.YodaConditions.NotYoda                                   19
 Squiz.PHP.DisallowMultipleAssignments.Found                            4
 Generic.PHP.NoSilencedErrors.Discouraged                               3
 WordPress.Variables.GlobalVariables.OverrideProhibited                 2
 WordPress.NamingConventions.ValidVariableName.NotSnakeCase             2
 WordPress.WhiteSpace.PrecisionAlignment.Found                          2
 WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid      1
 ----------------------------------------------------------------------------
 A TOTAL OF 33 SNIFF VIOLATIONS WERE FOUND IN 7 SOURCES
 ----------------------------------------------------------------------------
 }}}

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


More information about the wp-trac mailing list