]> khamidou — GitHub mirrors - arcanist.git/commitdiff
arc lint: include lint errors in unresolved messages
authorAndrew Gallagher <agallagher@fb.com>
Mon, 27 Jun 2011 20:29:36 +0000 (13:29 -0700)
committerAndrew Gallagher <agallagher@fb.com>
Mon, 27 Jun 2011 21:17:17 +0000 (14:17 -0700)
Summary:
Currently, when arc-lint processes lint warnings and errors, it
accumulates the warnings into an "unresolvedMessages" array.  As
soon as it sees an errors, it breaks out of the loop that does the
collection and returns, causing individual lint errors messages to
not show up in differential.

This diff collects all lint warning and error messages into the
unresolved array.

Test Plan:
arc-diff on patch that had lint errors.  Verified that,
after this change, linte errors messages showed in differential.

Reviewed By: epriestley
Reviewers: jungejason, epriestley
Commenters: jungejason
CC: aran, epriestley, jungejason
Differential Revision: 543

src/workflow/lint/ArcanistLintWorkflow.php

index c4bef5be700aaa485c2c38cacc503c445ef14286..938b8033253120e578d30f496f25489248954acc 100644 (file)
@@ -259,24 +259,33 @@ EOTEXT
     }
 
     $unresolved = array();
-    $result_code = self::RESULT_OKAY;
+    $has_warnings = false;
+    $has_errors = false;
+
     foreach ($results as $result) {
       foreach ($result->getMessages() as $message) {
         if (!$message->isPatchApplied()) {
           if ($message->isError()) {
-            $result_code = self::RESULT_ERRORS;
-            break;
+            $has_errors = true;
           } else if ($message->isWarning()) {
-            if ($result_code != self::RESULT_ERRORS) {
-              $result_code = self::RESULT_WARNINGS;
-            }
-            $unresolved[] = $message;
+            $has_warnings = true;
           }
+          $unresolved[] = $message;
         }
       }
     }
     $this->unresolvedMessages = $unresolved;
 
+    // Take the most severe lint message severity and use that
+    // as the result code.
+    if ($has_errors) {
+      $result_code = self::RESULT_ERRORS;
+    } else if ($has_warnings) {
+      $result_code = self::RESULT_WARNINGS;
+    } else {
+      $result_code = self::RESULT_OKAY;
+    }
+
     if (!$this->getParentWorkflow()) {
       if ($result_code == self::RESULT_OKAY) {
         echo phutil_console_format(