mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +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:
parent
0c35cb80f2
commit
311449bcf8
1 changed files with 15 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue