私はジェンキンスが初めてで、QA レポートの作成方法がわかりません。私は、チェックスタイル、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
ビルド ディレクトリを見ると、コピー アンド ペーストおよび pmd ツールのログがあります。しかし、チェックスタイルがありません。
私のビルドファイルはこのチュートリアルからのものです: jenkins-php チュートリアル
私のジョブ構成では、ビルド後のアクションにすべてのツールがリストされています。しかし、解決できないエラーが表示されます。ビルド後のアクションでは、出力ファイルが生成される場所を指定する必要があります。だから私が持っているチェックスタイルのために
build/logs/checkstyle.xml
しかし、以下にエラーメッセージがあります * build/logs/checkstyle.xml not found: 'build' exists, but not build/logs/checkstyle.xml *
PMDとcopsペーストも同じです。ビルドが成功した後の概要では、警告が見つからなかったことがわかります。作成されたログ ファイルには警告が含まれています。
では、作成したレポート ファイルを使用するように 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 manual を実行すると、次のようになります。
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