From fa37d3135f3749ce22711acdb0683a23b4fec849 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 12 Jan 2015 06:40:40 +1100 Subject: [PATCH] Minor improvements to `ArcanistJSONLinter` 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 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/lint/linter/ArcanistJSONLinter.php b/src/lint/linter/ArcanistJSONLinter.php index ff03a8c3..f6727032 100644 --- a/src/lint/linter/ArcanistJSONLinter.php +++ b/src/lint/linter/ArcanistJSONLinter.php @@ -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()); } } -- 2.43.0