Log output when reports fail to process
This commit is contained in:
parent
967e75e568
commit
da3dba0939
|
@ -157,7 +157,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
);
|
||||
|
||||
$output = $this->phpci->getLastOutput();
|
||||
list($errors, $warnings, $data) = $this->processReport(json_decode(trim($output), true));
|
||||
list($errors, $warnings, $data) = $this->processReport($output);
|
||||
|
||||
$this->phpci->logExecOutput(true);
|
||||
|
||||
|
@ -198,9 +198,12 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
return array($ignore, $standard, $suffixes);
|
||||
}
|
||||
|
||||
protected function processReport($data)
|
||||
protected function processReport($output)
|
||||
{
|
||||
$data = json_decode(trim($output), true);
|
||||
|
||||
if (!is_array($data)) {
|
||||
$this->phpci->log($output);
|
||||
throw new \Exception('Could not process PHPCS report JSON.');
|
||||
}
|
||||
|
||||
|
|
|
@ -124,11 +124,12 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
}
|
||||
}
|
||||
|
||||
protected function processReport($xml)
|
||||
protected function processReport($xmlString)
|
||||
{
|
||||
$xml = simplexml_load_string($xml);
|
||||
$xml = simplexml_load_string($xmlString);
|
||||
|
||||
if ($xml === false) {
|
||||
$this->phpci->log($xmlString);
|
||||
throw new \Exception('Could not process PHPMD report XML.');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue