I want codesniffer to produce error output in CLI and exit before proceeding any further to avoid running other tests like behat, phpmd, phpcpd so that comes after.
Current code (as shown below) creates a XML report with errors listed in but it won't terminate the process. How should I modify the code in order to have a XML report, CLI error output and terminate the process in case of an error?
CURRENT CODE in 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>
This is what I would like to see in CLI as well as having XML file:
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
--------------------------------------------------------------------------------