mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-02-03 18:38:26 +01:00
6f86866104
Summary: I found a few strings that I had missed, using a mostly-broken-but-somewhat-okay custom linter ruler (https://secure.phabricator.com/differential/diff/30988/). Test Plan: Intense eyeballing. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: aurelijus, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12888
50 lines
966 B
PHP
50 lines
966 B
PHP
<?php
|
|
|
|
/**
|
|
* A linter for JSON files.
|
|
*/
|
|
final class ArcanistJSONLinter extends ArcanistLinter {
|
|
|
|
const LINT_PARSE_ERROR = 1;
|
|
|
|
public function getInfoName() {
|
|
return pht('JSON Lint');
|
|
}
|
|
|
|
public function getInfoDescription() {
|
|
return pht('Detect syntax errors in JSON files.');
|
|
}
|
|
|
|
public function getLinterName() {
|
|
return 'JSON';
|
|
}
|
|
|
|
public function getLinterConfigurationName() {
|
|
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 {
|
|
id(new PhutilJSONParser())->parse($data);
|
|
} catch (PhutilJSONParserException $ex) {
|
|
$this->raiseLintAtLine(
|
|
$ex->getSourceLine(),
|
|
$ex->getSourceChar(),
|
|
self::LINT_PARSE_ERROR,
|
|
$ex->getMessage());
|
|
}
|
|
}
|
|
|
|
}
|