From 4e892e72697a8cae86078b5f64c7eaea96c073b4 Mon Sep 17 00:00:00 2001 From: Tal Shiri Date: Fri, 4 Oct 2013 06:29:47 -0700 Subject: [PATCH] get jshint error codes 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 | 8 +++++++- src/lint/linter/reporter.js | 10 +++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php index ef25346d..1392b5e9 100644 --- a/src/lint/linter/ArcanistJSHintLinter.php +++ b/src/lint/linter/ArcanistJSHintLinter.php @@ -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); } } diff --git a/src/lint/linter/reporter.js b/src/lint/linter/reporter.js index b34bd736..768d6393 100644 --- a/src/lint/linter/reporter.js +++ b/src/lint/linter/reporter.js @@ -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, }); }); -- 2.43.0