mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-09 06:11:01 +01:00
1b4a3e0c5e
Summary: This is in a similar vein as D14220 and sets a name on linter messages. This should handle issues from D14165. Test Plan: Run as many of the changed linters as possible + existing linter tests. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D14225
67 lines
1.5 KiB
PHP
67 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class ArcanistGoLintLinter extends ArcanistExternalLinter {
|
|
|
|
public function getInfoName() {
|
|
return 'Golint';
|
|
}
|
|
|
|
public function getInfoURI() {
|
|
return 'https://github.com/golang/lint';
|
|
}
|
|
|
|
public function getInfoDescription() {
|
|
return pht('Golint is a linter for Go source code.');
|
|
}
|
|
|
|
public function getLinterName() {
|
|
return 'GOLINT';
|
|
}
|
|
|
|
public function getLinterConfigurationName() {
|
|
return 'golint';
|
|
}
|
|
|
|
public function getDefaultBinary() {
|
|
return 'golint';
|
|
}
|
|
|
|
public function getInstallInstructions() {
|
|
return pht(
|
|
'Install Golint using `%s`.',
|
|
'go get github.com/golang/lint/golint');
|
|
}
|
|
|
|
public function shouldExpectCommandErrors() {
|
|
return false;
|
|
}
|
|
|
|
protected function canCustomizeLintSeverities() {
|
|
return true;
|
|
}
|
|
|
|
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
|
$lines = phutil_split_lines($stdout, false);
|
|
|
|
$messages = array();
|
|
foreach ($lines as $line) {
|
|
$matches = explode(':', $line, 4);
|
|
|
|
if (count($matches) === 4) {
|
|
$message = new ArcanistLintMessage();
|
|
$message->setPath($path);
|
|
$message->setLine($matches[1]);
|
|
$message->setChar($matches[2]);
|
|
$message->setCode($this->getLinterName());
|
|
$message->setName($this->getLinterName());
|
|
$message->setDescription(ucfirst(trim($matches[3])));
|
|
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ADVICE);
|
|
|
|
$messages[] = $message;
|
|
}
|
|
}
|
|
|
|
return $messages;
|
|
}
|
|
|
|
}
|