From 29839e8c72c569171069272ac824e025883cb634 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 25 Jun 2015 10:05:54 -0700 Subject: [PATCH] Don't fail lint builds for "advice"; make lint/unit upload failures louder Summary: Ref T8670. Ref T8657. - When lint only has advice (no warnings/errors), consider it a "passing" build. - Be a little louder about `sendmessage` calls failing because this stuff is not totally broken and that makes T8670-related things easier to catch/fix. Test Plan: Created this revision. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8657, T8670 Differential Revision: https://secure.phabricator.com/D13436 --- src/workflow/ArcanistDiffWorkflow.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index a3117777..6061fd46 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -2734,12 +2734,24 @@ EOTEXT $lint[$key] = $this->getModernLintDictionary($message); } + // Consider this target to have failed if there are any unresolved + // errors or warnings. + $type = 'pass'; + foreach ($lint as $message) { + switch (idx($message, 'severity')) { + case ArcanistLintSeverity::SEVERITY_WARNING: + case ArcanistLintSeverity::SEVERITY_ERROR: + $type = 'fail'; + break; + } + } + $futures[] = $this->getConduit()->callMethod( 'harbormaster.sendmessage', array( 'buildTargetPHID' => $lint_target, 'lint' => array_values($lint), - 'type' => $lint ? 'fail' : 'pass', + 'type' => $type, )); } @@ -2775,6 +2787,9 @@ EOTEXT } return true; } catch (Exception $ex) { + // TODO: Eventually, we should expect these to succeed if we get this + // far, but just log errors for now. + phlog($ex); return false; } }