store errors from parallel-lint as build_meta (key "phplint-errors");

add them to the "Quality Trend" graph on the build view
This commit is contained in:
Alexander Wenzel 2013-11-13 19:55:45 +01:00
commit 801cc8ee5e
2 changed files with 27 additions and 4 deletions

View file

@ -25,6 +25,11 @@ class PhpParallelLint implements \PHPCI\Plugin
*/
protected $phpci;
/**
* @var \PHPCI\Model\Build
*/
protected $build;
/**
* @var string
*/
@ -37,11 +42,15 @@ class PhpParallelLint implements \PHPCI\Plugin
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $path . $options['directory'] : $path;
$this->build = $build;
$this->directory = $phpci->buildPath;
$this->ignore = $this->phpci->ignore;
if (isset($options['directory'])) {
$this->directory = $options['directory'];
}
if (isset($options['ignore'])) {
$this->ignore = $options['ignore'];
}
@ -68,6 +77,13 @@ class PhpParallelLint implements \PHPCI\Plugin
$this->directory
);
$output = $this->phpci->getLastOutput();
$matches = array();
if (preg_match_all('/Parse error\:/', $output, $matches)) {
$this->build->storeMeta('phplint-errors', count($matches[0]));
}
return $success;
}