]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Provide ConfigurationManager to LintEngine in Arcanist
authorepriestley <git@epriestley.com>
Mon, 21 Oct 2013 23:57:22 +0000 (16:57 -0700)
committerepriestley <git@epriestley.com>
Mon, 21 Oct 2013 23:57:22 +0000 (16:57 -0700)
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

src/lint/engine/ArcanistLintEngine.php
src/lint/engine/ArcanistSingleLintEngine.php
src/lint/linter/ArcanistScriptAndRegexLinter.php
src/workflow/ArcanistLintWorkflow.php

index 81fddbf6a8a50d15a8a5d531dbcac2f455da6766..6de6ebd3bd24515ae44a4209d0f6a348f29d876f 100644 (file)
@@ -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;
index 18ced2693fdd60a7d15f4df93d5b3ad8ec0fefa2..a001582f9350d9b0c6201d30fe9f777947610671 100644 (file)
@@ -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(
index 88ee70866bd9d73c105e2c0d3cb6675af1b03c39..a6e5c1f8efbcd8c7b961a2f1b0fd10cda604bedc 100644 (file)
@@ -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(
index 45ce9dfeec4b1a89b5ae43b350b29642f6b09ad5..de8266c28428deaf40df0f951018c0968f473da4 100644 (file)
@@ -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));