mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-11 07:11:03 +01:00
Minor tidying of the ArcanistPuppetLintLinter
class
Summary: Self-explanatory. Test Plan: `arc unit` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11317
This commit is contained in:
parent
ce7e8f28f5
commit
50a5d54e71
1 changed files with 40 additions and 33 deletions
|
@ -7,18 +7,19 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
|
||||||
|
|
||||||
private $config;
|
private $config;
|
||||||
|
|
||||||
public function getInfoURI() {
|
|
||||||
return 'http://puppet-lint.com/';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getInfoName() {
|
public function getInfoName() {
|
||||||
return 'puppet-lint';
|
return 'puppet-lint';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getInfoURI() {
|
||||||
|
return 'http://puppet-lint.com/';
|
||||||
|
}
|
||||||
|
|
||||||
public function getInfoDescription() {
|
public function getInfoDescription() {
|
||||||
return pht(
|
return pht(
|
||||||
'Use `puppet-lint` to check that your Puppet manifests conform to '.
|
'Use `%s` to check that your Puppet manifests '.
|
||||||
'the style guide.');
|
'conform to the style guide.',
|
||||||
|
'puppet-lint');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLinterName() {
|
public function getLinterName() {
|
||||||
|
@ -46,7 +47,9 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInstallInstructions() {
|
public function getInstallInstructions() {
|
||||||
return pht('Install puppet-lint using `gem install puppet-lint`.');
|
return pht(
|
||||||
|
'Install puppet-lint using `%s`.',
|
||||||
|
'gem install puppet-lint');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldExpectCommandErrors() {
|
public function shouldExpectCommandErrors() {
|
||||||
|
@ -86,10 +89,11 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
|
||||||
case 'puppet-lint.config':
|
case 'puppet-lint.config':
|
||||||
$this->config = $value;
|
$this->config = $value;
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
default:
|
||||||
return parent::setLinterConfigurationValue($key, $value);
|
return parent::setLinterConfigurationValue($key, $value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getDefaultFlags() {
|
protected function getDefaultFlags() {
|
||||||
$options = array();
|
$options = array();
|
||||||
|
@ -103,18 +107,22 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
|
||||||
|
|
||||||
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
||||||
$lines = phutil_split_lines($stdout, false);
|
$lines = phutil_split_lines($stdout, false);
|
||||||
|
|
||||||
$messages = array();
|
$messages = array();
|
||||||
|
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
$matches = explode('|', $line, 5);
|
$matches = explode('|', $line, 5);
|
||||||
|
|
||||||
if (count($matches) === 5) {
|
if (count($matches) < 5) {
|
||||||
$message = new ArcanistLintMessage();
|
continue;
|
||||||
$message->setPath($path);
|
}
|
||||||
$message->setLine($matches[0]);
|
|
||||||
$message->setChar($matches[1]);
|
$message = id(new ArcanistLintMessage())
|
||||||
$message->setName(ucwords(str_replace('_', ' ', $matches[3])));
|
->setPath($path)
|
||||||
$message->setDescription(ucfirst($matches[4]));
|
->setLine($matches[0])
|
||||||
|
->setChar($matches[1])
|
||||||
|
->setCode($this->getLinterName())
|
||||||
|
->setName(ucwords(str_replace('_', ' ', $matches[3])))
|
||||||
|
->setDescription(ucfirst($matches[4]));
|
||||||
|
|
||||||
switch ($matches[2]) {
|
switch ($matches[2]) {
|
||||||
case 'warning':
|
case 'warning':
|
||||||
|
@ -132,7 +140,6 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
|
||||||
|
|
||||||
$messages[] = $message;
|
$messages[] = $message;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($err && !$messages) {
|
if ($err && !$messages) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue