mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Provide ConfigurationManager to LintEngine in Arcanist
Summary: Unbreaks ArcanistSingleLintEngine / ArcanistScriptAndRegexLinter from recent config churn. Test Plan: `arc lint --engine ArcanistSingleLintEngine --rev HEAD^` Reviewers: btrahan Reviewed By: btrahan CC: csilvers, aran Differential Revision: https://secure.phabricator.com/D7377
This commit is contained in:
parent
5c2f7b2abd
commit
ddbc14ade1
4 changed files with 21 additions and 4 deletions
|
@ -63,11 +63,22 @@ abstract class ArcanistLintEngine {
|
|||
|
||||
private $enableAsyncLint = false;
|
||||
private $postponedLinters = array();
|
||||
private $configurationManager;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function setConfigurationManager(
|
||||
ArcanistConfigurationManager $configuration_manager) {
|
||||
$this->configurationManager = $configuration_manager;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConfigurationManager() {
|
||||
return $this->configurationManager;
|
||||
}
|
||||
|
||||
public function setWorkingCopy(ArcanistWorkingCopyIdentity $working_copy) {
|
||||
$this->workingCopy = $working_copy;
|
||||
return $this;
|
||||
|
|
|
@ -15,7 +15,8 @@ final class ArcanistSingleLintEngine extends ArcanistLintEngine {
|
|||
|
||||
public function buildLinters() {
|
||||
$key = 'lint.engine.single.linter';
|
||||
$linter_name = $this->getWorkingCopy()->getConfigFromAnySource($key);
|
||||
$linter_name = $this->getConfigurationManager()
|
||||
->getConfigFromAnySource($key);
|
||||
|
||||
if (!$linter_name) {
|
||||
throw new ArcanistUsageException(
|
||||
|
|
|
@ -348,7 +348,9 @@ final class ArcanistScriptAndRegexLinter extends ArcanistLinter {
|
|||
*/
|
||||
private function getConfiguredScript() {
|
||||
$key = 'linter.scriptandregex.script';
|
||||
$config = $this->getConfigFromAnySource($key);
|
||||
$config = $this->getEngine()
|
||||
->getConfigurationManager()
|
||||
->getConfigFromAnySource($key);
|
||||
|
||||
if (!$config) {
|
||||
throw new ArcanistUsageException(
|
||||
|
@ -373,7 +375,9 @@ final class ArcanistScriptAndRegexLinter extends ArcanistLinter {
|
|||
*/
|
||||
private function getConfiguredRegex() {
|
||||
$key = 'linter.scriptandregex.regex';
|
||||
$config = $this->getConfigFromAnySource($key);
|
||||
$config = $this->getEngine()
|
||||
->getConfigurationManager()
|
||||
->getConfigFromAnySource($key);
|
||||
|
||||
if (!$config) {
|
||||
throw new ArcanistUsageException(
|
||||
|
|
|
@ -261,7 +261,8 @@ EOTEXT
|
|||
|
||||
$engine = newv($engine, array());
|
||||
$this->engine = $engine;
|
||||
$engine->setWorkingCopy($working_copy); // todo setConfig?
|
||||
$engine->setWorkingCopy($working_copy);
|
||||
$engine->setConfigurationManager($configuration_manager);
|
||||
$engine->setMinimumSeverity(
|
||||
$this->getArgument('severity', self::DEFAULT_SEVERITY));
|
||||
|
||||
|
|
Loading…
Reference in a new issue