安装:
pear install PHP_CodeSniffer
查看安装
[[email protected] ~]# /usr/local/php/bin/phpcs -i The installed coding standards are PSR1, Squiz, PHPCS, MySource, PEAR, Zend and PSR2
检查代码
[[email protected] ~]# /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
卸载安装
[[email protected] ~]# pear uninstall PHP_CodeSniffer-2.3.3
参考文献:
http://nonfu.me/p/3886.html
时间: 2024-10-07 04:46:45