mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
add 'lint.pylint.rcfile' option for ArcanistPyLintLinter
Summary: add the ability to specify an rcfile path either absolute or relative to the project root. Test Plan: added one for a project, ran ##arc lint --trace## to see the expected result Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: 1046
This commit is contained in:
parent
00e5ba7ddc
commit
930b32a6b4
2 changed files with 18 additions and 1 deletions
|
@ -32,6 +32,10 @@
|
|||
* You can specify additional command-line options to pass to PyLint by
|
||||
* setting ##lint.pylint.options##.
|
||||
|
||||
* 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
|
||||
* ##text##.
|
||||
*
|
||||
* Specify which PyLint messages map to which Arcanist messages by defining
|
||||
* the following regular expressions:
|
||||
|
@ -156,8 +160,20 @@ class ArcanistPyLintLinter extends ArcanistLinter {
|
|||
// '-iy': show message codes for lint warnings/errors
|
||||
$options = array('-rn', '-iy');
|
||||
|
||||
// Add any options defined in the config file for PyLint
|
||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
||||
|
||||
// Specify an --rcfile, either absolute or relative to the project root.
|
||||
// Stupidly, the command line args above are overridden by rcfile, so be
|
||||
// careful.
|
||||
$rcfile = $working_copy->getConfig('lint.pylint.rcfile');
|
||||
if ($rcfile !== null) {
|
||||
$rcfile = Filesystem::resolvePath(
|
||||
$rcfile,
|
||||
$working_copy->getProjectRoot());
|
||||
$options[] = csprintf('--rcfile=%s', $rcfile);
|
||||
}
|
||||
|
||||
// Add any options defined in the config file for PyLint
|
||||
$config_options = $working_copy->getConfig('lint.pylint.options');
|
||||
if ($config_options !== null) {
|
||||
$options = array_merge($options, $config_options);
|
||||
|
|
|
@ -13,6 +13,7 @@ phutil_require_module('arcanist', 'lint/severity');
|
|||
|
||||
phutil_require_module('phutil', 'filesystem');
|
||||
phutil_require_module('phutil', 'future/exec');
|
||||
phutil_require_module('phutil', 'xsprintf/csprintf');
|
||||
|
||||
|
||||
phutil_require_source('ArcanistPyLintLinter.php');
|
||||
|
|
Loading…
Reference in a new issue