]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Improve phutil module linter behavior for vanished modules and missing or
authorepriestley <epriestley@javelinjs.com>
Mon, 10 Jan 2011 08:07:58 +0000 (00:07 -0800)
committerepriestley <epriestley@javelinjs.com>
Mon, 10 Jan 2011 08:07:58 +0000 (00:07 -0800)
broken __init__.php.

Summary: This allows phutilmodulelinter to generate missing __init__.php and
recover from missing modules without horrible fataltown.

Test Plan:

Reviewers:

CC:

src/lint/linter/phutilmodule/ArcanistPhutilModuleLinter.php

index 5182eb1b9b0686dbc4fedb1bc8c6209533168518..85077b3f9458a5483ac2c366578982472be70987 100644 (file)
@@ -189,10 +189,14 @@ class ArcanistPhutilModuleLinter extends ArcanistLinter {
             'module'  => $module_name,
           ));
           $disk_path = $this->getModulePathOnDisk($req_module);
-          $futures[$req_module] = new ExecFuture(
-            '%s %s',
-            $bin,
-            $disk_path);
+          if (Filesystem::pathExists($disk_path)) {
+            $futures[$req_module] = new ExecFuture(
+              '%s %s',
+              $bin,
+              $disk_path);
+          } else {
+            $dependencies[$req_module] = array();
+          }
         }
       }
     }
@@ -241,7 +245,12 @@ class ArcanistPhutilModuleLinter extends ArcanistLinter {
               $library = null,
               $name);
             if ($class_spec) {
-              if (phutil_autoload_class($name)) {
+              try {
+                $loaded = phutil_autoload_class($name);
+              } catch (PhutilLibraryLoadException $ex) {
+                $loaded = false;
+              }
+              if ($loaded) {
                 $resolvable[] = $message;
                 $need_classes[$name] = $class_spec;
               } else {
@@ -274,7 +283,12 @@ class ArcanistPhutilModuleLinter extends ArcanistLinter {
               $library = null,
               $name);
             if ($func_spec) {
-              if (phutil_autoload_function($name)) {
+              try {
+                $loaded = phutil_autoload_function($name);
+              } catch (PhutilLibraryLoadException $ex) {
+                $loaded = false;
+              }
+              if ($loaded) {
                 $resolvable[] = $message;
                 $need_functions[$name] = $func_spec;
               } else {