diff --git a/src/lint/linter/ArcanistConduitLinter.php b/src/lint/linter/ArcanistConduitLinter.php --- a/src/lint/linter/ArcanistConduitLinter.php +++ b/src/lint/linter/ArcanistConduitLinter.php @@ -95,4 +95,8 @@ 'ArcanistConduitLinter does not support a name map.' ); } + + protected function canCustomizeLintSeverities() { + return false; + } } diff --git a/src/lint/linter/ArcanistGeneratedLinter.php b/src/lint/linter/ArcanistGeneratedLinter.php --- a/src/lint/linter/ArcanistGeneratedLinter.php +++ b/src/lint/linter/ArcanistGeneratedLinter.php @@ -28,6 +28,10 @@ return 'generated'; } + protected function canCustomizeLintSeverities() { + return false; + } + public function lintPath($path) { $data = $this->getData($path); if (preg_match('/@'.'generated/', $data)) { diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php --- a/src/lint/linter/ArcanistLinter.php +++ b/src/lint/linter/ArcanistLinter.php @@ -355,6 +355,10 @@ } public function getLinterConfigurationOptions() { + if (!$this->canCustomizeLintSeverities()) { + return array(); + } + return array( 'severity' => 'optional map', 'severity.rules' => 'optional map', @@ -372,6 +376,10 @@ switch ($key) { case 'severity': + if (!$this->canCustomizeLintSeverities()) { + break; + } + $custom = array(); foreach ($value as $code => $severity) { if (empty($sev_map[$severity])) { @@ -388,7 +396,12 @@ $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 @@ throw new Exception("Incomplete implementation: {$key}!"); } + protected function canCustomizeLintSeverities() { + return true; + } + protected function shouldLintBinaryFiles() { return false; } diff --git a/src/lint/linter/ArcanistNoLintLinter.php b/src/lint/linter/ArcanistNoLintLinter.php --- a/src/lint/linter/ArcanistNoLintLinter.php +++ b/src/lint/linter/ArcanistNoLintLinter.php @@ -28,6 +28,10 @@ return 'nolint'; } + protected function canCustomizeLintSeverities() { + return false; + } + public function lintPath($path) { $data = $this->getData($path); if (preg_match('/@'.'nolint/', $data)) {