mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 23:02:41 +01:00
Adding arc lint flag that will show lint only on changed lines - even when paths are specified
Summary: The existing lint configurations do not allow for linting only the lines that have changed when paths are added. --lintall has a default behavior of true when paths are specified, and false when paths are not specified. Because of this (and because it does not take a boolean param) it is not possible to lint a path for only the errors on changed lines - only-new is not working presently. Test Plan: play around with the linter Reviewers: lifeihuang Reviewed By: lifeihuang CC: epriestley, aran Differential Revision: https://secure.phabricator.com/D7055
This commit is contained in:
parent
6270dd0de5
commit
08536d8917
1 changed files with 23 additions and 6 deletions
|
@ -63,7 +63,21 @@ EOTEXT
|
||||||
return array(
|
return array(
|
||||||
'lintall' => array(
|
'lintall' => array(
|
||||||
'help' =>
|
'help' =>
|
||||||
"Show all lint warnings, not just those on changed lines."
|
"Show all lint warnings, not just those on changed lines. When " .
|
||||||
|
"paths are specified, this is the default behavior.",
|
||||||
|
'conflicts' => array(
|
||||||
|
'only-changed' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'only-changed' => array(
|
||||||
|
'help' =>
|
||||||
|
"Show lint warnings just on changed lines. When no paths are " .
|
||||||
|
"specified, this is the default. This differs from only-new " .
|
||||||
|
"in cases where line modifications introduce lint on other " .
|
||||||
|
"unmodified lines.",
|
||||||
|
'conflicts' => array(
|
||||||
|
'lintall' => true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'rev' => array(
|
'rev' => array(
|
||||||
'param' => 'revision',
|
'param' => 'revision',
|
||||||
|
@ -205,12 +219,15 @@ EOTEXT
|
||||||
throw new ArcanistUsageException("Specify either --rev or paths.");
|
throw new ArcanistUsageException("Specify either --rev or paths.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->shouldLintAll = $this->getArgument('lintall');
|
|
||||||
if ($paths) {
|
|
||||||
// NOTE: When the user specifies paths, we imply --lintall and show all
|
// NOTE: When the user specifies paths, we imply --lintall and show all
|
||||||
// warnings for the paths in question. This is easier to deal with for
|
// warnings for the paths in question. This is easier to deal with for
|
||||||
// us and less confusing for users.
|
// us and less confusing for users.
|
||||||
|
$this->shouldLintAll = $paths ? true : false;
|
||||||
|
if ($this->getArgument('lintall')) {
|
||||||
$this->shouldLintAll = true;
|
$this->shouldLintAll = true;
|
||||||
|
} else if ($this->getArgument('only-changed')) {
|
||||||
|
$this->shouldLintAll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($everything) {
|
if ($everything) {
|
||||||
|
|
Loading…
Reference in a new issue