[英]How to exclude everything except some directories from PHP Code Sniffer inspections in .phpcs.xml?
我想在我的項目中從PHP Code Sniffer
檢查中排除除某些目錄之外的所有內容。 類似於 git 回購排除與.gitignore
我的想法是帶有負前瞻的regex
可以與<exclude-pattern
> 一起使用。 我試過了:
<exclude-pattern>^(?!wp-content\/plugins\/customplugin\/*$|wp-content\/themes\/customtheme\/*$).+</exclude-pattern>
因此,我希望 PHPCS 只掃描wp-content/plugins/customplugin/
和wp-content/themes/customtheme/
。 不幸的是,它不起作用:
Registering sniffs in the Project standard... DONE (138 sniffs registered)
Creating file list... DONE (0 files in queue)
如何以正確的方式實現這一目標?
為了達到預期的目的,我們必須修改正則表達式:
<exclude-pattern>^(?!.*\/wp-content\/plugins\/customplugin|.*\/wp-content\/themes\/customtheme).*</exclude-pattern>
請注意,由於 CodeSniffer 存儲庫中的此票證,將來可能以不同的方式解決此問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.