]> khamidou — GitHub mirrors - arcanist.git/commitdiff
lint: fail early if no lint engine is defined
authorAdam Simpkins <simpkins@fb.com>
Tue, 17 May 2011 19:43:49 +0000 (12:43 -0700)
committerAdam Simpkins <simpkins@fb.com>
Tue, 17 May 2011 19:59:49 +0000 (12:59 -0700)
Summary:
Update the lint workflow to exit immediately it there is no lint engine
configured.  Previously it scanned the repository to find the paths to
check before failing in this case.  Scanning the repository can be
relatively slow on large repositories.

Test Plan:
Ran "arc lint" in a large repository with no lint engine configured.
Verified that it failed quickly, without scanning the repository first.

Reviewed By: jungejason
Reviewers: jungejason, epriestley
CC: aran, jungejason
Differential Revision: 297

src/workflow/lint/ArcanistLintWorkflow.php

index 17a6fe3ba736076d95e21d3a5f688c8d3db01375..c4bef5be700aaa485c2c38cacc503c445ef14286 100644 (file)
@@ -96,6 +96,11 @@ EOTEXT
     $engine = $this->getArgument('engine');
     if (!$engine) {
       $engine = $working_copy->getConfig('lint_engine');
+      if (!$engine) {
+        throw new ArcanistNoEngineException(
+          "No lint engine configured for this project. Edit .arcconfig to ".
+          "specify a lint engine.");
+      }
     }
 
     $should_lint_all = $this->getArgument('lintall');
@@ -153,12 +158,6 @@ EOTEXT
       }
     }
 
-    if (!$engine) {
-      throw new ArcanistNoEngineException(
-        "No lint engine configured for this project. Edit .arcconfig to ".
-        "specify a lint engine.");
-    }
-
     PhutilSymbolLoader::loadClass($engine);
 
     $engine = newv($engine, array());