mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
(stable) Promote 2019 Week 7
This commit is contained in:
commit
5e0722296b
3 changed files with 76 additions and 20 deletions
|
@ -9,4 +9,4 @@ function f() {
|
|||
~~~~~~~~~~
|
||||
warning:3:8
|
||||
error:7:1
|
||||
error:9:
|
||||
error:9:1
|
||||
|
|
|
@ -26,6 +26,7 @@ final class ArcanistPHPCompatibilityXHPASTLinterRule
|
|||
$whitelist = array(
|
||||
'class' => array(),
|
||||
'function' => array(),
|
||||
'constant' => array(),
|
||||
);
|
||||
|
||||
$conditionals = $root->selectDescendantsOfType('n_IF');
|
||||
|
@ -51,6 +52,7 @@ final class ArcanistPHPCompatibilityXHPASTLinterRule
|
|||
case 'class_exists':
|
||||
case 'function_exists':
|
||||
case 'interface_exists':
|
||||
case 'defined':
|
||||
$type = null;
|
||||
switch ($function_name) {
|
||||
case 'class_exists':
|
||||
|
@ -64,6 +66,10 @@ final class ArcanistPHPCompatibilityXHPASTLinterRule
|
|||
case 'interface_exists':
|
||||
$type = 'interface';
|
||||
break;
|
||||
|
||||
case 'defined':
|
||||
$type = 'constant';
|
||||
break;
|
||||
}
|
||||
|
||||
$params = $function->getChildOfType(1, 'n_CALL_PARAMETER_LIST');
|
||||
|
@ -98,7 +104,6 @@ final class ArcanistPHPCompatibilityXHPASTLinterRule
|
|||
$min = idx($version, 'php.min');
|
||||
$max = idx($version, 'php.max');
|
||||
|
||||
// Check if whitelisted.
|
||||
$whitelisted = false;
|
||||
foreach (idx($whitelist['function'], $name, array()) as $range) {
|
||||
if (array_intersect($range, array_keys($node->getTokens()))) {
|
||||
|
@ -178,18 +183,18 @@ final class ArcanistPHPCompatibilityXHPASTLinterRule
|
|||
$version = idx($compat_info['classes'], $name, $version);
|
||||
$min = idx($version, 'php.min');
|
||||
$max = idx($version, 'php.max');
|
||||
// Check if whitelisted.
|
||||
$whitelisted = false;
|
||||
foreach (idx($whitelist['class'], $name, array()) as $range) {
|
||||
if (array_intersect($range, array_keys($node->getTokens()))) {
|
||||
$whitelisted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($whitelisted) {
|
||||
continue;
|
||||
$whitelisted = false;
|
||||
foreach (idx($whitelist['class'], $name, array()) as $range) {
|
||||
if (array_intersect($range, array_keys($node->getTokens()))) {
|
||||
$whitelisted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($whitelisted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($min && version_compare($min, $this->version, '>')) {
|
||||
$this->raiseLintAtNode(
|
||||
|
@ -225,6 +230,18 @@ final class ArcanistPHPCompatibilityXHPASTLinterRule
|
|||
$min = idx($version, 'php.min');
|
||||
$max = idx($version, 'php.max');
|
||||
|
||||
$whitelisted = false;
|
||||
foreach (idx($whitelist['constant'], $name, array()) as $range) {
|
||||
if (array_intersect($range, array_keys($node->getTokens()))) {
|
||||
$whitelisted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($whitelisted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($min && version_compare($min, $this->version, '>')) {
|
||||
$this->raiseLintAtNode(
|
||||
$node,
|
||||
|
|
|
@ -1820,17 +1820,56 @@ EOTEXT
|
|||
$this->checkRevisionOwnership(head($result));
|
||||
break;
|
||||
case 'reviewers':
|
||||
$untils = array();
|
||||
$away = array();
|
||||
foreach ($result as $user) {
|
||||
if (idx($user, 'currentStatus') == 'away') {
|
||||
$untils[] = $user['currentStatusUntil'];
|
||||
if (idx($user, 'currentStatus') != 'away') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$username = $user['userName'];
|
||||
$real_name = $user['realName'];
|
||||
|
||||
if (strlen($real_name)) {
|
||||
$name = pht('%s (%s)', $username, $real_name);
|
||||
} else {
|
||||
$name = pht('%s', $username);
|
||||
}
|
||||
|
||||
$away[] = array(
|
||||
'name' => $name,
|
||||
'until' => $user['currentStatusUntil'],
|
||||
);
|
||||
}
|
||||
if (count($untils) == count($reviewers)) {
|
||||
$until = date('l, M j Y', min($untils));
|
||||
$confirm = pht(
|
||||
'All reviewers are away until %s. Continue anyway?',
|
||||
$until);
|
||||
|
||||
if ($away) {
|
||||
if (count($away) == count($reviewers)) {
|
||||
$earliest_return = min(ipull($away, 'until'));
|
||||
|
||||
$message = pht(
|
||||
'All reviewers are away until %s:',
|
||||
date('l, M j Y', $earliest_return));
|
||||
} else {
|
||||
$message = pht('Some reviewers are currently away:');
|
||||
}
|
||||
|
||||
echo tsprintf(
|
||||
"%s\n\n",
|
||||
$message);
|
||||
|
||||
$list = id(new PhutilConsoleList());
|
||||
foreach ($away as $spec) {
|
||||
$list->addItem(
|
||||
pht(
|
||||
'%s (until %s)',
|
||||
$spec['name'],
|
||||
date('l, M j Y', $spec['until'])));
|
||||
}
|
||||
|
||||
echo tsprintf(
|
||||
'%B',
|
||||
$list->drawConsoleString());
|
||||
|
||||
$confirm = pht('Continue even though reviewers are unavailable?');
|
||||
if (!phutil_console_confirm($confirm)) {
|
||||
throw new ArcanistUsageException(
|
||||
pht('Specify available reviewers and retry.'));
|
||||
|
|
Loading…
Reference in a new issue