Jenkins:Checkstyle,PMD,复制粘贴检测器报告

时间:2013-11-08 09:46:52

标签: php jenkins report checkstyle

我对詹金斯完全不熟悉,也不知道如何制作质量保证报告。 我使用jenkins与checkstyle,PMD和PHP的复制粘贴检测器。构建运行并成功完成。控制台的输出是:

BUILD SUCCESSFUL
Total time: 31 seconds
[CHECKSTYLE] Collecting checkstyle analysis files...
[CHECKSTYLE] Finding all files that match the pattern build/logs/checkstyle.xml
[CHECKSTYLE] Computing warning deltas based on reference build #54
[PMD] Collecting PMD analysis files...
[PMD] Finding all files that match the pattern build/logs/pmd.xml
[PMD] Computing warning deltas based on reference build #54
[DRY] Collecting duplicate code analysis files...
[DRY] Finding all files that match the pattern build/logs/pmd-cpd.xml
[DRY] Computing warning deltas based on reference build #54
[JDepend] JDepend plugin is ready
[JDepend] Found 81 classes in 23 packages
Finished: SUCCESS

如果我查看构建目录,则会有copy-paste和pmd工具的日志。但是缺少checkstyle。

我的构建文件来自本教程:jenkins-php tutorial

在我的作业配置中,后期构建操作列出了所有工具。但是显示出我无法解决的错误。在构建后的操作中,我必须说出生成输出文件的位置。所以对于checkstyle,我有

build/logs/checkstyle.xml

但是下面有错误信息 *找不到 build / logs / checkstyle.xml:'build'存在,但不存在build / logs / checkstyle.xml *

与PMD和警察粘贴相同。在成功构建之后的概述中,它告诉我,没有找到警告。 Rhe创建的日志文件包含警告。

那么如何让jenkins使用创建的报告文件?

修改

遵循我的build.xml的checkstyle行

<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
  <exec executable="phpcs">
   <arg value="--standard=${basedir}/build/phpcs.xml"/>
   <arg path="${basedir}/project"/>
  </exec>
 </target>

 <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
  <exec executable="phpcs" output="/dev/null">
   <arg value="--report=checkstyle"/>
   <arg value="--report-file=${basedir}/build/logs/checkstyle.xml"/>
   <arg value="--standard=${basedir}/build/phpcs.xml"/>
   <arg path="${basedir}/project"/>
  </exec>
 </target>

如果我运行phpcs手册,我会得到这个:

PHP Notice:  Undefined offset: -1 in /usr/share/php/PHP/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php on line 186
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:37
PHP   3. PHP_CodeSniffer->process() /usr/share/php/PHP/CodeSniffer/CLI.php:558
PHP   4. PHP_CodeSniffer->processFile() /usr/share/php/PHP/CodeSniffer.php:504
PHP   5. PHP_CodeSniffer->_processFile() /usr/share/php/PHP/CodeSniffer.php:1258
PHP   6. PHP_CodeSniffer_File->start() /usr/share/php/PHP/CodeSniffer.php:1380
PHP   7. PEAR_Sniffs_Functions_FunctionCallSignatureSniff->process() /usr/share/php/PHP/CodeSniffer/File.php:490
PHP   8. PEAR_Sniffs_Functions_FunctionCallSignatureSniff->processMultiLineCall() /usr/share/php/PHP/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php:113

0 个答案:

没有答案