第一步 Git 得到待检测php文件
version=git log --pretty=format:"%H" -1 --author=yidao
author=git log --pretty=format:"%an" -1
email=git log --pretty=format:"%ae" -1
files=git diff-tree --no-commit-id --name-only -r $version | grep "Lib*" |sed -e 's/\s/,/g'
files=echo $files|sed -e 's/\s/,/g'
2 Phpmd
phpmd $files html codesize,unusedcode --reportfile build/logs/$version.html
3 Phpunit
phpunit --testsuite all
phpunit.xml基础配置之外加上
4 Mail 发邮件给开发者
邮件内容写入build/logs/mail
mail -s "PHPMD && PHPUNIT report" $email < build/logs/mail