diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -95,6 +95,8 @@ 'ArcanistJSHintLinterTestCase' => 'lint/linter/__tests__/ArcanistJSHintLinterTestCase.php', 'ArcanistJSONLintLinter' => 'lint/linter/ArcanistJSONLintLinter.php', 'ArcanistJSONLintLinterTestCase' => 'lint/linter/__tests__/ArcanistJSONLintLinterTestCase.php', + 'ArcanistJSONLinter' => 'lint/linter/ArcanistJSONLinter.php', + 'ArcanistJSONLinterTestCase' => 'lint/linter/__tests__/ArcanistJSONLinterTestCase.php', 'ArcanistJscsLinter' => 'lint/linter/ArcanistJscsLinter.php', 'ArcanistJscsLinterTestCase' => 'lint/linter/__tests__/ArcanistJscsLinterTestCase.php', 'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php', @@ -276,6 +278,8 @@ 'ArcanistJSHintLinterTestCase' => 'ArcanistArcanistLinterTestCase', 'ArcanistJSONLintLinter' => 'ArcanistExternalLinter', 'ArcanistJSONLintLinterTestCase' => 'ArcanistArcanistLinterTestCase', + 'ArcanistJSONLinter' => 'ArcanistLinter', + 'ArcanistJSONLinterTestCase' => 'ArcanistArcanistLinterTestCase', 'ArcanistJscsLinter' => 'ArcanistExternalLinter', 'ArcanistJscsLinterTestCase' => 'ArcanistArcanistLinterTestCase', 'ArcanistLandWorkflow' => 'ArcanistBaseWorkflow', diff --git a/src/lint/linter/ArcanistJSONLinter.php b/src/lint/linter/ArcanistJSONLinter.php new file mode 100644 --- /dev/null +++ b/src/lint/linter/ArcanistJSONLinter.php @@ -0,0 +1,39 @@ +getData($path); + + try { + $parser = new PhutilJSONParser(); + $parser->parse($data); + } catch (PhutilJSONParserException $ex) { + $this->raiseLintAtLine( + $ex->getSourceLine(), + $ex->getSourceChar(), + $this->getLinterName(), + $ex->getMessage()); + } + } + +} diff --git a/src/lint/linter/__tests__/ArcanistJSONLinterTestCase.php b/src/lint/linter/__tests__/ArcanistJSONLinterTestCase.php new file mode 100644 --- /dev/null +++ b/src/lint/linter/__tests__/ArcanistJSONLinterTestCase.php @@ -0,0 +1,11 @@ +executeTestsInDirectory( + dirname(__FILE__).'/jsonlint/', + new ArcanistJSONLinter()); + } + +}