Differential D10487 Diff 25238 src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
Show First 20 Lines • Show All 307 Lines • ▼ Show 20 Lines | final class DifferentialRevisionUpdateHistoryView extends AphrontView { | ||||
public static function renderDiffLintStar(DifferentialDiff $diff) { | public static function renderDiffLintStar(DifferentialDiff $diff) { | ||||
static $map = array( | static $map = array( | ||||
DifferentialLintStatus::LINT_NONE => self::STAR_NONE, | DifferentialLintStatus::LINT_NONE => self::STAR_NONE, | ||||
DifferentialLintStatus::LINT_OKAY => self::STAR_OKAY, | DifferentialLintStatus::LINT_OKAY => self::STAR_OKAY, | ||||
DifferentialLintStatus::LINT_WARN => self::STAR_WARN, | DifferentialLintStatus::LINT_WARN => self::STAR_WARN, | ||||
DifferentialLintStatus::LINT_FAIL => self::STAR_FAIL, | DifferentialLintStatus::LINT_FAIL => self::STAR_FAIL, | ||||
DifferentialLintStatus::LINT_SKIP => self::STAR_SKIP, | DifferentialLintStatus::LINT_SKIP => self::STAR_SKIP, | ||||
DifferentialLintStatus::LINT_AUTO_SKIP => self::STAR_SKIP, | |||||
DifferentialLintStatus::LINT_POSTPONED => self::STAR_SKIP | DifferentialLintStatus::LINT_POSTPONED => self::STAR_SKIP | ||||
); | ); | ||||
$star = idx($map, $diff->getLintStatus(), self::STAR_FAIL); | $star = idx($map, $diff->getLintStatus(), self::STAR_FAIL); | ||||
return self::renderDiffStar($star); | return self::renderDiffStar($star); | ||||
} | } | ||||
public static function renderDiffUnitStar(DifferentialDiff $diff) { | public static function renderDiffUnitStar(DifferentialDiff $diff) { | ||||
static $map = array( | static $map = array( | ||||
DifferentialUnitStatus::UNIT_NONE => self::STAR_NONE, | DifferentialUnitStatus::UNIT_NONE => self::STAR_NONE, | ||||
DifferentialUnitStatus::UNIT_OKAY => self::STAR_OKAY, | DifferentialUnitStatus::UNIT_OKAY => self::STAR_OKAY, | ||||
DifferentialUnitStatus::UNIT_WARN => self::STAR_WARN, | DifferentialUnitStatus::UNIT_WARN => self::STAR_WARN, | ||||
DifferentialUnitStatus::UNIT_FAIL => self::STAR_FAIL, | DifferentialUnitStatus::UNIT_FAIL => self::STAR_FAIL, | ||||
DifferentialUnitStatus::UNIT_SKIP => self::STAR_SKIP, | DifferentialUnitStatus::UNIT_SKIP => self::STAR_SKIP, | ||||
DifferentialUnitStatus::UNIT_AUTO_SKIP => self::STAR_SKIP, | |||||
DifferentialUnitStatus::UNIT_POSTPONED => self::STAR_SKIP, | DifferentialUnitStatus::UNIT_POSTPONED => self::STAR_SKIP, | ||||
); | ); | ||||
$star = idx($map, $diff->getUnitStatus(), self::STAR_FAIL); | $star = idx($map, $diff->getUnitStatus(), self::STAR_FAIL); | ||||
return self::renderDiffStar($star); | return self::renderDiffStar($star); | ||||
} | } | ||||
public static function getDiffLintMessage(DifferentialDiff $diff) { | public static function getDiffLintMessage(DifferentialDiff $diff) { | ||||
switch ($diff->getLintStatus()) { | switch ($diff->getLintStatus()) { | ||||
case DifferentialLintStatus::LINT_NONE: | case DifferentialLintStatus::LINT_NONE: | ||||
return 'No Linters Available'; | return pht('No Linters Available'); | ||||
case DifferentialLintStatus::LINT_OKAY: | case DifferentialLintStatus::LINT_OKAY: | ||||
return 'Lint OK'; | return pht('Lint OK'); | ||||
case DifferentialLintStatus::LINT_WARN: | case DifferentialLintStatus::LINT_WARN: | ||||
return 'Lint Warnings'; | return pht('Lint Warnings'); | ||||
case DifferentialLintStatus::LINT_FAIL: | case DifferentialLintStatus::LINT_FAIL: | ||||
return 'Lint Errors'; | return pht('Lint Errors'); | ||||
case DifferentialLintStatus::LINT_SKIP: | case DifferentialLintStatus::LINT_SKIP: | ||||
return 'Lint Skipped'; | return pht('Lint Skipped'); | ||||
case DifferentialLintStatus::LINT_AUTO_SKIP: | |||||
return pht('Automatic diff as part of commit; lint not applicable.'); | |||||
case DifferentialLintStatus::LINT_POSTPONED: | case DifferentialLintStatus::LINT_POSTPONED: | ||||
return 'Lint Postponed'; | return pht('Lint Postponed'); | ||||
} | } | ||||
return '???'; | return '???'; | ||||
} | } | ||||
public static function getDiffUnitMessage(DifferentialDiff $diff) { | public static function getDiffUnitMessage(DifferentialDiff $diff) { | ||||
switch ($diff->getUnitStatus()) { | switch ($diff->getUnitStatus()) { | ||||
case DifferentialUnitStatus::UNIT_NONE: | case DifferentialUnitStatus::UNIT_NONE: | ||||
return 'No Unit Test Coverage'; | return pht('No Unit Test Coverage'); | ||||
case DifferentialUnitStatus::UNIT_OKAY: | case DifferentialUnitStatus::UNIT_OKAY: | ||||
return 'Unit Tests OK'; | return pht('Unit Tests OK'); | ||||
case DifferentialUnitStatus::UNIT_WARN: | case DifferentialUnitStatus::UNIT_WARN: | ||||
return 'Unit Test Warnings'; | return pht('Unit Test Warnings'); | ||||
case DifferentialUnitStatus::UNIT_FAIL: | case DifferentialUnitStatus::UNIT_FAIL: | ||||
return 'Unit Test Errors'; | return pht('Unit Test Errors'); | ||||
case DifferentialUnitStatus::UNIT_SKIP: | case DifferentialUnitStatus::UNIT_SKIP: | ||||
return 'Unit Tests Skipped'; | return pht('Unit Tests Skipped'); | ||||
case DifferentialUnitStatus::UNIT_AUTO_SKIP: | |||||
return pht( | |||||
'Automatic diff as part of commit; unit tests not applicable.'); | |||||
case DifferentialUnitStatus::UNIT_POSTPONED: | case DifferentialUnitStatus::UNIT_POSTPONED: | ||||
return 'Unit Tests Postponed'; | return pht('Unit Tests Postponed'); | ||||
} | } | ||||
return '???'; | return '???'; | ||||
} | } | ||||
private static function renderDiffStar($star) { | private static function renderDiffStar($star) { | ||||
$class = 'diff-star-'.$star; | $class = 'diff-star-'.$star; | ||||
return phutil_tag( | return phutil_tag( | ||||
'span', | 'span', | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |