Can you suggest some method of converting PHP Code Sniffer XML report into HTML page(s). I guess I might need some XSLT translation… Thanks in advance for the advice.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Few days ago I posted XSLT stylesheet on my blog: http://phpdojo.blogspot.com/2010/12/converting-phpcodesniffer-xml-report.html including new type of report: xsl.
回答2:
Just to add: If you run phpcs through Jenkins, then you can output the report in 'checkstyle' format.
phpcs --report=checkstyle --report-file=/phpcs/out.xml
Then configure your Jenkins job to parse the output using that file.
Here's the plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin
Here's some output samples:
回答3:
XSLT is quite cumbersome to write, very few people I know can do it well; you can instead parse the XML in a PHP script and spit out HTML.
CodeSniffer can also output its report as a CSV file - if that's easier for you to parse, use that instead.