14

我正在尝试为 php 代码嗅探器编写自定义 ruleset.xml,但从命令行调用它而不将其放入默认文件夹似乎不起作用。

由于文档似乎另有说明,我想问一下我是否在这里做错了什么

:~/$ 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

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

4

1 回答 1

14

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

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

在此之前,您必须复制您的规则集,如本教程中所述

于 2010-10-27T17:51:40.450 回答