1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-26 15:30:57 +01:00

Allow ArcanistPhutilXHPASTLinter to be configured from .arclint.

Summary: Currently, `PhabricatorLintEngine` configures the `ArcanistPhutilXHPASTLinter` linter. In order to use `.arclint` instead, we need to expose the `ArcanistPhutilXHPASTLinter` configuration to the `.arclint` format.

Test Plan: See D9064.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9066
This commit is contained in:
Joshua Spence 2014-05-12 04:46:41 -07:00 committed by epriestley
parent c4ac8a1aea
commit 1b820dbb14

View file

@ -59,6 +59,46 @@ final class ArcanistPhutilXHPASTLinter extends ArcanistBaseXHPASTLinter {
return $version;
}
public function getLinterConfigurationOptions() {
$options = array(
'phutil-xhpast.deprecated.functions' => array(
'type' => 'optional map<string, string>',
'help' => pht(
'Functions which should should be considered deprecated.'),
),
'phutil-xhpast.dynamic-string.functions' => array(
'type' => 'optional map<string, string>',
'help' => pht(
'Functions which should should not be used because they represent '.
'the unsafe usage of dynamic strings.'),
),
'phutil-xhpast.dynamic-string.classes' => array(
'type' => 'optional map<string, string>',
'help' => pht(
'Classes which should should not be used because they represent the '.
'unsafe usage of dynamic strings.'),
),
);
return $options + parent::getLinterConfigurationOptions();
}
public function setLinterConfigurationValue($key, $value) {
switch ($key) {
case 'phutil-xhpast.deprecated.functions':
$this->setDeprecatedFunctions($value);
return;
case 'phutil-xhpast.dynamic-string.functions':
$this->setDynamicStringFunctions($value);
return;
case 'phutil-xhpast.dynamic-string.classes':
$this->setDynamicStringClasses($value);
return;
}
return parent::setLinterConfigurationValue($key, $value);
}
protected function resolveFuture($path, Future $future) {
$tree = $this->getXHPASTLinter()->getXHPASTTreeForPath($path);
if (!$tree) {