From 37152662091f69e4803025935a02181fdd1b67a1 Mon Sep 17 00:00:00 2001 From: Andrew Gallagher Date: Mon, 27 Jun 2011 13:29:36 -0700 Subject: [PATCH] arc lint: include lint errors in unresolved messages 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 | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/workflow/lint/ArcanistLintWorkflow.php b/src/workflow/lint/ArcanistLintWorkflow.php index c4bef5be..938b8033 100644 --- a/src/workflow/lint/ArcanistLintWorkflow.php +++ b/src/workflow/lint/ArcanistLintWorkflow.php @@ -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(