1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Remove severity options from some linters.

Summary: The `ArcanistGeneratedLinter` and `ArcanistNoLintLinter` don't actually ever raise any linter messages, so it doesn't make sense to set custom severities for these linters. Instead, don't expose this configuration.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9038
This commit is contained in:
Joshua Spence 2014-05-11 19:28:26 -07:00 committed by epriestley
parent 7870e7f2e4
commit 9bd740b1f8
4 changed files with 29 additions and 0 deletions

View file

@ -95,4 +95,8 @@ final class ArcanistConduitLinter extends ArcanistLinter {
'ArcanistConduitLinter does not support a name map.'
);
}
protected function canCustomizeLintSeverities() {
return false;
}
}

View file

@ -28,6 +28,10 @@ final class ArcanistGeneratedLinter extends ArcanistLinter {
return 'generated';
}
protected function canCustomizeLintSeverities() {
return false;
}
public function lintPath($path) {
$data = $this->getData($path);
if (preg_match('/@'.'generated/', $data)) {

View file

@ -355,6 +355,10 @@ abstract class ArcanistLinter {
}
public function getLinterConfigurationOptions() {
if (!$this->canCustomizeLintSeverities()) {
return array();
}
return array(
'severity' => 'optional map<string|int, string>',
'severity.rules' => 'optional map<string, string>',
@ -372,6 +376,10 @@ abstract class ArcanistLinter {
switch ($key) {
case 'severity':
if (!$this->canCustomizeLintSeverities()) {
break;
}
$custom = array();
foreach ($value as $code => $severity) {
if (empty($sev_map[$severity])) {
@ -388,7 +396,12 @@ abstract class ArcanistLinter {
$this->setCustomSeverityMap($custom);
return;
case 'severity.rules':
if (!$this->canCustomizeLintSeverities()) {
break;
}
foreach ($value as $rule => $severity) {
if (@preg_match($rule, '') === false) {
throw new Exception(
@ -412,6 +425,10 @@ abstract class ArcanistLinter {
throw new Exception("Incomplete implementation: {$key}!");
}
protected function canCustomizeLintSeverities() {
return true;
}
protected function shouldLintBinaryFiles() {
return false;
}

View file

@ -28,6 +28,10 @@ final class ArcanistNoLintLinter extends ArcanistLinter {
return 'nolint';
}
protected function canCustomizeLintSeverities() {
return false;
}
public function lintPath($path) {
$data = $this->getData($path);
if (preg_match('/@'.'nolint/', $data)) {