]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Remove severity options from some linters.
authorJoshua Spence <josh@joshuaspence.com>
Mon, 12 May 2014 02:28:26 +0000 (19:28 -0700)
committerepriestley <git@epriestley.com>
Mon, 12 May 2014 02:28:27 +0000 (19:28 -0700)
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

src/lint/linter/ArcanistConduitLinter.php
src/lint/linter/ArcanistGeneratedLinter.php
src/lint/linter/ArcanistLinter.php
src/lint/linter/ArcanistNoLintLinter.php

index 2618ea995778d1665ea1173f0bd75f5fa6371895..5a7a67a23f7671ca76e12af69fc846b0d840c41b 100644 (file)
@@ -95,4 +95,8 @@ final class ArcanistConduitLinter extends ArcanistLinter {
       'ArcanistConduitLinter does not support a name map.'
     );
   }
+
+  protected function canCustomizeLintSeverities() {
+    return false;
+  }
 }
index 7cf904504b9e4ef2f61932cb296c820faf4a01c7..29c1e80975f45fa8f2daab11a68786a611487c9b 100644 (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)) {
index e8847512daf434a47a2775a02cd23331d4917209..ae40eb9036bab4f7feb883cad2c812e7088786da 100644 (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;
   }
index 67ef69220ddc836220c9bc4d97dab91618df3bfb..e219103f9a8042593b2ca4029d057571370002de 100644 (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)) {