[wp-trac] [WordPress Trac] #49781: PHPCS config: exclude plugins and themes within src

WordPress Trac noreply at wordpress.org
Thu Apr 2 16:46:57 UTC 2020


#49781: PHPCS config: exclude plugins and themes within src
------------------------------+-------------------------------
 Reporter:  johnbillion       |       Owner:  (none)
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  5.5
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:  coding-standards
------------------------------+-------------------------------
Changes (by jrf):

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


Comment:

 @johnbillion How do those files get into the `src` directory ?
 Are there dev environment commands in place which generate those files ?
 or put them there ?

 If not and if it's dev choice to put them there (for testing purposes or
 otherwise), this could become a never-ending list as different devs use
 different tools.

 In that case, adjusting the WP Core ruleset is not the way to "fix" this.
 Instead you should add a `phpcs.xml` file to project root in your local
 environment. That file will be automatically ignored for committing, but
 should be automatically picked up by the PHPCS run.

 In that file, you'd then have something like the following:

 {{{
 <?xml version="1.0"?>
 <ruleset name="My WP Core ruleset">

         <!-- Import the main ruleset. -->
         <rule ref="./phpcs.xml.dist"/>

         <!-- ... add your own exclude rules tailored to your dev
 environment ... -->

 </ruleset>
 }}}

 Does that help ?

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


More information about the wp-trac mailing list