1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-14 08:41:07 +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:
Natthu Bharambe 2012-02-24 14:26:49 -08:00
parent 89128a70d5
commit ed1928eee2
3 changed files with 40 additions and 2 deletions

View file

@ -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>'.

View file

@ -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>'.

View file

@ -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;
}