2010-10-27 78 views
12

我正在嘗試爲php代碼嗅探器編寫一個自定義的ruleset.xml,但將它從命令行調用而不將它放入默認文件夾似乎不起作用。如何調用php代碼嗅探器的自定義ruleset.xml

Since the documentations seems to state otherwise我想問一下,如果我在這裏做得不對

:~/$ phpcs --standard=/home/edo/custom_ruleset.xml source/ 
===> 
ERROR: the "/home/edo/custom_ruleset.xml" coding standard is not installed. 
The installed coding standards are PEAR, PHPCS, Zend, Squiz and MySource 

如果不工作:如何與你的源船舶自己的編碼標準有什麼建議?由於

回答

11

需要編寫代碼的Sniffer至少version 1.3.0a1使用註釋規則集:

  • 所有CodingStandard.php文件已被替換由ruleset.xml文件
    自定義標準將需要轉換到這種新格式可以繼續工作
  • 您可以通過使用--standard命令行參數 如指定自己的自定義ruleset.xml文件的路徑,phpcs --standard=/path/to/my/ruleset.xml

在此之前,你必須copy your ruleset, as explained in this tutorial

+2

非常感謝,正是我遇到的問題 – edorian 2010-10-27 18:15:25