mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +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:
parent
94d42b6313
commit
79b241b31d
1 changed files with 33 additions and 23 deletions
|
@ -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'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue