]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Adding arc lint flag that will show lint only on changed lines - even when paths...
authorChris Dentel <cdentel@fb.com>
Fri, 20 Sep 2013 23:08:59 +0000 (16:08 -0700)
committerChris Dentel <cdentel@fb.com>
Fri, 27 Sep 2013 17:13:31 +0000 (10:13 -0700)
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

src/workflow/ArcanistLintWorkflow.php

index e394fc74c949060ad544347a55e19f343babd445..a4931dae44e3da4fe264df5ee40b35b030806393 100644 (file)
@@ -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) {