2014-02-12 132 views
0

開始使用jenkin for php項目。如何爲php項目的checkstyle配置jenkin

下列步驟已被配置 1)下載安裝詹-1.549 2)PHP插件CheckStyle的 3)加入一個項目樣品zf2demo

的build.xml在ZF2演示

<target name="phpcs" > 
    <exec executable="phpcs"> 
    <arg line="--report=checkstyle 
--report-file=${project.basedir}/build/logs/checkstyle.xml 
--standard=Zend 
${project.basedir}/*.php" /> 
    </exec> 
</target> 

phpcs .xml in zf2demo/build

<ruleset name="zenddemo"> 
<description>Description of your coding standard</description> 

<rule ref="Generic.PHP.DisallowShortOpenTag"/> 
<!-- ... --> 
</ruleset> 

構建成功運行 錯誤 找不到報告文件。配置錯誤?

在哪裏配置報告文件?我們是否需要手動創建它

什麼更需要配置生成報告?

在配置部分添加 生成後操作 發佈Checkstyle的分析結果

Checkstyle results 

'/build/checkstyle.xml' 不匹配任何東西: '' 存在,但不是「/編譯/ checkstyle.xml'

如何配置這些? 編輯 當從控制檯enter image description here

回答

0

去蓋,檢查控制檯輸出運行[RAW] 什麼是phpcs的結果呢?任何錯誤?

phpcs: 
    [exec] Result: 1 

如果您運行phpcs前端控制檯直接提供的參數是否生成報告文件?

+0

FILE:C:\ wamp \ www \ zenddemo \ index.php -------------------------------- ------------------------------------------------ FOUND 2錯誤(S)影響2行(S) -------------------------------------- ------------------------------------------ 1 |錯誤|行尾字符無效;預計「\ n」但發現「\ r \ n」 2 |錯誤|缺少文件的文檔註釋 --------------------------------------------- -----------------------------------檢查一個文件index.php從控制檯得到的結果是as以上 – guny

+0

您應該使用build config中的所有選項運行phpcs,即 - report,--report-file,--standard = Zend。並檢查是否創建了reportfile – ishenkoyv

+0

報告文件通過命令行正確生成。在Checkstyle結果配置中我們是否需要定義任何文件路徑中的\t?在項目配置或類似的東西我缺少 – guny