提问人:edorian 提问时间:10/28/2010 最后编辑:hakreedorian 更新时间:6/17/2014 访问量:13280
如何为 php 代码嗅探器调用自定义规则集.xml
How to call a custom ruleset.xml for php code sniffer
问:
我正在尝试为 php 代码嗅探器编写自定义规则集 .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
如果这不起作用:关于如何随源代码一起发布您自己的编码标准的任何建议?谢谢
答:
15赞
Gordon
10/28/2010
#1
您至少需要 Code Sniffer 版本 1.3.0a1 才能使用带注释的规则集:
- 所有 CodingStandard.php 文件都已替换为 ruleset.xml 文件
自定义标准需要转换为这种新格式才能继续工作- 您可以使用命令行参数指定自己的自定义规则集 .xml 文件的路径 例如,
--standard
phpcs --standard=/path/to/my/ruleset.xml
在此之前,您必须复制规则集,如本教程中所述。
上一个:PHPUnit 的代码覆盖率
评论