From 311449bcf8e44e6f23657c3c6a6fe92729893302 Mon Sep 17 00:00:00 2001 From: Chris Piro Date: Tue, 25 Oct 2011 15:23:08 -0700 Subject: [PATCH] add lint.pylint.pythonpath option for ArcanistPyLintLinter 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 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lint/linter/pylint/ArcanistPyLintLinter.php b/src/lint/linter/pylint/ArcanistPyLintLinter.php index abce9aa6..5f452345 100644 --- a/src/lint/linter/pylint/ArcanistPyLintLinter.php +++ b/src/lint/linter/pylint/ArcanistPyLintLinter.php @@ -30,8 +30,10 @@ * 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); }