【问题标题】:How to call a custom ruleset.xml for php code sniffer如何为 php 代码嗅探器调用自定义 ruleset.xml
【发布时间】:2011-05-01 10:57:32
【问题描述】:

我正在尝试为 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

如果这不起作用:关于如何将您自己的编码标准与您的源代码一起提供的任何建议?谢谢

【问题讨论】:

    标签: php codesniffer phpundercontrol


    【解决方案1】:

    您至少需要 version 1.3.0a1 的 Code Sniffer 才能使用带注释的规则集:

    • 所有 CodingStandard.php 文件都已替换为 ruleset.xml 文件
      自定义标准需要转换为这种新格式才能继续工作
    • 您可以使用--standard 命令行参数指定您自己的自定义ruleset.xml 文件的路径 例如,phpcs --standard=/path/to/my/ruleset.xml

    在此之前,您必须copy your ruleset, as explained in this tutorial

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多