您的位置:首页 > 编程语言 > PHP开发

PHP代码规范性检测

2017-08-29 10:30 399 查看
安装
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: