From 79b241b31dfe0bf65f1faae94315db1be217fc3f Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 14 Dec 2012 17:59:39 -0800 Subject: [PATCH] Render warning instead of error for postponed lint Test Plan: {F27152, size=full} Reviewers: epriestley Reviewed By: epriestley CC: ypisetsky, aran, Korvin Differential Revision: https://secure.phabricator.com/D4195 --- .../DifferentialLintFieldSpecification.php | 56 +++++++++++-------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php index c6a4c72607..b3fe923f93 100644 --- a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php @@ -218,30 +218,40 @@ final class DifferentialLintFieldSpecification } public function renderWarningBoxForRevisionAccept() { - $diff = $this->getDiff(); - $lint_warning = null; - if ($diff->getLintStatus() >= DifferentialLintStatus::LINT_WARN) { - $titles = - array( - DifferentialLintStatus::LINT_WARN => 'Lint Warning', - DifferentialLintStatus::LINT_FAIL => 'Lint Failure', - DifferentialLintStatus::LINT_SKIP => 'Lint Skipped' - ); - if ($diff->getLintStatus() == DifferentialLintStatus::LINT_SKIP) { - $content = - "

This diff was created without running lint. Make sure you are ". - "OK with that before you accept this diff.

"; - } else { - $content = - "

This diff has Lint Problems. Make sure you are OK with them ". - "before you accept this diff.

"; - } - $lint_warning = id(new AphrontErrorView()) - ->setSeverity(AphrontErrorView::SEVERITY_ERROR) - ->appendChild($content) - ->setTitle(idx($titles, $diff->getLintStatus(), 'Warning')); + $status = $this->getDiff()->getLintStatus(); + if ($status < DifferentialLintStatus::LINT_WARN) { + return null; } - return $lint_warning; + + $severity = AphrontErrorView::SEVERITY_ERROR; + $titles = array( + DifferentialLintStatus::LINT_WARN => 'Lint Warning', + DifferentialLintStatus::LINT_FAIL => 'Lint Failure', + DifferentialLintStatus::LINT_SKIP => 'Lint Skipped', + DifferentialLintStatus::LINT_POSTPONED => 'Lint Postponed', + ); + + if ($status == DifferentialLintStatus::LINT_SKIP) { + $content = + "

This diff was created without running lint. Make sure you are ". + "OK with that before you accept this diff.

"; + + } else if ($status == DifferentialLintStatus::LINT_POSTPONED) { + $severity = AphrontErrorView::SEVERITY_WARNING; + $content = + "

Postponed linters didn't finish yet. Make sure you are OK with ". + "that before you accept this diff.

"; + + } else { + $content = + "

This diff has Lint Problems. Make sure you are OK with them ". + "before you accept this diff.

"; + } + + return id(new AphrontErrorView()) + ->setSeverity($severity) + ->appendChild($content) + ->setTitle(idx($titles, $status, 'Warning')); } }