]> khamidou — GitHub mirrors - arcanist.git/commitdiff
get jshint error codes
authorTal Shiri <tal@sookasa.com>
Fri, 4 Oct 2013 13:29:47 +0000 (06:29 -0700)
committerepriestley <git@epriestley.com>
Fri, 4 Oct 2013 13:29:47 +0000 (06:29 -0700)
Summary:
makes jshint slightly more useful by printing out error numbers. I love memorizing numbers.
Sorry about the crappy getLintMessageName(). There was no list of error names, just the long descriptions that are already rendered as 'reason'.

Test Plan: Verify that the numbers are mezmorizing. Been tested on OSX with jshint v2.1.11

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran
Differential Revision: https://secure.phabricator.com/D7213

src/lint/linter/ArcanistJSHintLinter.php
src/lint/linter/reporter.js

index ef25346dc8a56855500ce3d8355727e3c2999a1a..1392b5e97c125281659ba85855570f1f66b5aa7e 100644 (file)
@@ -54,6 +54,12 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
     );
   }
 
+  // placeholder if/until we get a map code -> name map
+  // jshint only offers code -> description right now (parsed as 'reason')
+  public function getLintMessageName($code) {
+    return "JSHint".$code;
+  }
+
   public function getLintNameMap() {
     return array(
       self::JSHINT_ERROR => "JSHint Error"
@@ -163,7 +169,7 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
       $this->raiseLintAtLine(
         $err->line,
         $err->col,
-        self::JSHINT_ERROR,
+        $err->code,
         $err->reason);
     }
   }
index b34bd73699c862ae4368dff90c8b844baf123774..768d63935fd53399c769b74bfdb86569032add96 100644 (file)
@@ -4,12 +4,12 @@ module.exports = {
 
         results.forEach(function (result) {
             var error = result.error;
-
             report.push({
-                'file': result.file,
-                'line': error.line,
-                'col': error.character,
-                'reason': error.reason
+                'file'  : result.file,
+                'line'  : error.line,
+                'col'   : error.character,
+                'reason': error.reason,
+                'code'  : error.code,
             });
         });