1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

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
This commit is contained in:
vrana 2012-12-14 17:59:39 -08:00
parent 94d42b6313
commit 79b241b31d

View file

@ -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 =
"<p>This diff was created without running lint. Make sure you are ".
"OK with that before you accept this diff.</p>";
} else {
$content =
"<p>This diff has Lint Problems. Make sure you are OK with them ".
"before you accept this diff.</p>";
}
$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 =
"<p>This diff was created without running lint. Make sure you are ".
"OK with that before you accept this diff.</p>";
} else if ($status == DifferentialLintStatus::LINT_POSTPONED) {
$severity = AphrontErrorView::SEVERITY_WARNING;
$content =
"<p>Postponed linters didn't finish yet. Make sure you are OK with ".
"that before you accept this diff.</p>";
} else {
$content =
"<p>This diff has Lint Problems. Make sure you are OK with them ".
"before you accept this diff.</p>";
}
return id(new AphrontErrorView())
->setSeverity($severity)
->appendChild($content)
->setTitle(idx($titles, $status, 'Warning'));
}
}