1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 02:02:40 +01:00

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
This commit is contained in:
Chris Piro 2011-10-25 15:23:08 -07:00
parent 0c35cb80f2
commit 311449bcf8

View file

@ -30,8 +30,10 @@
* lint.pylint.logilab_common.prefix * lint.pylint.logilab_common.prefix
* *
* You can specify additional command-line options to pass to PyLint by * 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 * If you have a PyLint rcfile, specify its path with
* ##lint.pylint.rcfile##. It can be absolute or relative to the project * ##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 * 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[] = ''; $python_path[] = '';
return implode(":", $python_path); return implode(":", $python_path);
} }