From: Chris Dentel Date: Fri, 20 Sep 2013 23:08:59 +0000 (-0700) Subject: Adding arc lint flag that will show lint only on changed lines - even when paths... X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=08536d8917bdfc0f94e22555b01a5a2a13c13445;p=arcanist.git 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 --- diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php index e394fc74..a4931dae 100644 --- a/src/workflow/ArcanistLintWorkflow.php +++ b/src/workflow/ArcanistLintWorkflow.php @@ -63,7 +63,21 @@ EOTEXT return array( 'lintall' => array( '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( 'param' => 'revision', @@ -205,12 +219,15 @@ EOTEXT 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 - // warnings for the paths in question. This is easier to deal with for - // us and less confusing for users. + + // 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 + // us and less confusing for users. + $this->shouldLintAll = $paths ? true : false; + if ($this->getArgument('lintall')) { $this->shouldLintAll = true; + } else if ($this->getArgument('only-changed')) { + $this->shouldLintAll = false; } if ($everything) {