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
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
相关文章推荐
- php通过文件头检测文件类型通用代码类(zip,rar等)
- PHP+AJAX实现无刷新注册(带用户名实时检测)代码
- Mercurial (hg) Hook : PHP Syntax Check , hg 代码检测 钩子
- PHP 检测手机浏览器的代码
- php getimagesize 上传图片的长度和宽度检测代码
- 检测Monxin子程序升级包的完整性 Monxin专用(PHP代码函数)
- 利用PHP实现智能文件类型检测的实现代码
- 检测Monxin子程序使用权限 Monxin专用(PHP代码函数)
- PHP 安全检测代码片段
- php的单元检测和代码依赖性检测
- php批量检测并去除BOM头的代码
- PHP检测链接是否存在的代码实例分享
- 通达OA公共代码 php常用检测函数
- PHP检测每一段代码执行时间
- 简单的移动设备检测PHP脚本代码
- PHP 检测手机浏览器的代码
- php getimagesize 上传图片的长度和宽度检测代码
- 检测Monxin子程序安装包的完整性 Monxin专用(PHP代码函数)