I would like to exclude everything except some directories from PHP Code Sniffer
inspection in my project. Something similar like git repo exclusions with .gitignore
I had the idea that regex
with negative lookahead could be used with <exclude-pattern
>. I tried:
<exclude-pattern>^(?!wp-content\/plugins\/customplugin\/*$|wp-content\/themes\/customtheme\/*$).+</exclude-pattern>
Consequently, I expected PHPCS to only scan the wp-content/plugins/customplugin/
and wp-content/themes/customtheme/
. Unfortunately it doesn't work:
Registering sniffs in the Project standard... DONE (138 sniffs registered)
Creating file list... DONE (0 files in queue)
How to achieve this in the right way?