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
parent a0d5f4b4d8
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;
}

View file

@ -11,8 +11,9 @@ var plugin = PHPCI.UiPlugin.extend({
var query1 = PHPCI.registerQuery('phpmd-warnings', -1, {num_builds: 10, key: 'phpmd-warnings'})
var query2 = PHPCI.registerQuery('phpcs-warnings', -1, {num_builds: 10, key: 'phpcs-warnings'})
var query3 = PHPCI.registerQuery('phpcs-errors', -1, {num_builds: 10, key: 'phpcs-errors'})
var query4 = PHPCI.registerQuery('phplint-errors', -1, {num_builds: 10, key: 'phplint-errors'})
$(window).on('phpmd-warnings phpcs-warnings phpcs-errors', function(data) {
$(window).on('phpmd-warnings phpcs-warnings phpcs-errors phplint-errors', function(data) {
self.onUpdate(data);
});
@ -22,6 +23,7 @@ var plugin = PHPCI.UiPlugin.extend({
query1();
query2();
query3();
query4();
}
});
@ -67,7 +69,12 @@ var plugin = PHPCI.UiPlugin.extend({
var keys = self.keys;
for (var i in keys) {
var t = {'phpmd-warnings': 'PHPMD Warnings', 'phpcs-warnings': 'PHPCS Warnings', 'phpcs-errors': 'PHPCS Errors'};
var t = {
'phpmd-warnings': 'PHPMD Warnings',
'phpcs-warnings': 'PHPCS Warnings',
'phpcs-errors': 'PHPCS Errors',
'phplint-errors': 'PHPLint Errors'
};
titles.push(t[keys[i]]);
}