php codesniffer 安装,Centos6.6安装PHP_CodeSniffer

丘浩宕
2023-12-01

安装:

pear install PHP_CodeSniffer 查看安装

[root@vb002 ~]# /usr/local/php/bin/phpcs -i

The installed coding standards are PSR1, Squiz, PHPCS, MySource, PEAR, Zend and PSR2

检查代码

[root@vb002 ~]# /usr/local/php/bin/phpcs /root/.jenkins/jobs/zentaotest/workspace/src/Money.php

FILE: /root/.jenkins/jobs/zentaotest/workspace/src/Money.php

----------------------------------------------------------------------

FOUND 6 ERRORS AFFECTING 6 LINES

----------------------------------------------------------------------

2 | ERROR | Missing file doc comment

3 | ERROR | Missing class doc comment

5 | ERROR | Private member variable "amount" must be prefixed with

| | an underscore

7 | ERROR | Missing function doc comment

12 | ERROR | Missing function doc comment

17 | ERROR | Missing function doc comment

----------------------------------------------------------------------

Time: 29ms; Memory: 3Mb 卸载安装

[root@vb002 ~]# pear uninstall PHP_CodeSniffer-2.3.3

参考链接:

http://nonfu.me/p/3886.html

http://blog.csdn.net/xinhaozheng/article/details/3324796

http://pear.php.net/manual/en/package.php.php-codesniffer.php

=====================

一些思路和想法:

1.定期检查提交的代码;

2.手动检查提交的代码。可以手动触发;

3.能够统计到测试代码的测试结果;

 类似资料: