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

Differential - label unit / lint results from the commit diff as not applicable

Summary: Fixes T5536. Some bonus pht in there.

Test Plan: made a diff hovered over the stars and saw my new text.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5536

Differential Revision: https://secure.phabricator.com/D10487
This commit is contained in:
Bob Trahan 2014-09-16 12:11:54 -07:00
parent ffa017630f
commit 936ee22de1
6 changed files with 28 additions and 14 deletions

View file

@ -8,5 +8,6 @@ final class DifferentialLintStatus {
const LINT_FAIL = 3; const LINT_FAIL = 3;
const LINT_SKIP = 4; const LINT_SKIP = 4;
const LINT_POSTPONED = 5; const LINT_POSTPONED = 5;
const LINT_AUTO_SKIP = 6;
} }

View file

@ -8,5 +8,6 @@ final class DifferentialUnitStatus {
const UNIT_FAIL = 3; const UNIT_FAIL = 3;
const UNIT_SKIP = 4; const UNIT_SKIP = 4;
const UNIT_POSTPONED = 5; const UNIT_POSTPONED = 5;
const UNIT_AUTO_SKIP = 6;
} }

View file

@ -239,6 +239,9 @@ final class DifferentialLintField
if ($status < DifferentialLintStatus::LINT_WARN) { if ($status < DifferentialLintStatus::LINT_WARN) {
return array(); return array();
} }
if ($status == DifferentialLintStatus::LINT_AUTO_SKIP) {
return array();
}
$warnings = array(); $warnings = array();
if ($status == DifferentialLintStatus::LINT_SKIP) { if ($status == DifferentialLintStatus::LINT_SKIP) {

View file

@ -209,6 +209,8 @@ final class DifferentialUnitField
$warnings = array(); $warnings = array();
if ($status < DifferentialUnitStatus::UNIT_WARN) { if ($status < DifferentialUnitStatus::UNIT_WARN) {
// Don't show any warnings. // Don't show any warnings.
} else if ($status == DifferentialUnitStatus::UNIT_AUTO_SKIP) {
// Don't show any warnings.
} else if ($status == DifferentialUnitStatus::UNIT_POSTPONED) { } else if ($status == DifferentialUnitStatus::UNIT_POSTPONED) {
$warnings[] = pht( $warnings[] = pht(
'Background tests have not finished executing on these changes.'); 'Background tests have not finished executing on these changes.');

View file

@ -313,6 +313,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
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
); );
@ -328,6 +329,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
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,
); );
@ -339,17 +341,19 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
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 '???';
} }
@ -357,17 +361,20 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
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 '???';
} }

View file

@ -261,8 +261,8 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
->setAuthorPHID($actor_phid) ->setAuthorPHID($actor_phid)
->setCreationMethod('commit') ->setCreationMethod('commit')
->setSourceControlSystem($this->repository->getVersionControlSystem()) ->setSourceControlSystem($this->repository->getVersionControlSystem())
->setLintStatus(DifferentialLintStatus::LINT_SKIP) ->setLintStatus(DifferentialLintStatus::LINT_AUTO_SKIP)
->setUnitStatus(DifferentialUnitStatus::UNIT_SKIP) ->setUnitStatus(DifferentialUnitStatus::UNIT_AUTO_SKIP)
->setDateCreated($this->commit->getEpoch()) ->setDateCreated($this->commit->getEpoch())
->setDescription( ->setDescription(
'Commit r'. 'Commit r'.