]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix CPP Lint severity
authorepriestley <git@epriestley.com>
Tue, 19 May 2015 14:58:24 +0000 (07:58 -0700)
committerepriestley <git@epriestley.com>
Tue, 19 May 2015 14:58:59 +0000 (07:58 -0700)
Summary: Currently all CPPLint issues are hard-coded to warning level, which prevents customising the severity in .arclint. Change to pick up the configured severity. Note that getLintMessageSeverity will call getDefaultMessageSeverity if nothing is configured for that error category.

Test Plan: Tested manually to confirm configured categories display with the correct severity and that non-configured ones return with the default severity (ERROR).

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9682

src/lint/linter/ArcanistCpplintLinter.php

index 3587131d885d6b96088b83087062c4d8129e4dc9..a3c5ca00ed9989a9d52bccb0038949d307a19b3a 100644 (file)
@@ -35,6 +35,10 @@ final class ArcanistCpplintLinter extends ArcanistExternalLinter {
     return $this->getDeprecatedConfiguration('lint.cpplint.options', array());
   }
 
+  protected function getDefaultMessageSeverity($code) {
+    return ArcanistLintSeverity::SEVERITY_WARNING;
+  }
+
   protected function parseLinterOutput($path, $err, $stdout, $stderr) {
     $lines = explode("\n", $stderr);
 
@@ -49,13 +53,16 @@ final class ArcanistCpplintLinter extends ArcanistExternalLinter {
       foreach ($matches as $key => $match) {
         $matches[$key] = trim($match);
       }
+
+      $severity = $this->getLintMessageSeverity($matches[3]);
+
       $message = new ArcanistLintMessage();
       $message->setPath($path);
       $message->setLine($matches[1]);
       $message->setCode($matches[3]);
       $message->setName($matches[3]);
       $message->setDescription($matches[2]);
-      $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
+      $message->setSeverity($severity);
 
       $messages[] = $message;
     }