PHP代码规范性检测

来源:互联网 发布:淘宝远程付款靠谱吗 编辑:程序博客网 时间:2024/05/16 08:21
安装
wget -c http://static.phpmd.org/php/latest/phpmd.phar
mv phpmd.phar /usr/bin/phpmd
chmod +x /usr/bin/phpmd

使用:
# phpmd 代码路径 报告格式 规则xml文件  并使用 > 命令将问题报告输出到文件
eg:
phpmd /Library/WebServer/Documents/php/app/ html codesize,unusedcode,naming > ~/Desktop/res.html


#使用选项
zjs:php jun$ phpmd
Mandatory arguments:
1) A php source code filename or directory. Can be a comma-separated string
2) A report format
3) A ruleset filename or a comma-separated string of rulesetfilenames


Available formats: xml, text, html.
Available rulesets: cleancode, codesize, controversial, design, naming, unusedcode.


Optional arguments that may be put after the mandatory arguments:
--minimumpriority: rule priority threshold; rules with lower priority than this will not be used
--reportfile: send report output to a file; default to STDOUT
--suffixes: comma-separated string of valid source code filename extensions, e.g. php,phtml
--exclude: comma-separated string of patterns that are used to ignore directories
--strict: also report those nodes with a @SuppressWarnings annotation
--ignore-violations-on-exit: will exit with a zero code, even if any violations are found

原创粉丝点击