Added SensioLabs Security Checker Plugin. Issue #27

This commit is contained in:
Dmitry Khomutov 2017-04-04 20:59:28 +07:00
commit e3e3cf5124
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
10 changed files with 2253 additions and 1269 deletions

View file

@ -5,6 +5,7 @@ namespace PHPCensor\Plugin;
use PHPCensor;
use PHPCensor\Builder;
use PHPCensor\Model\Build;
use PHPCensor\Model\BuildError;
use PHPCensor\Plugin;
use PHPCensor\ZeroConfigPluginInterface;
@ -28,6 +29,10 @@ class PhpDocblockChecker extends Plugin implements ZeroConfigPluginInterface
protected $skipClasses = false;
protected $skipMethods = false;
/**
* @var integer
*/
protected $allowed_warnings;
/**
@ -128,8 +133,8 @@ class PhpDocblockChecker extends Plugin implements ZeroConfigPluginInterface
// Re-enable exec output logging:
$this->builder->logExecOutput(true);
$output = json_decode($this->builder->getLastOutput(), true);
$errors = count($output);
$output = json_decode($this->builder->getLastOutput(), true);
$errors = count($output);
$success = true;
$this->build->storeMeta('phpdoccheck-warnings', $errors);
@ -150,11 +155,11 @@ class PhpDocblockChecker extends Plugin implements ZeroConfigPluginInterface
{
foreach ($output as $error) {
$message = 'Class ' . $error['class'] . ' is missing a docblock.';
$severity = PHPCensor\Model\BuildError::SEVERITY_LOW;
$severity = BuildError::SEVERITY_LOW;
if ($error['type'] == 'method') {
$message = $error['class'] . '::' . $error['method'] . ' is missing a docblock.';
$severity = PHPCensor\Model\BuildError::SEVERITY_NORMAL;
$severity = BuildError::SEVERITY_NORMAL;
}
$this->build->reportError(