mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-14 00:31:05 +01:00
Show lint/unit failure explanation in Phabricator
Summary: Tweaked lint/unit field specifications to introduce the failure explanation read from arc:[lint|unit]-excuse. Task ID: # Blame Rev: Test Plan: Create dumb diffs with errors - run modified 'arc' and change conduit_url to http://phabricator.dev1020.facebook.com/api/ - verified that explanation shows up with proper formatting. Revert Plan: Tags: Reviewers: epriestley, nh Reviewed By: epriestley CC: Girish, akramer, blair, aran, epriestley, andreygoder Differential Revision: https://secure.phabricator.com/D1689
This commit is contained in:
parent
89128a70d5
commit
ed1928eee2
3 changed files with 40 additions and 2 deletions
|
@ -28,7 +28,20 @@ final class DifferentialLintFieldSpecification
|
|||
}
|
||||
|
||||
public function getRequiredDiffProperties() {
|
||||
return array('arc:lint');
|
||||
return array('arc:lint', 'arc:lint-excuse');
|
||||
}
|
||||
|
||||
private function getLintExcuse() {
|
||||
$excuse = $this->getDiffProperty('arc:lint-excuse');
|
||||
$excuse = phutil_escape_html($excuse);
|
||||
$excuse = nl2br($excuse);
|
||||
|
||||
$excuse_markup = '';
|
||||
if (strlen($excuse)) {
|
||||
$excuse_markup = '<p><strong>Explanation for failure(s): </strong></p>'.
|
||||
'<span class="lint-excuse">'.$excuse.'</span>';
|
||||
}
|
||||
return $excuse_markup;
|
||||
}
|
||||
|
||||
public function renderValueForRevisionView() {
|
||||
|
@ -83,8 +96,10 @@ final class DifferentialLintFieldSpecification
|
|||
'<ul>'.implode("\n", $message_markup).'</ul>'.
|
||||
'</li>';
|
||||
}
|
||||
$lexcuse = $this->getLintExcuse();
|
||||
$ltail =
|
||||
'<div class="differential-lint-block">'.
|
||||
$lexcuse.
|
||||
'<ul>'.
|
||||
implode("\n", $lint_messages).
|
||||
'</ul>'.
|
||||
|
|
|
@ -28,7 +28,20 @@ final class DifferentialUnitFieldSpecification
|
|||
}
|
||||
|
||||
public function getRequiredDiffProperties() {
|
||||
return array('arc:unit');
|
||||
return array('arc:unit', 'arc:unit-excuse');
|
||||
}
|
||||
|
||||
private function getUnitExcuse() {
|
||||
$excuse = $this->getDiffProperty('arc:unit-excuse');
|
||||
$excuse = phutil_escape_html($excuse);
|
||||
$excuse = nl2br($excuse);
|
||||
|
||||
$excuse_markup = '';
|
||||
if (strlen($excuse)) {
|
||||
$excuse_markup = '<p>Explanation for failure(s): </p>'.
|
||||
'<span class="unit-excuse">'.$excuse.'</span>';
|
||||
}
|
||||
return $excuse_markup;
|
||||
}
|
||||
|
||||
public function renderValueForRevisionView() {
|
||||
|
@ -67,9 +80,12 @@ final class DifferentialUnitFieldSpecification
|
|||
$postponed_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$uexcuse = $this->getUnitExcuse();
|
||||
if ($unit_messages) {
|
||||
$utail =
|
||||
'<div class="differential-unit-block">'.
|
||||
$uexcuse.
|
||||
'<ul>'.
|
||||
implode("\n", $unit_messages).
|
||||
'</ul>'.
|
||||
|
|
|
@ -86,6 +86,13 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.differential-lint-block .lint-excuse,
|
||||
.differential-unit-block .unit-excuse {
|
||||
background: #808080;
|
||||
color: #ffff66;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.differential-keyboard-shortcuts {
|
||||
float: right;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue