]> khamidou — GitHub mirrors - arcanist.git/commitdiff
add lint.pylint.pythonpath option for ArcanistPyLintLinter
authorChris Piro <cpiro@airtime.com>
Tue, 25 Oct 2011 22:23:08 +0000 (15:23 -0700)
committerChris Piro <cpiro@airtime.com>
Thu, 27 Oct 2011 04:29:55 +0000 (21:29 -0700)
Summary: allow adding PYTHONPATHs directly in addition to the hardcoded few
already allowed.

Test Plan: ##arc lint## successfully picks up the paths listed in my .arcconfig,
and no longer errors on modules not found from those directories

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1050

src/lint/linter/pylint/ArcanistPyLintLinter.php

index abce9aa60a7f666bdfab293b3ac044b4237d9323..5f452345909f806ef22a4abf8219da116cfea90a 100644 (file)
  *   lint.pylint.logilab_common.prefix
  *
  * You can specify additional command-line options to pass to PyLint by
- * setting ##lint.pylint.options##.
-
+ * setting ##lint.pylint.options##. You may also specify a list of additional
+ * entries for PYTHONPATH with ##lint.pylint.pythonpath##. Those can be
+ * absolute or relative to the project root.
+ *
  * If you have a PyLint rcfile, specify its path with
  * ##lint.pylint.rcfile##. It can be absolute or relative to the project
  * root. Be sure not to define ##output-format##, or if you do, set it to
@@ -151,6 +153,17 @@ class ArcanistPyLintLinter extends ArcanistLinter {
       }
     }
 
+    $config_paths = $working_copy->getConfig('lint.pylint.pythonpath');
+    if ($config_paths !== null) {
+      foreach ($config_paths as $config_path) {
+        if ($config_path !== null) {
+          $python_path[] =
+            Filesystem::resolvePath($config_path,
+                                    $working_copy->getProjectRoot());
+        }
+      }
+    }
+
     $python_path[] = '';
     return implode(":", $python_path);
   }