0

我对詹金斯完全陌生,不知道如何创建质量检查报告。我使用带有 checkstyle、PMD 和 PHP 复制粘贴检测器的 jenkins。构建运行并成功完成。控制台的输出是:

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

如果我查看我的构建目录,就会有复制粘贴和 pmd 工具的日志。但是缺少检查样式。

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

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

build/logs/checkstyle.xml

但下面有错误消息 * build/logs/checkstyle.xml not found: 'build' exists, but not build/logs/checkstyle.xml *

PMD 和 cops paste 也是如此。在成功构建后的概述中,它告诉我,没有发现任何警告。Rh 创建的日志文件包含警告。

那么如何让 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
4

0 回答 0