代码在识别错误​​之后退出,然后继续进行

时间:2014-10-01 12:08:05

标签: jenkins phing codesniffer

我希望codeniffer能够在CLI中生成错误输出并退出,然后再继续操作,以避免运行其他测试,如behat,phpmd,phpcpd等等。

当前代码(如下所示)创建一个XML报告,其中列出了错误,但不会终止该过程。我应该如何修改代码以获得XML报告,CLI错误输出并在出现错误时终止进程?

PHING中的当前代码:

<target name="codesniffer-phpcs">
    <echo msg="Checking coding standards ..." />
    <tstamp />
    <phpcodesniffer standard="PSR2" showWarnings="true" format="full">
        <fileset refid="sourcecode" />
        <formatter type="checkstyle" outfile="phing/phpcs/psr2_${DSTAMP}-${TSTAMP}.xml" />
    </phpcodesniffer>
</target>

这是我希望在CLI中看到以及拥有XML文件的内容:

FOUND 4 ERROR(S) AFFECTING 4 LINE(S)
--------------------------------------------------------------------------------
   69 | ERROR | There must not be more than one property declared per statement
  108 | ERROR | The abstract declaration must precede the visibility
  657 | ERROR | Expected 1 space after comma in function call; 2 found
  812 | ERROR | A cast statement must be followed by a single space
--------------------------------------------------------------------------------

1 个答案:

答案 0 :(得分:0)

我认为任务中的属性“haltonerror”将是你的朋友。 http://www.phing.info/docs/guide/stable/apcs48.html