]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Minor improvements to `ArcanistJSONLinter`
authorJoshua Spence <josh@joshuaspence.com>
Sun, 11 Jan 2015 19:40:40 +0000 (06:40 +1100)
committerJoshua Spence <josh@joshuaspence.com>
Sun, 11 Jan 2015 19:40:40 +0000 (06:40 +1100)
Summary: Self-explanatory.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

src/lint/linter/ArcanistJSONLinter.php

index ff03a8c38f38a79d5189de8b58158840e16d1dfc..f6727032746be9f725f1dac8bbda05a9f2d000dc 100644 (file)
@@ -5,6 +5,8 @@
  */
 final class ArcanistJSONLinter extends ArcanistLinter {
 
+  const LINT_PARSE_ERROR = 1;
+
   public function getInfoName() {
     return 'JSON Lint';
   }
@@ -21,17 +23,26 @@ final class ArcanistJSONLinter extends ArcanistLinter {
     return 'json';
   }
 
+  public function getLintNameMap() {
+    return array(
+      self::LINT_PARSE_ERROR => pht('Parse Error'),
+    );
+  }
+
+  protected function canCustomizeLintSeverities() {
+    return false;
+  }
+
   public function lintPath($path) {
     $data = $this->getData($path);
 
     try {
-      $parser = new PhutilJSONParser();
-      $parser->parse($data);
+      id(new PhutilJSONParser())->parse($data);
     } catch (PhutilJSONParserException $ex) {
       $this->raiseLintAtLine(
         $ex->getSourceLine(),
         $ex->getSourceChar(),
-        $this->getLinterName(),
+        self::LINT_PARSE_ERROR,
         $ex->getMessage());
     }
   }