1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-08 16:02:39 +01:00

Change double quotes to single quotes.

Summary: Ran `arc lint --apply-patches --everything` over rARC, mainly to change double quotes to single quotes where appropriate. These changes also validate that the `ArcanistXHPASTLinter::LINT_DOUBLE_QUOTE` rule is working as expected.

Test Plan: Eyeballed //most// of the diff.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9269
This commit is contained in:
Joshua Spence 2014-05-23 13:53:05 -07:00 committed by epriestley
parent e34bdf6c74
commit 17820442da
78 changed files with 521 additions and 521 deletions

View file

@ -195,8 +195,8 @@ try {
if ($need_working_copy || $want_working_copy) {
if ($need_working_copy && !$working_copy->getVCSType()) {
throw new ArcanistUsageException(
"This command must be run in a Git, Mercurial or Subversion working ".
"copy.");
'This command must be run in a Git, Mercurial or Subversion working '.
'copy.');
}
$configuration_manager->setWorkingCopyIdentity($working_copy);
}
@ -352,7 +352,7 @@ try {
echo phutil_console_format(
"**Exception**\n%s\n%s\n",
$ex->getMessage(),
"(Run with --trace for a full exception trace.)");
'(Run with --trace for a full exception trace.)');
}
exit(1);

View file

@ -22,7 +22,7 @@ $args->parse(
$repo = $args->getArg('repository');
if (count($repo) !== 1) {
throw new Exception("Specify exactly one working copy!");
throw new Exception('Specify exactly one working copy!');
}
$repo = head($repo);

View file

@ -40,7 +40,7 @@ $args->parse(
$repo = $args->getArg('repository');
if (count($repo) !== 1) {
throw new Exception("Specify exactly one working copy!");
throw new Exception('Specify exactly one working copy!');
}
$repo = head($repo);

View file

@ -152,7 +152,7 @@ final class PhutilLibraryMapBuilder {
$result['error']);
exit(1);
}
$this->log(".");
$this->log('.');
}
$this->log("\nDone.\n");
}

View file

@ -49,7 +49,7 @@ $args->parse(
$root = $args->getArg('root');
if (count($root) !== 1) {
throw new Exception("Provide exactly one library root!");
throw new Exception('Provide exactly one library root!');
}
$root = Filesystem::resolvePath(head($root));

View file

@ -52,7 +52,7 @@ $args->parse(
$paths = $args->getArg('path');
if (count($paths) !== 1) {
throw new Exception("Specify exactly one path!");
throw new Exception('Specify exactly one path!');
}
$path = Filesystem::resolvePath(head($paths));

View file

@ -168,7 +168,7 @@ class ArcanistConfiguration {
private function raiseUnknownCommand($command, array $maybe = array()) {
$message = pht("Unknown command '%s'. Try 'arc help'.", $command);
if ($maybe) {
$message .= "\n\n".pht("Did you mean:")."\n";
$message .= "\n\n".pht('Did you mean:')."\n";
sort($maybe);
foreach ($maybe as $other) {
$message .= " ".$other."\n";

View file

@ -151,7 +151,7 @@ final class ArcanistConfigurationManager {
return $this->workingCopy->writeLocalArcConfig($config);
}
throw new Exception(pht("No working copy to write config to!"));
throw new Exception(pht('No working copy to write config to!'));
}
/**
@ -235,7 +235,7 @@ final class ArcanistConfigurationManager {
public function setUserConfigurationFileLocation($custom_arcrc) {
if (!Filesystem::pathExists($custom_arcrc)) {
throw new Exception(
"Custom arcrc file was specified, but it was not found!");
'Custom arcrc file was specified, but it was not found!');
}
$this->customArcrcFilename = $custom_arcrc;

View file

@ -142,7 +142,7 @@ final class ArcanistSettings {
'browser' => array(
'type' => 'string',
'help' =>
"Command to use to invoke a web browser.",
'Command to use to invoke a web browser.',
'example' => '"gnome-www-browser"',
),
'events.listeners' => array(
@ -154,13 +154,13 @@ final class ArcanistSettings {
'http.basicauth.user' => array(
'type' => 'string',
'help' =>
"Username to use for basic auth over http transports",
'Username to use for basic auth over http transports',
'example' => '"bob"',
),
'http.basicauth.pass' => array(
'type' => 'string',
'help' =>
"Password to use for basic auth over http transports",
'Password to use for basic auth over http transports',
'example' => '"bobhasasecret"',
),
'arc.autostash' => array(

View file

@ -100,7 +100,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
$utf8_tests = array(
array(
"GrumpyCat",
'GrumpyCat',
"Grumpy\xE2\x98\x83at",
'ssssssxss',
),
@ -118,8 +118,8 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
public function testGenerateUTF8IntralineDiff() {
// Both Strings Empty.
$left = "";
$right = "";
$left = '';
$right = '';
$result = array(
array(array(0, 0)),
array(array(0, 0))
@ -129,7 +129,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
ArcanistDiffUtils::generateIntralineDiff($left, $right));
// Left String Empty.
$left = "";
$left = '';
$right = "Grumpy\xE2\x98\x83at";
$result = array(
array(array(0, 0)),
@ -141,7 +141,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
// Right String Empty.
$left = "Grumpy\xE2\x98\x83at";
$right = "";
$right = '';
$result = array(
array(array(0, 11)),
array(array(0, 0))
@ -163,7 +163,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
// Both Strings are different.
$left = "Grumpy\xE2\x98\x83at";
$right = "Smiling Dog";
$right = 'Smiling Dog';
$result = array(
array(array(1, 11)),
array(array(1, 11))
@ -173,7 +173,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
ArcanistDiffUtils::generateIntralineDiff($left, $right));
// String with one difference in the middle.
$left = "GrumpyCat";
$left = 'GrumpyCat';
$right = "Grumpy\xE2\x98\x83at";
$result = array(
array(array(0, 6), array(1, 1), array(0, 2)),
@ -184,7 +184,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
ArcanistDiffUtils::generateIntralineDiff($left, $right));
// Differences in middle, not connected to each other.
$left = "GrumpyCat";
$left = 'GrumpyCat';
$right = "Grumpy\xE2\x98\x83a\xE2\x98\x83t";
$result = array(
array(array(0, 6), array(1, 2), array(0, 1)),
@ -229,7 +229,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
// This is a unicode combining character, "COMBINING DOUBLE TILDE".
$cc = "\xCD\xA0";
$left = "Senor";
$left = 'Senor';
$right = "Sen{$cc}or";
$result = array(
array(array(0, 2), array(1, 1), array(0, 2)),

View file

@ -57,7 +57,7 @@ final class ArcanistHgClientChannel extends PhutilProtocolChannel {
*/
protected function encodeMessage($argv) {
if (!is_array($argv) || count($argv) !== 2) {
throw new Exception("Message should be <channel, data>.");
throw new Exception('Message should be <channel, data>.');
}
$channel = head($argv);

View file

@ -181,7 +181,7 @@ final class ArcanistHgProxyServer {
));
if (!$hg->update()) {
throw new Exception("Server exited unexpectedly!");
throw new Exception('Server exited unexpectedly!');
}
// Accept any new clients.
@ -353,7 +353,7 @@ final class ArcanistHgProxyServer {
$ok = stream_set_blocking($socket, 0);
if ($ok === false) {
throw new Exception("Unable to set socket nonblocking!");
throw new Exception('Unable to set socket nonblocking!');
}
return $socket;
@ -461,7 +461,7 @@ final class ArcanistHgProxyServer {
$pid = pcntl_fork();
if ($pid === -1) {
throw new Exception("Unable to fork!");
throw new Exception('Unable to fork!');
} else if ($pid) {
// We're the parent; exit. First, drop our reference to the socket so
// our __destruct() doesn't tear it down; the child will tear it down

View file

@ -86,7 +86,7 @@ final class ArcanistHgServerChannel extends PhutilProtocolChannel {
*/
protected function encodeMessage($argv) {
if (!is_array($argv)) {
throw new Exception("Message to Mercurial server should be an array.");
throw new Exception('Message to Mercurial server should be an array.');
}
$command = head($argv);

View file

@ -48,7 +48,7 @@ final class ArcanistLintPatcher {
}
Filesystem::writeFile($lint, $data);
list($err) = exec_manual("mv -f %s %s", $lint, $path);
list($err) = exec_manual('mv -f %s %s', $lint, $path);
if ($err) {
throw new Exception(
"Unable to overwrite path `{$path}', patched version was left ".

View file

@ -208,7 +208,7 @@ abstract class ArcanistLintEngine {
final public function run() {
$linters = $this->buildLinters();
if (!$linters) {
throw new ArcanistNoEffectException("No linters to run.");
throw new ArcanistNoEffectException('No linters to run.');
}
$linters = msort($linters, 'getLinterPriority');
@ -225,7 +225,7 @@ abstract class ArcanistLintEngine {
}
if (!$have_paths) {
throw new ArcanistNoEffectException("No paths are lintable.");
throw new ArcanistNoEffectException('No paths are lintable.');
}
$versions = array($this->getCacheVersion());

View file

@ -60,7 +60,7 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
public function setCustomSeverityMap(array $map) {
foreach ($map as $code => $severity) {
if (substr($code, 0, 2) === "SA" && $severity == "disabled") {
if (substr($code, 0, 2) === 'SA' && $severity == 'disabled') {
throw new Exception(
"In order to keep StyleCop integration with IDEs and other tools ".
"consistent with Arcanist results, you aren't permitted to ".
@ -88,42 +88,42 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
// Determine runtime engine (.NET or Mono).
if (phutil_is_windows()) {
$this->runtimeEngine = "";
} else if (Filesystem::binaryExists("mono")) {
$this->runtimeEngine = "mono ";
$this->runtimeEngine = '';
} else if (Filesystem::binaryExists('mono')) {
$this->runtimeEngine = 'mono ';
} else {
throw new Exception("Unable to find Mono and you are not on Windows!");
throw new Exception('Unable to find Mono and you are not on Windows!');
}
// Determine cslint path.
$cslint = $this->cslintHintPath;
if ($cslint !== null && file_exists($cslint)) {
$this->cslintEngine = Filesystem::resolvePath($cslint);
} else if (Filesystem::binaryExists("cslint.exe")) {
$this->cslintEngine = "cslint.exe";
} else if (Filesystem::binaryExists('cslint.exe')) {
$this->cslintEngine = 'cslint.exe';
} else {
throw new Exception("Unable to locate cslint.");
throw new Exception('Unable to locate cslint.');
}
// Determine cslint version.
$ver_future = new ExecFuture(
"%C -v",
'%C -v',
$this->runtimeEngine.$this->cslintEngine);
list($err, $stdout, $stderr) = $ver_future->resolve();
if ($err !== 0) {
throw new Exception(
"You are running an old version of cslint. Please ".
"upgrade to version ".self::SUPPORTED_VERSION.".");
'You are running an old version of cslint. Please '.
'upgrade to version '.self::SUPPORTED_VERSION.'.');
}
$ver = (int)$stdout;
if ($ver < self::SUPPORTED_VERSION) {
throw new Exception(
"You are running an old version of cslint. Please ".
"upgrade to version ".self::SUPPORTED_VERSION.".");
} elseif ($ver > self::SUPPORTED_VERSION) {
'You are running an old version of cslint. Please '.
'upgrade to version '.self::SUPPORTED_VERSION.'.');
} else if ($ver > self::SUPPORTED_VERSION) {
throw new Exception(
"Arcanist does not support this version of cslint (it is ".
"newer). You can try upgrading Arcanist with `arc upgrade`.");
'Arcanist does not support this version of cslint (it is '.
'newer). You can try upgrading Arcanist with `arc upgrade`.');
}
$this->loaded = true;
@ -158,7 +158,7 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
// settings JSON through base64-encoded to mitigate
// this issue.
$futures[] = new ExecFuture(
"%C --settings-base64=%s -r=. %Ls",
'%C --settings-base64=%s -r=. %Ls',
$this->runtimeEngine.$this->cslintEngine,
base64_encode(json_encode($this->discoveryMap)),
$current_paths);
@ -173,7 +173,7 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
// a future for those too.
if (count($current_paths) > 0) {
$futures[] = new ExecFuture(
"%C --settings-base64=%s -r=. %Ls",
'%C --settings-base64=%s -r=. %Ls',
$this->runtimeEngine.$this->cslintEngine,
base64_encode(json_encode($this->discoveryMap)),
$current_paths);

View file

@ -204,7 +204,7 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter {
* @task bin
*/
public function getDefaultInterpreter() {
throw new Exception("Incomplete implementation!");
throw new Exception('Incomplete implementation!');
}

View file

@ -128,10 +128,10 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter {
'Unrecognized lint message code "%s". Expected a valid flake8 '.
'lint code like "%s", or "%s", or "%s", or "%s".',
$code,
"E225",
"W291",
"F811",
"C901"));
'E225',
'W291',
'F811',
'C901'));
}
return $code;

View file

@ -221,7 +221,7 @@ abstract class ArcanistLinter {
if (isset($map[$code])) {
return $map[$code];
}
return "Unknown lint message!";
return 'Unknown lint message!';
}
final protected function addLintMessage(ArcanistLintMessage $message) {

View file

@ -125,8 +125,8 @@ final class ArcanistPEP8Linter extends ArcanistExternalLinter {
'Unrecognized lint message code "%s". Expected a valid PEP8 '.
'lint code like "%s" or "%s".',
$code,
"E101",
"W291"));
'E101',
'W291'));
}
return $code;

View file

@ -98,13 +98,13 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
}
private function getPyLintPath() {
$pylint_bin = "pylint";
$pylint_bin = 'pylint';
// Use the PyLint prefix specified in the config file
$config = $this->getEngine()->getConfigurationManager();
$prefix = $config->getConfigFromAnySource('lint.pylint.prefix');
if ($prefix !== null) {
$pylint_bin = $prefix."/bin/".$pylint_bin;
$pylint_bin = $prefix.'/bin/'.$pylint_bin;
}
if (!Filesystem::pathExists($pylint_bin)) {
@ -156,7 +156,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
}
$python_path[] = '';
return implode(":", $python_path);
return implode(':', $python_path);
}
private function getPyLintOptions() {
@ -164,8 +164,8 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
$options = array('-rn');
// Version 0.x.x include the pylint message ids in the output
if (version_compare($this->getLinterVersion(), "1", 'lt')) {
array_push($options, '-iy', "--output-format=text");
if (version_compare($this->getLinterVersion(), '1', 'lt')) {
array_push($options, '-iy', '--output-format=text');
}
// Version 1.x.x set the output specifically to the 0.x.x format
else {
@ -192,7 +192,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
$options = array_merge($options, $config_options);
}
return implode(" ", $options);
return implode(' ', $options);
}
public function getLinterName() {
@ -216,7 +216,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
// Assume a future version that at least is compatible with 1.x.x
if (count($lines) == 0 ||
!preg_match('/pylint\s((?:\d+\.?)+)/', $lines[0], $matches)) {
return "999";
return '999';
}
return $matches[1];
@ -264,7 +264,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
$message->setPath($path);
$message->setLine($matches[2]);
$message->setCode($matches[1]);
$message->setName($this->getLinterName()." ".$matches[1]);
$message->setName($this->getLinterName().' '.$matches[1]);
$message->setDescription($matches[3]);
$message->setSeverity($this->getMessageCodeSeverity($matches[1]));
$this->addLintMessage($message);

View file

@ -75,7 +75,7 @@ final class ArcanistRubyLinter extends ArcanistExternalLinter {
foreach ($lines as $line) {
$matches = null;
if (!preg_match("/(.*?):(\d+): (.*?)$/", $line, $matches)) {
if (!preg_match('/(.*?):(\d+): (.*?)$/', $line, $matches)) {
continue;
}

View file

@ -170,7 +170,7 @@ final class ArcanistTextLinter extends ArcanistLinter {
$this->raiseLintAtOffset(
strlen($data),
self::LINT_EOF_NEWLINE,
"Files must end in a newline.",
'Files must end in a newline.',
'',
"\n");
}

View file

@ -302,12 +302,12 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$this->raiseLintAtNode(
$strstr,
self::LINT_SLOWNESS,
"Use strpos() for checking if the string contains something.");
'Use strpos() for checking if the string contains something.');
} else if ($name == 'stristr') {
$this->raiseLintAtNode(
$strstr,
self::LINT_SLOWNESS,
"Use stripos() for checking if the string contains something.");
'Use stripos() for checking if the string contains something.');
}
}
}
@ -344,13 +344,13 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$this->raiseLintAtNode(
$strpos,
self::LINT_SLOWNESS,
"Use strncmp() for checking if the string starts with something.");
'Use strncmp() for checking if the string starts with something.');
} else if ($name == 'stripos') {
$this->raiseLintAtNode(
$strpos,
self::LINT_SLOWNESS,
"Use strncasecmp() for checking if the string starts with ".
"something.");
'Use strncasecmp() for checking if the string starts with '.
'something.');
}
}
}
@ -480,7 +480,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
self::LINT_PHP_53_FEATURES,
"This codebase targets PHP 5.3.0 on Windows, but `{$name}()` is not ".
"available there".
($windows ? " until PHP {$windows}" : "").".");
($windows ? " until PHP {$windows}" : '').".");
}
}
@ -510,9 +510,9 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$this->raiseLintAtNode(
$index->getChildByIndex(1),
self::LINT_PHP_54_FEATURES,
"The f()[...] syntax was not introduced until PHP 5.4, but this ".
"codebase targets an earlier version of PHP. You can rewrite ".
"this expression using idx().");
'The f()[...] syntax was not introduced until PHP 5.4, but this '.
'codebase targets an earlier version of PHP. You can rewrite '.
'this expression using idx().');
break;
}
}
@ -2044,7 +2044,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$this->raiseLintAtNode(
$unary,
self::LINT_EXIT_EXPRESSION,
"Use exit as a statement, not an expression.");
'Use exit as a statement, not an expression.');
}
}
}
@ -2208,8 +2208,8 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$message = $this->raiseLintAtNode(
$node,
self::LINT_DUPLICATE_KEYS_IN_ARRAY,
"Duplicate key in array initializer. PHP will ignore all ".
"but the last entry.");
'Duplicate key in array initializer. PHP will ignore all '.
'but the last entry.');
$locations = array();
foreach ($nodes_by_key[$key] as $node) {

View file

@ -5,7 +5,7 @@ final class ArcanistClosureLinterTestCase
public function testClosureLinter() {
$linter = new ArcanistClosureLinter();
$linter->setFlags(array("--additional_extensions=lint-test"));
$linter->setFlags(array('--additional_extensions=lint-test'));
$this->executeTestsInDirectory(
dirname(__FILE__).'/gjslint/',

View file

@ -43,7 +43,7 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer {
foreach ($message->getOtherLocations() as $location) {
$locations[] =
idx($location, 'path', $path).
(!empty($location['line']) ? ":{$location['line']}" : "");
(!empty($location['line']) ? ":{$location['line']}" : '');
}
$description .= "\nOther locations: ".implode(', ', $locations);
}
@ -226,7 +226,7 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer {
protected function renderLine($line, $data, $chevron = false, $diff = null) {
$chevron = $chevron ? '>>>' : '';
return sprintf(
" %3s %1s %6s %s",
' %3s %1s %6s %s',
$chevron,
$diff,
$line,

View file

@ -30,6 +30,6 @@ final class ArcanistLintJSONRenderer extends ArcanistLintRenderer {
}
public function renderOkayResult() {
return "";
return '';
}
}

View file

@ -30,6 +30,6 @@ final class ArcanistLintLikeCompilerRenderer extends ArcanistLintRenderer {
}
public function renderOkayResult() {
return "";
return '';
}
}

View file

@ -20,7 +20,7 @@ final class ArcanistLintSummaryRenderer extends ArcanistLintRenderer {
$text[] = "{$path}:{$line}:{$severity}: {$name}\n";
}
return implode("", $text);
return implode('', $text);
}
public function renderOkayResult() {

View file

@ -121,10 +121,10 @@ final class ArcanistBaseCommitParser {
switch ($name) {
case 'verbose':
$this->verbose = true;
$this->log("Enabled verbose mode.");
$this->log('Enabled verbose mode.');
break;
case 'prompt':
$reason = "it is what you typed when prompted.";
$reason = 'it is what you typed when prompted.';
$this->api->setBaseCommitExplanation($reason);
return phutil_console_prompt('Against which commit?');
case 'local':
@ -144,7 +144,7 @@ final class ArcanistBaseCommitParser {
case 'halt':
// Dump the whole stack.
$this->try = array();
$this->log("Halting all rule processing.");
$this->log('Halting all rule processing.');
return false;
case 'skip':
return null;

View file

@ -379,7 +379,7 @@ final class ArcanistBundle {
if (!$decompose_okay) {
throw new Exception(
"Failed to decompose multicopy changeset in order to generate diff.");
'Failed to decompose multicopy changeset in order to generate diff.');
}
}
@ -763,7 +763,7 @@ final class ArcanistBundle {
$content = array();
$content[] = "index {$old_sha1}..{$new_sha1}".$eol;
$content[] = "GIT binary patch".$eol;
$content[] = 'GIT binary patch'.$eol;
$content[] = "literal {$new_length}".$eol;
$content[] = $this->emitBinaryDiffBody($new_data).$eol;
@ -779,9 +779,9 @@ final class ArcanistBundle {
if (!function_exists('gzcompress')) {
throw new Exception(
"This patch has binary data. The PHP zlib extension is required to ".
"apply patches with binary data to git. Install the PHP zlib ".
"extension to continue.");
'This patch has binary data. The PHP zlib extension is required to '.
'apply patches with binary data to git. Install the PHP zlib '.
'extension to continue.');
}
// See emit_binary_diff_body() in diff.c for git's implementation.

View file

@ -349,7 +349,7 @@ final class ArcanistDiffParser {
$this->parseIndexHunk($change);
break;
default:
$this->didFailParse("Unknown diff type.");
$this->didFailParse('Unknown diff type.');
break;
}
} while ($this->getLine() !== null);
@ -526,7 +526,7 @@ final class ArcanistDiffParser {
protected function setIsGit($git) {
if ($this->isGit !== null && $this->isGit != $git) {
throw new Exception("Git status has changed!");
throw new Exception('Git status has changed!');
}
$this->isGit = $git;
return $this;
@ -817,7 +817,7 @@ final class ArcanistDiffParser {
$this->nextNonemptyLine();
return;
} else if (!preg_match('/^[a-zA-Z]/', $line)) {
$this->didFailParse("Expected base85 line length character (a-zA-Z).");
$this->didFailParse('Expected base85 line length character (a-zA-Z).');
}
} while (true);
}
@ -878,7 +878,7 @@ final class ArcanistDiffParser {
$line = $this->nextNonemptyLine();
$ok = preg_match('/^Property changes on:/', $line);
if (!$ok) {
$this->didFailParse("Confused by empty line");
$this->didFailParse('Confused by empty line');
}
$line = $this->nextLine();
return $this->parsePropertyHunk($change);
@ -966,7 +966,7 @@ final class ArcanistDiffParser {
}
if ($old_len || $new_len) {
$this->didFailParse("Found the wrong number of hunk lines.");
$this->didFailParse('Found the wrong number of hunk lines.');
}
$corpus = implode('', $real);
@ -1074,7 +1074,7 @@ final class ArcanistDiffParser {
protected function getLine() {
if ($this->text === null) {
throw new Exception("Not parsing!");
throw new Exception('Not parsing!');
}
if (isset($this->text[$this->line])) {
return $this->text[$this->line];
@ -1168,7 +1168,7 @@ final class ArcanistDiffParser {
$context = '';
for ($ii = $min; $ii <= $max; $ii++) {
$context .= sprintf(
"%8.8s %6.6s %s",
'%8.8s %6.6s %s',
($ii == $this->line) ? '>>> ' : '',
$ii + 1,
$this->text[$ii]);
@ -1182,7 +1182,7 @@ final class ArcanistDiffParser {
$temp->setPreserveFile(true);
Filesystem::writeFile($temp, $this->rawDiff);
$out[] = "Raw input file was written to: ".(string)$temp;
$out[] = 'Raw input file was written to: '.(string)$temp;
}
$out[] = $context;
@ -1392,7 +1392,7 @@ final class ArcanistDiffParser {
// 8. ("--")
// 9. Patch footer.
list($head, $tail) = preg_split("/^---$/m", $diff, 2);
list($head, $tail) = preg_split('/^---$/m', $diff, 2);
list($mail_headers, $mail_body) = explode("\n\n", $head, 2);
list($body, $foot) = preg_split('/^-- ?$/m', $tail, 2);
list($stat, $diff) = explode("\n\n", $body, 2);

View file

@ -148,7 +148,7 @@ final class ArcanistBundleTestCase extends ArcanistTestCase {
foreach ($raw_changes as $change) {
$this->assertTrue(
empty($changes[$change->getCurrentPath()]),
"Unique Path: ".$change->getCurrentPath());
'Unique Path: '.$change->getCurrentPath());
$changes[$change->getCurrentPath()] = $change;
}
@ -567,7 +567,7 @@ final class ArcanistBundleTestCase extends ArcanistTestCase {
case '228d7be4840313ed805c25c15bba0f7b188af3e6':
// "Add a text file."
// This commit is never reached because we skip the 0th commit junk.
$this->assertTrue(true, "This is never reached.");
$this->assertTrue(true, 'This is never reached.');
break;
default:
throw new Exception(

View file

@ -583,7 +583,7 @@ EOTEXT
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MESSAGE,
$change->getType());
$this->assertEqual("WIP", $change->getMetadata('message'));
$this->assertEqual('WIP', $change->getMetadata('message'));
$change = array_shift($changes);
$this->assertEqual(
@ -620,11 +620,11 @@ EOTEXT
public function testGitPathSplitting() {
static $tests = array(
"a/old.c b/new.c" => array('old.c', 'new.c'),
'a/old.c b/new.c' => array('old.c', 'new.c'),
"a/old.c b/new.c\n" => array('old.c', 'new.c'),
"a/old.c b/new.c\r\n" => array('old.c', 'new.c'),
"old.c new.c" => array('old.c', 'new.c'),
"1/old.c 2/new.c" => array('old.c', 'new.c'),
'old.c new.c' => array('old.c', 'new.c'),
'1/old.c 2/new.c' => array('old.c', 'new.c'),
'"a/\\"quotes1\\"" "b/\\"quotes2\\""' => array(
'"quotes1"',
'"quotes2"',
@ -637,11 +637,11 @@ EOTEXT
"\xE2\x98\x831",
"\xE2\x98\x832",
),
"a/Core Data/old.c b/Core Data/new.c" => array(
'a/Core Data/old.c b/Core Data/new.c' => array(
'Core Data/old.c',
'Core Data/new.c',
),
"some file with spaces.c some file with spaces.c" => array(
'some file with spaces.c some file with spaces.c' => array(
'some file with spaces.c',
'some file with spaces.c',
),
@ -657,7 +657,7 @@ EOTEXT
static $ambiguous = array(
"old file with spaces.c new file with spaces.c",
'old file with spaces.c new file with spaces.c',
);
foreach ($ambiguous as $input) {

View file

@ -271,7 +271,7 @@ final class ArcanistDiffChange {
$summary = array();
$summary[] = sprintf(
"%s %5.5s %s",
'%s %5.5s %s',
$char,
$attr,
$this->getCurrentPath());
@ -289,14 +289,14 @@ final class ArcanistDiffChange {
public function getSymlinkTarget() {
if ($this->getFileType() != ArcanistDiffChangeType::FILE_SYMLINK) {
throw new Exception("Not a symlink!");
throw new Exception('Not a symlink!');
}
$hunks = $this->getHunks();
$hunk = reset($hunks);
$corpus = $hunk->getCorpus();
$match = null;
if (!preg_match('/^\+(?:link )?(.*)$/m', $corpus, $match)) {
throw new Exception("Failed to extract link target!");
throw new Exception('Failed to extract link target!');
}
return trim($match[1]);
}

View file

@ -156,7 +156,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
if ($symbolic_commit !== null) {
if ($symbolic_commit == ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT) {
$this->setBaseCommitExplanation(
"you explicitly specified the empty tree.");
'you explicitly specified the empty tree.');
return $symbolic_commit;
}
@ -187,10 +187,10 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
if ($this->repositoryHasNoCommits) {
$this->setBaseCommitExplanation(
"the repository has no commits.");
'the repository has no commits.');
} else {
$this->setBaseCommitExplanation(
"the repository has only one commit.");
'the repository has only one commit.');
}
return self::GIT_MAGIC_ROOT_COMMIT;
@ -265,7 +265,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
"(Technically: the merge-base of the selected revision and HEAD is ".
"used to determine the start of the commit range.)");
$prompt = "What default do you want to use? [origin/master]";
$prompt = 'What default do you want to use? [origin/master]';
$default = phutil_console_prompt($prompt);
if (!strlen(trim($default))) {
@ -453,13 +453,13 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
// Convert svn revision number to git hash
public function getHashFromFromSVNRevisionNumber($revision_id) {
return $this->executeSVNFindRev("r".$revision_id, "Git");
return $this->executeSVNFindRev('r'.$revision_id, 'Git');
}
// Convert a git hash to svn revision number
public function getSVNRevisionNumberFromHash($hash) {
return $this->executeSVNFindRev($hash, "SVN");
return $this->executeSVNFindRev($hash, 'SVN');
}
@ -710,7 +710,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
$line,
$matches);
if (!$ok) {
throw new Exception("Failed to parse git ls-tree output!");
throw new Exception('Failed to parse git ls-tree output!');
}
$result[$matches[4]] = array(
'mode' => $matches[1],
@ -836,7 +836,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
public function performLocalBranchMerge($branch, $message) {
if (!$branch) {
throw new ArcanistUsageException(
"Under git, you must specify the branch you want to merge.");
'Under git, you must specify the branch you want to merge.');
}
$err = phutil_passthru(
'(cd %s && git merge --no-ff -m %s %s)',
@ -845,7 +845,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
$branch);
if ($err) {
throw new ArcanistUsageException("Merge failed!");
throw new ArcanistUsageException('Merge failed!');
}
}
@ -917,8 +917,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
foreach ($results as $key => $result) {
$results[$key]['why'] =
"A git commit or tree hash in the commit range is already attached ".
"to the Differential revision.";
'A git commit or tree hash in the commit range is already attached '.
'to the Differential revision.';
}
return $results;
@ -953,7 +953,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
}
public function getBackoutMessage($commit_hash) {
return "This reverts commit ".$commit_hash.".";
return 'This reverts commit '.$commit_hash.'.';
}
public function isGitSubversionRepo() {

View file

@ -133,8 +133,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
}
}
$this->setBaseCommitExplanation("it is the greatest common ancestor of ".
"the working directory and the commit you specified explicitly.");
$this->setBaseCommitExplanation('it is the greatest common ancestor of '.
'the working directory and the commit you specified explicitly.');
return $commit;
}
@ -174,8 +174,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
if (!$logs) {
$this->setBaseCommitExplanation(
"you have no outgoing commits, so arc assumes you intend to submit ".
"uncommitted changes in the working copy.");
'you have no outgoing commits, so arc assumes you intend to submit '.
'uncommitted changes in the working copy.');
return $this->getWorkingCopyRevision();
}
@ -217,11 +217,11 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
if ($against == 'null') {
$this->setBaseCommitExplanation(
"this is a new repository (all changes are outgoing).");
'this is a new repository (all changes are outgoing).');
} else {
$this->setBaseCommitExplanation(
"it is the first commit reachable from the working copy state ".
"which is not outgoing.");
'it is the first commit reachable from the working copy state '.
'which is not outgoing.');
}
return $against;
@ -231,7 +231,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
if ($this->localCommitInfo === null) {
$base_commit = $this->getBaseCommit();
list($info) = $this->execxLocal(
"log --template %s --rev %s --branch %s --",
'log --template %s --rev %s --branch %s --',
"{node}\1{rev}\1{author}\1".
"{date|rfc822date}\1{branch}\1{tag}\1{parents}\1{desc}\2",
hgsprintf('(%s::. - %s)', $base_commit, $base_commit),
@ -522,13 +522,13 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
if ($err) {
return false;
} else {
return (strpos($stdout, "amend") !== false);
return (strpos($stdout, 'amend') !== false);
}
}
public function supportsRebase() {
if ($this->supportsRebase === null) {
list ($err) = $this->execManualLocal("help rebase");
list ($err) = $this->execManualLocal('help rebase');
$this->supportsRebase = $err === 0;
}
@ -537,7 +537,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
public function supportsPhases() {
if ($this->supportsPhases === null) {
list ($err) = $this->execManualLocal("help phase");
list ($err) = $this->execManualLocal('help phase');
$this->supportsPhases = $err === 0;
}
@ -616,7 +616,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
}
if ($err) {
throw new ArcanistUsageException("Merge failed!");
throw new ArcanistUsageException('Merge failed!');
}
}
@ -628,7 +628,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
public function getCommitMessageLog() {
$base_commit = $this->getBaseCommit();
list($stdout) = $this->execxLocal(
"log --template %s --rev %s --branch %s --",
'log --template %s --rev %s --branch %s --',
"{node}\1{desc}\2",
hgsprintf('(%s::. - %s)', $base_commit, $base_commit),
$this->getBranchName());
@ -698,8 +698,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
foreach ($results as $key => $hash) {
$results[$key]['why'] =
"A mercurial commit hash in the commit range is already attached ".
"to the Differential revision.";
'A mercurial commit hash in the commit range is already attached '.
'to the Differential revision.';
}
return $results;
@ -796,7 +796,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
}
public function getBackoutMessage($commit_hash) {
return "Backed out changeset ".$commit_hash.".";
return 'Backed out changeset '.$commit_hash.'.';
}
public function resolveBaseCommitRule($rule, $source) {

View file

@ -64,7 +64,7 @@ abstract class ArcanistRepositoryAPI {
if (!$working_copy) {
throw new Exception(
pht(
"Trying to create a RepositoryAPI without a working copy!"));
'Trying to create a RepositoryAPI without a working copy!'));
}
$root = $working_copy->getProjectRoot();
@ -81,9 +81,9 @@ abstract class ArcanistRepositoryAPI {
default:
throw new Exception(
pht(
"The current working directory is not part of a working copy for ".
"a supported version control system (Git, Subversion or ".
"Mercurial)."));
'The current working directory is not part of a working copy for '.
'a supported version control system (Git, Subversion or '.
'Mercurial).'));
}
$api->configurationManager = $configuration_manager;

View file

@ -631,7 +631,7 @@ EODIFF;
public function getFinalizedRevisionMessage() {
// In other VCSes we give push instructions here, but it never makes sense
// in SVN.
return "Done.";
return 'Done.';
}
public function loadWorkingCopyDifferentialRevisions(
@ -660,7 +660,7 @@ EODIFF;
foreach ($results as $key => $result) {
$results[$key]['why'] =
"Matching arcanist project name and working copy directory path.";
'Matching arcanist project name and working copy directory path.';
}
return $results;

View file

@ -32,18 +32,18 @@ final class ArcanistXUnitTestResultParser {
}
$results = array();
$testcases = $xunit_dom->getElementsByTagName("testcase");
$testcases = $xunit_dom->getElementsByTagName('testcase');
foreach ($testcases as $testcase) {
$classname = $testcase->getAttribute("classname");
$name = $testcase->getAttribute("name");
$time = $testcase->getAttribute("time");
$classname = $testcase->getAttribute('classname');
$name = $testcase->getAttribute('name');
$time = $testcase->getAttribute('time');
$status = ArcanistUnitTestResult::RESULT_PASS;
$user_data = "";
$user_data = '';
// A skipped test is a test which was ignored using framework
// mechanizms (e.g. @skip decorator)
$skipped = $testcase->getElementsByTagName("skipped");
$skipped = $testcase->getElementsByTagName('skipped');
if ($skipped->length > 0) {
$status = ArcanistUnitTestResult::RESULT_SKIP;
$messages = array();
@ -56,7 +56,7 @@ final class ArcanistXUnitTestResultParser {
// Failure is a test which the code has explicitly failed by using
// the mechanizms for that purpose. e.g., via an assertEquals
$failures = $testcase->getElementsByTagName("failure");
$failures = $testcase->getElementsByTagName('failure');
if ($failures->length > 0) {
$status = ArcanistUnitTestResult::RESULT_FAIL;
$messages = array();
@ -70,7 +70,7 @@ final class ArcanistXUnitTestResultParser {
// An errored test is one that had an unanticipated problem. e.g., an
// unchecked throwable, or a problem with an implementation of the
// test.
$errors = $testcase->getElementsByTagName("error");
$errors = $testcase->getElementsByTagName('error');
if ($errors->length > 0) {
$status = ArcanistUnitTestResult::RESULT_BROKEN;
$messages = array();
@ -82,7 +82,7 @@ final class ArcanistXUnitTestResultParser {
}
$result = new ArcanistUnitTestResult();
$result->setName($classname.".".$name);
$result->setName($classname.'.'.$name);
$result->setResult($status);
$result->setDuration($time);
$result->setUserData($user_data);

View file

@ -50,8 +50,8 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
$this->coverEngine = Filesystem::resolvePath($cscover);
} else {
throw new Exception(
"Unable to locate cscover coverage runner ".
"(have you built yet?)");
'Unable to locate cscover coverage runner '.
'(have you built yet?)');
}
}
@ -95,7 +95,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
// FIXME: Can't use TempFile here as xUnit doesn't like
// UNIX-style full paths. It sees the leading / as the
// start of an option flag, even when quoted.
$xunit_temp = Filesystem::readRandomCharacters(10).".results.xml";
$xunit_temp = Filesystem::readRandomCharacters(10).'.results.xml';
if (file_exists($xunit_temp)) {
unlink($xunit_temp);
}
@ -103,15 +103,15 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
$cover_temp->setPreserveFile(true);
$xunit_cmd = $this->runtimeEngine;
$xunit_args = null;
if ($xunit_cmd === "") {
if ($xunit_cmd === '') {
$xunit_cmd = $this->testEngine;
$xunit_args = csprintf(
"%s /xml %s",
'%s /xml %s',
$test_assembly,
$xunit_temp);
} else {
$xunit_args = csprintf(
"%s %s /xml %s",
'%s %s /xml %s',
$this->testEngine,
$test_assembly,
$xunit_temp);
@ -119,7 +119,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
$assembly_dir = dirname($test_assembly);
$assemblies_to_instrument = array();
foreach (Filesystem::listDirectory($assembly_dir) as $file) {
if (substr($file, -4) == ".dll" || substr($file, -4) == ".exe") {
if (substr($file, -4) == '.dll' || substr($file, -4) == '.exe') {
if ($this->assemblyShouldBeInstrumented($file)) {
$assemblies_to_instrument[] = $assembly_dir.DIRECTORY_SEPARATOR.$file;
}
@ -129,8 +129,8 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
return parent::buildTestFuture($test_assembly);
}
$future = new ExecFuture(
"%C -o %s -c %s -a %s -w %s %Ls",
trim($this->runtimeEngine." ".$this->coverEngine),
'%C -o %s -c %s -a %s -w %s %Ls',
trim($this->runtimeEngine.' '.$this->coverEngine),
$cover_temp,
$xunit_cmd,
$xunit_args,
@ -200,9 +200,9 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
$results = array();
foreach ($tags as $tag) {
$results[] = array(
"file" => $tag->getAttribute("file"),
"start" => $tag->getAttribute("start"),
"end" => $tag->getAttribute("end"));
'file' => $tag->getAttribute('file'),
'start' => $tag->getAttribute('start'),
'end' => $tag->getAttribute('end'));
}
return $results;
}
@ -229,12 +229,12 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
$executed = array();
$instrumented = $this->processTags(
$coverage_dom->getElementsByTagName("instrumented"));
$coverage_dom->getElementsByTagName('instrumented'));
$executed = $this->processTags(
$coverage_dom->getElementsByTagName("executed"));
$coverage_dom->getElementsByTagName('executed'));
foreach ($instrumented as $instrument) {
$absolute_file = $instrument["file"];
$absolute_file = $instrument['file'];
$relative_file = substr($absolute_file, strlen($this->projectRoot) + 1);
if (!in_array($relative_file, $files)) {
$files[] = $relative_file;
@ -254,24 +254,24 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
}
foreach ($instrumented as $instrument) {
if ($instrument["file"] !== $absolute_file) {
if ($instrument['file'] !== $absolute_file) {
continue;
}
for (
$i = $instrument["start"];
$i <= $instrument["end"];
$i = $instrument['start'];
$i <= $instrument['end'];
$i++) {
$coverage[$i - 1] = 'U';
}
}
foreach ($executed as $execute) {
if ($execute["file"] !== $absolute_file) {
if ($execute['file'] !== $absolute_file) {
continue;
}
for (
$i = $execute["start"];
$i <= $execute["end"];
$i = $execute['start'];
$i <= $execute['end'];
$i++) {
$coverage[$i - 1] = 'C';
}

View file

@ -28,13 +28,13 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser {
$results = array();
// We'll get our full test case name at the end and add it back in
$test_case_name = "";
$test_case_name = '';
// Temp store for test case results (in case we run multiple test cases)
$test_case_results = array();
foreach ($test_results as $i => $line) {
if (strncmp($line, "--- PASS", 8) === 0) {
if (strncmp($line, '--- PASS', 8) === 0) {
// We have a passing test
$meta = array();
preg_match(
@ -53,7 +53,7 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser {
continue;
}
if (strncmp($line, "--- FAIL", 8) === 0) {
if (strncmp($line, '--- FAIL', 8) === 0) {
// We have a failing test
$reason = trim($test_results[$i + 1]);
$meta = array();
@ -73,21 +73,21 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser {
continue;
}
if (strncmp($line, "ok", 2) === 0) {
if (strncmp($line, 'ok', 2) === 0) {
$meta = array();
preg_match(
'/^ok[\s\t]+(?P<test_name>\w.*)[\s\t]+(?P<time>.*)s.*/',
$line,
$meta);
$test_case_name = str_replace("/", "::", $meta['test_name']);
$test_case_name = str_replace('/', '::', $meta['test_name']);
// Our test case passed
// check to make sure we were in verbose (-v) mode
if (empty($test_case_results)) {
// We weren't in verbose mode
// create one successful result for the whole test case
$test_name = "Go::TestCase::".$test_case_name;
$test_name = 'Go::TestCase::'.$test_case_name;
$result = new ArcanistUnitTestResult();
$result->setName($test_name);
@ -113,7 +113,7 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser {
$line,
$meta);
$test_case_name = str_replace("/", "::", $meta['test_name']);
$test_case_name = str_replace('/', '::', $meta['test_name']);
$test_case_results = $this->fixNames(
$test_case_results,
@ -132,7 +132,7 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser {
foreach ($test_case_results as &$result) {
$test_name = $result->getName();
$result->setName("Go::Test::".$test_case_name."::".$test_name);
$result->setName('Go::Test::'.$test_case_name.'::'.$test_name);
}
return $test_case_results;

View file

@ -18,7 +18,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
$absolute_path = Filesystem::resolvePath($path);
if (is_dir($absolute_path)) {
$absolute_test_path = Filesystem::resolvePath("tests/".$path);
$absolute_test_path = Filesystem::resolvePath('tests/'.$path);
if (is_readable($absolute_test_path)) {
$affected_tests[] = $absolute_test_path;
}
@ -29,7 +29,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
$directory = dirname($path);
// assumes directory layout: tests/<package>/test_<module>.py
$relative_test_path = "tests/".$directory."/test_".$filename;
$relative_test_path = 'tests/'.$directory.'/test_'.$filename;
$absolute_test_path = Filesystem::resolvePath($relative_test_path);
if (is_readable($absolute_test_path)) {
@ -87,16 +87,16 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
}
public function buildTestFuture($path, $xunit_tmp, $cover_tmp) {
$cmd_line = csprintf("nosetests --with-xunit --xunit-file=%s",
$cmd_line = csprintf('nosetests --with-xunit --xunit-file=%s',
$xunit_tmp);
if ($this->getEnableCoverage() !== false) {
$cmd_line .= csprintf(" --with-coverage --cover-xml " .
"--cover-xml-file=%s",
$cmd_line .= csprintf(' --with-coverage --cover-xml ' .
'--cover-xml-file=%s',
$cover_tmp);
}
return new ExecFuture("%C %s", $cmd_line, $path);
return new ExecFuture('%C %s', $cmd_line, $path);
}
public function parseTestResults($source_path, $xunit_tmp, $cover_tmp) {
@ -119,10 +119,10 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
$coverage_dom->loadXML(Filesystem::readFile($cover_file));
$reports = array();
$classes = $coverage_dom->getElementsByTagName("class");
$classes = $coverage_dom->getElementsByTagName('class');
foreach ($classes as $class) {
$path = $class->getAttribute("filename");
$path = $class->getAttribute('filename');
$root = $this->getWorkingCopy()->getProjectRoot();
if (!Filesystem::isDescendant($path, $root)) {
@ -132,21 +132,21 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
// get total line count in file
$line_count = count(phutil_split_lines(Filesystem::readFile($path)));
$coverage = "";
$coverage = '';
$start_line = 1;
$lines = $class->getElementsByTagName("line");
$lines = $class->getElementsByTagName('line');
for ($ii = 0; $ii < $lines->length; $ii++) {
$line = $lines->item($ii);
$next_line = intval($line->getAttribute("number"));
$next_line = intval($line->getAttribute('number'));
for ($start_line; $start_line < $next_line; $start_line++) {
$coverage .= "N";
$coverage .= 'N';
}
if (intval($line->getAttribute("hits")) == 0) {
$coverage .= "U";
} else if (intval($line->getAttribute("hits")) > 0) {
$coverage .= "C";
if (intval($line->getAttribute('hits')) == 0) {
$coverage .= 'U';
} else if (intval($line->getAttribute('hits')) > 0) {
$coverage .= 'C';
}
$start_line++;
@ -154,7 +154,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
if ($start_line < $line_count) {
foreach (range($start_line, $line_count) as $line_num) {
$coverage .= "N";
$coverage .= 'N';
}
}

View file

@ -71,7 +71,7 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
$config = $this->configFile ? csprintf('-c %s', $this->configFile) : null;
$stderr = "-d display_errors=stderr";
$stderr = '-d display_errors=stderr';
$futures[$test_path] = new ExecFuture('%C %C %C --log-json %s %C %s',
$this->phpunitBinary, $config, $stderr, $json_tmp, $clover, $test_path);

View file

@ -19,7 +19,7 @@ final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
}
if (!$run_tests) {
throw new ArcanistNoEffectException("No tests to run.");
throw new ArcanistNoEffectException('No tests to run.');
}
$enable_coverage = $this->getEnableCoverage();
@ -27,8 +27,8 @@ final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
if (!function_exists('xdebug_start_code_coverage')) {
if ($enable_coverage === true) {
throw new ArcanistUsageException(
"You specified --coverage but xdebug is not available, so ".
"coverage can not be enabled for PhutilUnitTestEngine.");
'You specified --coverage but xdebug is not available, so '.
'coverage can not be enabled for PhutilUnitTestEngine.');
}
} else {
$enable_coverage = true;

View file

@ -64,29 +64,29 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
$paths = $this->getPaths();
$reports = array();
$classes = $coverage_dom->getElementsByTagName("class");
$classes = $coverage_dom->getElementsByTagName('class');
foreach ($classes as $class) {
// filename is actually python module path with ".py" at the end,
// e.g.: tornado.web.py
$relative_path = explode(".", $class->getAttribute("filename"));
$relative_path = explode('.', $class->getAttribute('filename'));
array_pop($relative_path);
$relative_path = implode("/", $relative_path);
$relative_path = implode('/', $relative_path);
// first we check if the path is a directory (a Python package), if it is
// set relative and absolute paths to have __init__.py at the end.
$absolute_path = Filesystem::resolvePath($relative_path);
if (is_dir($absolute_path)) {
$relative_path .= "/__init__.py";
$absolute_path .= "/__init__.py";
$relative_path .= '/__init__.py';
$absolute_path .= '/__init__.py';
}
// then we check if the path with ".py" at the end is file (a Python
// submodule), if it is - set relative and absolute paths to have
// ".py" at the end.
if (is_file($absolute_path.".py")) {
$relative_path .= ".py";
$absolute_path .= ".py";
if (is_file($absolute_path.'.py')) {
$relative_path .= '.py';
$absolute_path .= '.py';
}
if (!file_exists($absolute_path)) {
@ -100,22 +100,22 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
// get total line count in file
$line_count = count(file($absolute_path));
$coverage = "";
$coverage = '';
$start_line = 1;
$lines = $class->getElementsByTagName("line");
$lines = $class->getElementsByTagName('line');
for ($ii = 0; $ii < $lines->length; $ii++) {
$line = $lines->item($ii);
$next_line = intval($line->getAttribute("number"));
$next_line = intval($line->getAttribute('number'));
for ($start_line; $start_line < $next_line; $start_line++) {
$coverage .= "N";
$coverage .= 'N';
}
if (intval($line->getAttribute("hits")) == 0) {
$coverage .= "U";
if (intval($line->getAttribute('hits')) == 0) {
$coverage .= 'U';
}
else if (intval($line->getAttribute("hits")) > 0) {
$coverage .= "C";
else if (intval($line->getAttribute('hits')) > 0) {
$coverage .= 'C';
}
$start_line++;
@ -123,7 +123,7 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
if ($start_line < $line_count) {
foreach (range($start_line, $line_count) as $line_num) {
$coverage .= "N";
$coverage .= 'N';
}
}

View file

@ -38,21 +38,21 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$this->projectRoot = $this->getWorkingCopy()->getProjectRoot();
// Determine build engine.
if (Filesystem::binaryExists("msbuild")) {
$this->buildEngine = "msbuild";
} else if (Filesystem::binaryExists("xbuild")) {
$this->buildEngine = "xbuild";
if (Filesystem::binaryExists('msbuild')) {
$this->buildEngine = 'msbuild';
} else if (Filesystem::binaryExists('xbuild')) {
$this->buildEngine = 'xbuild';
} else {
throw new Exception("Unable to find msbuild or xbuild in PATH!");
throw new Exception('Unable to find msbuild or xbuild in PATH!');
}
// Determine runtime engine (.NET or Mono).
if (phutil_is_windows()) {
$this->runtimeEngine = "";
} else if (Filesystem::binaryExists("mono")) {
$this->runtimeEngine = Filesystem::resolveBinary("mono");
$this->runtimeEngine = '';
} else if (Filesystem::binaryExists('mono')) {
$this->runtimeEngine = Filesystem::resolveBinary('mono');
} else {
throw new Exception("Unable to find Mono and you are not on Windows!");
throw new Exception('Unable to find Mono and you are not on Windows!');
}
// Read the discovery rules.
@ -61,8 +61,8 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
'unit.csharp.discovery');
if ($this->discoveryRules === null) {
throw new Exception(
"You must configure discovery rules to map C# files ".
"back to test projects (`unit.csharp.discovery` in .arcconfig).");
'You must configure discovery rules to map C# files '.
'back to test projects (`unit.csharp.discovery` in .arcconfig).');
}
// Determine xUnit test runner path.
@ -74,8 +74,8 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$xunit = $this->projectRoot.DIRECTORY_SEPARATOR.$this->xunitHintPath;
if (file_exists($xunit) && $this->xunitHintPath !== null) {
$this->testEngine = Filesystem::resolvePath($xunit);
} else if (Filesystem::binaryExists("xunit.console.clr4.exe")) {
$this->testEngine = "xunit.console.clr4.exe";
} else if (Filesystem::binaryExists('xunit.console.clr4.exe')) {
$this->testEngine = 'xunit.console.clr4.exe';
} else {
throw new Exception(
"Unable to locate xUnit console runner. Configure ".
@ -204,23 +204,23 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
private function generateProjects() {
// No "Build" directory; so skip generation of projects.
if (!is_dir(Filesystem::resolvePath($this->projectRoot."/Build"))) {
if (!is_dir(Filesystem::resolvePath($this->projectRoot.'/Build'))) {
return array();
}
// No "Protobuild.exe" file; so skip generation of projects.
if (!is_file(Filesystem::resolvePath(
$this->projectRoot."/Protobuild.exe"))) {
$this->projectRoot.'/Protobuild.exe'))) {
return array();
}
// Work out what platform the user is building for already.
$platform = phutil_is_windows() ? "Windows" : "Linux";
$platform = phutil_is_windows() ? 'Windows' : 'Linux';
$files = Filesystem::listDirectory($this->projectRoot);
foreach ($files as $file) {
if (strtolower(substr($file, -4)) == ".sln") {
$parts = explode(".", $file);
if (strtolower(substr($file, -4)) == '.sln') {
$parts = explode('.', $file);
$platform = $parts[count($parts) - 2];
break;
}
@ -228,7 +228,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$regenerate_start = microtime(true);
$regenerate_future = new ExecFuture(
"%C Protobuild.exe --resync %s",
'%C Protobuild.exe --resync %s',
$this->runtimeEngine,
$platform);
$regenerate_future->setCWD(Filesystem::resolvePath(
@ -271,9 +271,9 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$results = array();
foreach ($test_assemblies as $test_assembly) {
$build_future = new ExecFuture(
"%C %s",
'%C %s',
$this->buildEngine,
"/p:SkipTestsOnBuild=True");
'/p:SkipTestsOnBuild=True');
$build_future->setCWD(Filesystem::resolvePath(
dirname($test_assembly['project'])));
$build_futures[$test_assembly['project']] = $build_future;
@ -281,7 +281,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$iterator = Futures($build_futures)->limit(1);
foreach ($iterator as $test_assembly => $future) {
$result = new ArcanistUnitTestResult();
$result->setName("(build) ".$test_assembly);
$result->setName('(build) '.$test_assembly);
try {
$future->resolvex();
@ -314,20 +314,20 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
// FIXME: Can't use TempFile here as xUnit doesn't like
// UNIX-style full paths. It sees the leading / as the
// start of an option flag, even when quoted.
$xunit_temp = Filesystem::readRandomCharacters(10).".results.xml";
$xunit_temp = Filesystem::readRandomCharacters(10).'.results.xml';
if (file_exists($xunit_temp)) {
unlink($xunit_temp);
}
$future = new ExecFuture(
"%C %s /xml %s",
trim($this->runtimeEngine." ".$this->testEngine),
'%C %s /xml %s',
trim($this->runtimeEngine.' '.$this->testEngine),
$test_assembly,
$xunit_temp);
$folder = Filesystem::resolvePath($this->projectRoot);
$future->setCWD($folder);
$combined = $folder."/".$xunit_temp;
$combined = $folder.'/'.$xunit_temp;
if (phutil_is_windows()) {
$combined = $folder."\\".$xunit_temp;
$combined = $folder.'\\'.$xunit_temp;
}
return array($future, $combined, null);
}
@ -408,32 +408,32 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$xunit_dom->loadXML(Filesystem::readFile($xunit_tmp));
$results = array();
$tests = $xunit_dom->getElementsByTagName("test");
$tests = $xunit_dom->getElementsByTagName('test');
foreach ($tests as $test) {
$name = $test->getAttribute("name");
$time = $test->getAttribute("time");
$name = $test->getAttribute('name');
$time = $test->getAttribute('time');
$status = ArcanistUnitTestResult::RESULT_UNSOUND;
switch ($test->getAttribute("result")) {
case "Pass":
switch ($test->getAttribute('result')) {
case 'Pass':
$status = ArcanistUnitTestResult::RESULT_PASS;
break;
case "Fail":
case 'Fail':
$status = ArcanistUnitTestResult::RESULT_FAIL;
break;
case "Skip":
case 'Skip':
$status = ArcanistUnitTestResult::RESULT_SKIP;
break;
}
$userdata = "";
$reason = $test->getElementsByTagName("reason");
$failure = $test->getElementsByTagName("failure");
$userdata = '';
$reason = $test->getElementsByTagName('reason');
$failure = $test->getElementsByTagName('failure');
if ($reason->length > 0 || $failure->length > 0) {
$node = ($reason->length > 0) ? $reason : $failure;
$message = $node->item(0)->getElementsByTagName("message");
$message = $node->item(0)->getElementsByTagName('message');
if ($message->length > 0) {
$userdata = $message->item(0)->nodeValue;
}
$stacktrace = $node->item(0)->getElementsByTagName("stack-trace");
$stacktrace = $node->item(0)->getElementsByTagName('stack-trace');
if ($stacktrace->length > 0) {
$userdata .= "\n".$stacktrace->item(0)->nodeValue;
}

View file

@ -19,7 +19,7 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
$this->assertEqual(2, count($parsed_results));
$this->assertEqual(
"Go::Test::package::subpackage::TestFoo",
'Go::Test::package::subpackage::TestFoo',
$parsed_results[0]->getName());
foreach ($parsed_results as $result) {
$this->assertEqual(
@ -53,10 +53,10 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
$this->assertEqual(3, count($parsed_results));
$this->assertEqual(
"Go::Test::package::subpackage1::TestFoo1",
'Go::Test::package::subpackage1::TestFoo1',
$parsed_results[0]->getName());
$this->assertEqual(
"Go::Test::package::subpackage2::TestFoo2",
'Go::Test::package::subpackage2::TestFoo2',
$parsed_results[2]->getName());
foreach ($parsed_results as $result) {
$this->assertEqual(
@ -74,10 +74,10 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
$this->assertEqual(3, count($parsed_results));
$this->assertEqual(
"Go::Test::package::subpackage1::TestFoo1",
'Go::Test::package::subpackage1::TestFoo1',
$parsed_results[0]->getName());
$this->assertEqual(
"Go::Test::package::subpackage2::TestFoo2",
'Go::Test::package::subpackage2::TestFoo2',
$parsed_results[2]->getName());
$this->assertEqual(
ArcanistUnitTestResult::RESULT_PASS,
@ -96,10 +96,10 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
$this->assertEqual(2, count($parsed_results));
$this->assertEqual(
"Go::TestCase::package::subpackage1",
'Go::TestCase::package::subpackage1',
$parsed_results[0]->getName());
$this->assertEqual(
"Go::TestCase::package::subpackage2",
'Go::TestCase::package::subpackage2',
$parsed_results[1]->getName());
foreach ($parsed_results as $result) {
$this->assertEqual(

View file

@ -43,7 +43,7 @@ final class PhutilUnitTestEngineTestCase extends ArcanistTestCase {
public function __destruct() {
if (self::$allTestsCounter !== 0) {
throw new Exception(
"didRunTests() was not called correctly after tests completed!");
'didRunTests() was not called correctly after tests completed!');
}
}
@ -107,7 +107,7 @@ final class PhutilUnitTestEngineTestCase extends ArcanistTestCase {
protected function throwIfFalsey($input) {
if (!$input) {
throw new Exception("This is a negative test case!");
throw new Exception('This is a negative test case!');
}
}

View file

@ -97,13 +97,13 @@ abstract class ArcanistPhutilTestCase {
if ($message !== null) {
$output = pht(
"Assertion failed, expected values to be equal (at %s:%d): %s",
'Assertion failed, expected values to be equal (at %s:%d): %s',
$file,
$line,
$message);
} else {
$output = pht(
"Assertion failed, expected values to be equal (at %s:%d).",
'Assertion failed, expected values to be equal (at %s:%d).',
$file,
$line);
}
@ -216,7 +216,7 @@ abstract class ArcanistPhutilTestCase {
if (count($inputs) !== count($expect)) {
$this->assertFailure(
"Input and expectations must have the same number of values.");
'Input and expectations must have the same number of values.');
}
$labels = array_keys($inputs);
@ -500,7 +500,7 @@ abstract class ArcanistPhutilTestCase {
throw head($exceptions);
} else {
throw new PhutilAggregateException(
"Multiple exceptions were raised during test execution.",
'Multiple exceptions were raised during test execution.',
$exceptions);
}
}

View file

@ -57,7 +57,7 @@ final class ArcanistUnitConsoleRenderer extends ArcanistUnitRenderer {
$star = "\xE2\x98\x85";
if (phutil_is_windows()) {
// Fall-back to normal asterisk for Windows consoles.
$star = "*";
$star = '*';
}
$acceptableness = array(
50 => "<fg:green>%s</fg><fg:yellow>{$star}</fg> ",

View file

@ -73,15 +73,15 @@ EOTEXT
if ($this->isHistoryImmutable()) {
throw new ArcanistUsageException(
"This project is marked as adhering to a conservative history ".
"mutability doctrine (having an immutable local history), which ".
"precludes amending commit messages.");
'This project is marked as adhering to a conservative history '.
'mutability doctrine (having an immutable local history), which '.
'precludes amending commit messages.');
}
if ($repository_api->getUncommittedChanges()) {
throw new ArcanistUsageException(
"You have uncommitted changes in this branch. Stage and commit (or ".
"revert) them before proceeding.");
'You have uncommitted changes in this branch. Stage and commit (or '.
'revert) them before proceeding.');
}
}

View file

@ -62,12 +62,12 @@ EOTEXT
'The revision you provided does not exist!');
}
$revision = $revisions[0];
$commits = $revision["commits"];
$commits = $revision['commits'];
if (!$commits) {
throw new ArcanistUsageException(
'This revision has not been committed yet!');
}
elseif (count($commits) > 1) {
else if (count($commits) > 1) {
throw new ArcanistUsageException(
'The revision you provided has multiple commits!');
}
@ -77,7 +77,7 @@ EOTEXT
array(
'phids' => array($commit_phid),
));
$commit_id = $commit[$commit_phid]["name"];
$commit_id = $commit[$commit_phid]['name'];
return $commit_id;
}
@ -91,7 +91,7 @@ EOTEXT
));
$commit = $result[$commit_id];
// This commit was not found in Diffusion
if (array_key_exists("error", $commit)) {
if (array_key_exists('error', $commit)) {
return null;
}
return $commit;

View file

@ -139,7 +139,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
final public function setConduitURI($conduit_uri) {
if ($this->conduit) {
throw new Exception(
"You can not change the Conduit URI after a conduit is already open.");
'You can not change the Conduit URI after a conduit is already open.');
}
$this->conduitURI = $conduit_uri;
return $this;
@ -176,8 +176,8 @@ abstract class ArcanistBaseWorkflow extends Phobject {
if (!$this->conduitURI) {
throw new Exception(
"You must specify a Conduit URI with setConduitURI() before you can ".
"establish a conduit.");
'You must specify a Conduit URI with setConduitURI() before you can '.
'establish a conduit.');
}
$this->conduit = new ConduitClient($this->conduitURI);
@ -222,7 +222,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
final public function setConduitCredentials(array $credentials) {
if ($this->isConduitAuthenticated()) {
throw new Exception(
"You may not set new credentials after authenticating conduit.");
'You may not set new credentials after authenticating conduit.');
}
$this->conduitCredentials = $credentials;
@ -315,8 +315,8 @@ abstract class ArcanistBaseWorkflow extends Phobject {
try {
if (!$credentials) {
throw new Exception(
"Set conduit credentials with setConduitCredentials() before ".
"authenticating conduit!");
'Set conduit credentials with setConduitCredentials() before '.
'authenticating conduit!');
}
if (empty($credentials['user'])) {
@ -349,10 +349,10 @@ abstract class ArcanistBaseWorkflow extends Phobject {
$message =
"\n".
phutil_console_format(
"YOU NEED TO __INSTALL A CERTIFICATE__ TO LOGIN TO PHABRICATOR").
'YOU NEED TO __INSTALL A CERTIFICATE__ TO LOGIN TO PHABRICATOR').
"\n\n".
phutil_console_format(
" To do this, run: **arc install-certificate**").
' To do this, run: **arc install-certificate**').
"\n\n".
"The server '{$conduit_uri}' rejected your request:".
"\n".
@ -368,7 +368,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
echo "In most cases, arc can be upgraded automatically.\n";
$ok = phutil_console_confirm(
"Upgrade arc now?",
'Upgrade arc now?',
$default_no = false);
if (!$ok) {
throw $ex;
@ -897,7 +897,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
$this->stashed = true;
} else {
throw new ArcanistUsageException(
"Stage and commit (or revert) them before proceeding.");
'Stage and commit (or revert) them before proceeding.');
}
}
}
@ -917,7 +917,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
$must_commit += array_flip($uncommitted);
} else {
throw new ArcanistUncommittedChangesException(
"Commit (or revert) them before proceeding.");
'Commit (or revert) them before proceeding.');
}
}
@ -926,7 +926,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
$commit = head($api->getLocalCommitInformation());
$api->amendCommit($commit['message']);
} else if ($api->supportsLocalCommits()) {
$commit_message = phutil_console_prompt("Enter commit message:");
$commit_message = phutil_console_prompt('Enter commit message:');
if ($commit_message == '') {
$commit_message = self::AUTO_COMMIT_TITLE;
}
@ -1116,7 +1116,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
$parser = $this->newDiffParser();
$changes = $parser->parseDiff($diff);
if (count($changes) != 1) {
throw new Exception("Expected exactly one change.");
throw new Exception('Expected exactly one change.');
}
$this->changeCache[$path] = reset($changes);
}
@ -1128,7 +1128,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
}
}
} else {
throw new Exception("Missing VCS support.");
throw new Exception('Missing VCS support.');
}
if (empty($this->changeCache[$path])) {
@ -1516,13 +1516,13 @@ abstract class ArcanistBaseWorkflow extends Phobject {
$api = $this->getRepositoryAPI();
if (!$api->supportsCommitRanges()) {
throw new ArcanistUsageException(
"This version control system does not support commit ranges.");
'This version control system does not support commit ranges.');
}
if (count($argv) > 1) {
throw new ArcanistUsageException(
"Specify exactly one base commit. The end of the commit range is ".
"always the working copy state.");
'Specify exactly one base commit. The end of the commit range is '.
'always the working copy state.');
}
$api->setBaseCommit(head($argv));

View file

@ -58,7 +58,7 @@ EOTEXT
$method = $this->getArgument('method', array());
if (count($method) !== 1) {
throw new ArcanistUsageException(
"Provide exactly one Conduit method name.");
'Provide exactly one Conduit method name.');
}
$method = reset($method);
@ -68,7 +68,7 @@ EOTEXT
$params = json_decode($params, true);
if (!is_array($params)) {
throw new ArcanistUsageException(
"Provide method parameters on stdin as a JSON blob.");
'Provide method parameters on stdin as a JSON blob.');
}
$error = null;

View file

@ -70,11 +70,11 @@ EOTEXT
$revision_list = $this->getArgument('revision', array());
if (!$revision_list) {
throw new ArcanistUsageException(
"close-revision requires a revision number.");
'close-revision requires a revision number.');
}
if (count($revision_list) != 1) {
throw new ArcanistUsageException(
"close-revision requires exactly one revision.");
'close-revision requires exactly one revision.');
}
$revision_id = reset($revision_list);
$revision_id = $this->normalizeRevisionID($revision_id);

View file

@ -109,7 +109,7 @@ EOTEXT
}
foreach ($ids as $id) {
if (!preg_match("/^T?\d+$/", $id)) {
if (!preg_match('/^T?\d+$/', $id)) {
echo "Invalid Task ID: {$id}.\n";
return 1;
}
@ -125,7 +125,7 @@ EOTEXT
return 0;
}
private function closeTask($task_id, $status, $comment = "") {
private function closeTask($task_id, $status, $comment = '') {
$conduit = $this->getConduit();
$info = $conduit->callMethodSynchronous(
'maniphest.info',

View file

@ -52,14 +52,14 @@ EOTEXT
return array(
'show' => array(
'help' =>
"Show the command which would be issued, but do not actually ".
"commit anything."
'Show the command which would be issued, but do not actually '.
'commit anything.'
),
'revision' => array(
'param' => 'revision_id',
'help' =>
"Commit a specific revision. If you do not specify a revision, ".
"arc will look for committable revisions.",
'Commit a specific revision. If you do not specify a revision, '.
'arc will look for committable revisions.',
)
);
}
@ -246,7 +246,7 @@ EOTEXT
$prefix = pht(
'Revision includes changes to path(s) that do not exist:',
count($do_not_exist));
$prompt = "Commit this revision anyway?";
$prompt = 'Commit this revision anyway?';
$this->promptFileWarning($prefix, $prompt, $do_not_exist);
}
@ -255,7 +255,7 @@ EOTEXT
if (empty($files)) {
throw new ArcanistUsageException(
"There is nothing left to commit. None of the modified paths exist.");
'There is nothing left to commit. None of the modified paths exist.');
}
return $files;

View file

@ -39,7 +39,7 @@ EOTEXT
'hg',
),
'nosupport' => array(
'svn' => "cover does not currently support --rev in svn.",
'svn' => 'cover does not currently support --rev in svn.',
),
),
'*' => 'paths',

View file

@ -86,8 +86,8 @@ EOTEXT
'short' => 'm',
'param' => 'message',
'help' =>
"When updating a revision, use the specified message instead of ".
"prompting.",
'When updating a revision, use the specified message instead of '.
'prompting.',
),
'message-file' => array(
'short' => 'F',
@ -119,14 +119,14 @@ EOTEXT
'svn' => 'Edit revisions via the web interface when using SVN.',
),
'help' =>
"When updating a revision under git, edit revision information ".
"before updating.",
'When updating a revision under git, edit revision information '.
'before updating.',
),
'raw' => array(
'help' =>
"Read diff from stdin, not from the working copy. This disables ".
"many Arcanist/Phabricator features which depend on having access ".
"to the working copy.",
'Read diff from stdin, not from the working copy. This disables '.
'many Arcanist/Phabricator features which depend on having access '.
'to the working copy.',
'conflicts' => array(
'less-context' => null,
'apply-patches' => '--raw disables lint.',
@ -144,9 +144,9 @@ EOTEXT
'raw-command' => array(
'param' => 'command',
'help' =>
"Generate diff by executing a specified command, not from the ".
"working copy. This disables many Arcanist/Phabricator features ".
"which depend on having access to the working copy.",
'Generate diff by executing a specified command, not from the '.
'working copy. This disables many Arcanist/Phabricator features '.
'which depend on having access to the working copy.',
'conflicts' => array(
'less-context' => null,
'apply-patches' => '--raw-command disables lint.',
@ -156,7 +156,7 @@ EOTEXT
),
),
'create' => array(
'help' => "Always create a new revision.",
'help' => 'Always create a new revision.',
'conflicts' => array(
'edit' => '--create can not be used with --edit.',
'only' => '--create can not be used with --only.',
@ -166,15 +166,15 @@ EOTEXT
),
'update' => array(
'param' => 'revision_id',
'help' => "Always update a specific revision.",
'help' => 'Always update a specific revision.',
),
'nounit' => array(
'help' =>
"Do not run unit tests.",
'Do not run unit tests.',
),
'nolint' => array(
'help' =>
"Do not run lint.",
'Do not run lint.',
'conflicts' => array(
'lintall' => '--nolint suppresses lint.',
'advice' => '--nolint suppresses lint.',
@ -184,8 +184,8 @@ EOTEXT
),
'only' => array(
'help' =>
"Only generate a diff, without running lint, unit tests, or other ".
"auxiliary steps. See also --preview.",
'Only generate a diff, without running lint, unit tests, or other '.
'auxiliary steps. See also --preview.',
'conflicts' => array(
'preview' => null,
'message' => '--only does not affect revisions.',
@ -198,9 +198,9 @@ EOTEXT
),
'preview' => array(
'help' =>
"Instead of creating or updating a revision, only create a diff, ".
"which you may later attach to a revision. This still runs lint ".
"unit tests. See also --only.",
'Instead of creating or updating a revision, only create a diff, '.
'which you may later attach to a revision. This still runs lint '.
'unit tests. See also --only.',
'conflicts' => array(
'only' => null,
'edit' => '--preview does affect revisions.',
@ -209,7 +209,7 @@ EOTEXT
),
'plan-changes' => array(
'help' =>
"Create or update a revision without requesting a code review.",
'Create or update a revision without requesting a code review.',
'conflicts' => array(
'only' => '--only does not affect revisions.',
'preview' => '--preview does not affect revisions.',
@ -218,11 +218,11 @@ EOTEXT
'encoding' => array(
'param' => 'encoding',
'help' =>
"Attempt to convert non UTF-8 hunks into specified encoding.",
'Attempt to convert non UTF-8 hunks into specified encoding.',
),
'allow-untracked' => array(
'help' =>
"Skip checks for untracked files in the working copy.",
'Skip checks for untracked files in the working copy.',
),
'excuse' => array(
'param' => 'excuse',
@ -239,15 +239,15 @@ EOTEXT
),
'lintall' => array(
'help' =>
"Raise all lint warnings, not just those on lines you changed.",
'Raise all lint warnings, not just those on lines you changed.',
'passthru' => array(
'lint' => true,
),
),
'advice' => array(
'help' =>
"Require excuse for lint advice in addition to lint warnings and ".
"errors.",
'Require excuse for lint advice in addition to lint warnings and '.
'errors.',
),
'only-new' => array(
'param' => 'bool',
@ -374,7 +374,7 @@ EOTEXT
),
'cache' => array(
'param' => 'bool',
'help' => "0 to disable lint cache, 1 to enable (default).",
'help' => '0 to disable lint cache, 1 to enable (default).',
'passthru' => array(
'lint' => true,
),
@ -504,7 +504,7 @@ EOTEXT
$changes = $this->generateChanges();
if (!$changes) {
throw new ArcanistUsageException(
"There are no changes to generate a diff from!");
'There are no changes to generate a diff from!');
}
$diff_spec = array(
@ -584,8 +584,8 @@ EOTEXT
echo "Updating commit message...\n";
$repository_api->amendCommit($revised_message);
} else {
echo "Commit message was not amended. Amending commit message is ".
"only supported in git and hg (version 2.2 or newer)";
echo 'Commit message was not amended. Amending commit message is '.
'only supported in git and hg (version 2.2 or newer)';
}
}
@ -837,7 +837,7 @@ EOTEXT
"Modified 'svn:externals' files:".
"\n\n".
phutil_console_wrap(implode("\n", $warn_externals), 8));
$prompt = "Generate a diff (with just local changes) anyway?";
$prompt = 'Generate a diff (with just local changes) anyway?';
if (!phutil_console_confirm($prompt)) {
throw new ArcanistUserAbortException();
} else {
@ -871,7 +871,7 @@ EOTEXT
} else if ($this->getArgument('raw-command')) {
list($raw_diff) = execx('%C', $this->getArgument('raw-command'));
} else {
throw new Exception("Unknown raw diff source.");
throw new Exception('Unknown raw diff source.');
}
$changes = $parser->parseDiff($raw_diff);
@ -940,25 +940,25 @@ EOTEXT
$diff = $repository_api->getFullGitDiff();
if (!strlen($diff)) {
throw new ArcanistUsageException(
"No changes found. (Did you specify the wrong commit range?)");
'No changes found. (Did you specify the wrong commit range?)');
}
$changes = $parser->parseDiff($diff);
} else if ($repository_api instanceof ArcanistMercurialAPI) {
$diff = $repository_api->getFullMercurialDiff();
if (!strlen($diff)) {
throw new ArcanistUsageException(
"No changes found. (Did you specify the wrong commit range?)");
'No changes found. (Did you specify the wrong commit range?)');
}
$changes = $parser->parseDiff($diff);
} else {
throw new Exception("Repository API is not supported.");
throw new Exception('Repository API is not supported.');
}
if (count($changes) > 250) {
$count = number_format(count($changes));
$link =
"http://www.phabricator.com/docs/phabricator/article/".
"Differential_User_Guide_Large_Changes.html";
'http://www.phabricator.com/docs/phabricator/article/'.
'Differential_User_Guide_Large_Changes.html';
$message =
"This diff has a very large number of changes ({$count}). ".
"Differential works best for changes which will receive detailed ".
@ -967,7 +967,7 @@ EOTEXT
"checkins. Continue anyway?";
if (!phutil_console_confirm($message)) {
throw new ArcanistUsageException(
"Aborted generation of gigantic diff.");
'Aborted generation of gigantic diff.');
}
}
@ -1003,7 +1003,7 @@ EOTEXT
$change->convertToBinaryChange($repository_api);
} else {
throw new ArcanistUsageException(
"Aborted generation of gigantic diff.");
'Aborted generation of gigantic diff.');
}
}
}
@ -1061,10 +1061,10 @@ EOTEXT
if ($utf8_problems) {
$utf8_warning =
pht(
"This diff includes file(s) which are not valid UTF-8 (they contain ".
"invalid byte sequences). You can either stop this workflow and ".
"fix these files, or continue. If you continue, these files will ".
"be marked as binary.",
'This diff includes file(s) which are not valid UTF-8 (they contain '.
'invalid byte sequences). You can either stop this workflow and '.
'fix these files, or continue. If you continue, these files will '.
'be marked as binary.',
count($utf8_problems))."\n\n".
"You can learn more about how Phabricator handles character encodings ".
"(and how to configure encoding settings and detect and correct ".
@ -1083,7 +1083,7 @@ EOTEXT
echo $file_list;
if (!phutil_console_confirm($confirm, $default_no = false)) {
throw new ArcanistUsageException("Aborted workflow to fix UTF-8.");
throw new ArcanistUsageException('Aborted workflow to fix UTF-8.');
} else {
foreach ($utf8_problems as $change) {
$change->convertToBinaryChange($repository_api);
@ -1245,7 +1245,7 @@ EOTEXT
$lint_workflow->getUnresolvedMessages()) {
$this->getErrorExcuse(
'lint',
"Lint issued unresolved advice.",
'Lint issued unresolved advice.',
'lint-excuses');
} else {
$this->console->writeOut(
@ -1255,7 +1255,7 @@ EOTEXT
case ArcanistLintWorkflow::RESULT_WARNINGS:
$this->getErrorExcuse(
'lint',
"Lint issued unresolved warnings.",
'Lint issued unresolved warnings.',
'lint-excuses');
break;
case ArcanistLintWorkflow::RESULT_ERRORS:
@ -1263,7 +1263,7 @@ EOTEXT
"<bg:red>** LINT ERRORS **</bg> Lint raised errors!\n");
$this->getErrorExcuse(
'lint',
"Lint issued unresolved errors!",
'Lint issued unresolved errors!',
'lint-excuses');
break;
case ArcanistLintWorkflow::RESULT_POSTPONED:
@ -1325,8 +1325,8 @@ EOTEXT
"but all failing tests are unsound.\n");
} else {
$continue = $this->console->confirm(
"Unit test results included failures, but all failing tests ".
"are known to be unsound. Ignore unsound test failures?");
'Unit test results included failures, but all failing tests '.
'are known to be unsound. Ignore unsound test failures?');
if (!$continue) {
throw new ArcanistUserAbortException();
}
@ -1337,7 +1337,7 @@ EOTEXT
"<bg:red>** UNIT ERRORS **</bg> Unit testing raised errors!\n");
$this->getErrorExcuse(
'unit',
"Unit test results include failures!",
'Unit test results include failures!',
'unit-excuses');
break;
}
@ -1387,18 +1387,18 @@ EOTEXT
if ($this->getArgument('excuse')) {
$this->console->sendMessage(array(
'type' => $type,
'confirm' => $prompt." Ignore them?",
'confirm' => $prompt.' Ignore them?',
));
return;
}
$history = $this->getRepositoryAPI()->getScratchFilePath($history);
$prompt .= " Provide explanation to continue or press Enter to abort.";
$prompt .= ' Provide explanation to continue or press Enter to abort.';
$this->console->writeOut("\n\n%s", phutil_console_wrap($prompt));
$this->console->sendMessage(array(
'type' => $type,
'prompt' => "Explanation:",
'prompt' => 'Explanation:',
'history' => $history,
));
}
@ -1542,7 +1542,7 @@ EOTEXT
"You can use this message, or discard it.";
$use = phutil_console_confirm(
"Do you want to use this message?",
'Do you want to use this message?',
$default_no = false);
if ($use) {
$template = $saved;
@ -1592,9 +1592,9 @@ EOTEXT
}
$included = array_merge(
array(
"",
'',
"Included commits{$in_branch}:",
"",
'',
),
$included);
}
@ -1635,7 +1635,7 @@ EOTEXT
$first = false;
if ($template_is_default && ($new_template == $template)) {
throw new ArcanistUsageException("Template not edited.");
throw new ArcanistUsageException('Template not edited.');
}
$template = ArcanistCommentRemover::removeComments($new_template);
@ -1678,9 +1678,9 @@ EOTEXT
$issues[] = ' - '.$error;
}
echo "\n";
echo "You must resolve these errors to continue.";
echo 'You must resolve these errors to continue.';
$again = phutil_console_confirm(
"Do you want to edit the message?",
'Do you want to edit the message?',
$default_no = false);
if ($again) {
// Keep going.
@ -1773,7 +1773,7 @@ EOTEXT
$reviewers = $message->getFieldValue('reviewerPHIDs');
if (!$reviewers) {
$confirm = "You have not specified any reviewers. Continue anyway?";
$confirm = 'You have not specified any reviewers. Continue anyway?';
if (!phutil_console_confirm($confirm)) {
throw new ArcanistUsageException('Specify reviewers and retry.');
}
@ -2510,7 +2510,7 @@ EOTEXT
$change->setMetadata("{$type}:file:mime-type", $mime);
}
echo pht("Uploading %d files...", count($need_upload))."\n";
echo pht('Uploading %d files...', count($need_upload))."\n";
// Now we're ready to upload the actual file data. If possible, we'll just
// transmit a hash of the file instead of the actual file data. If the data
@ -2584,7 +2584,7 @@ EOTEXT
}
}
echo pht("Upload complete.")."\n";
echo pht('Upload complete.')."\n";
}
private function getFileMimeType($data) {

View file

@ -52,15 +52,15 @@ EOTEXT
protected function didParseArguments() {
$argv = $this->getArgument('argv');
if (!$argv) {
throw new ArcanistUsageException("Specify a file to download.");
throw new ArcanistUsageException('Specify a file to download.');
}
if (count($argv) > 1) {
throw new ArcanistUsageException("Specify exactly one file to download.");
throw new ArcanistUsageException('Specify exactly one file to download.');
}
$file = reset($argv);
if (!preg_match('/^F?\d+$/', $file)) {
throw new ArcanistUsageException("Specify file by ID, e.g. F123.");
throw new ArcanistUsageException('Specify file by ID, e.g. F123.');
}
$this->id = (int)ltrim($file, 'F');

View file

@ -66,19 +66,19 @@ EOTEXT
'encoding' => array(
'param' => 'encoding',
'help' =>
"Attempt to convert non UTF-8 patch into specified encoding.",
'Attempt to convert non UTF-8 patch into specified encoding.',
),
'revision' => array(
'param' => 'revision_id',
'help' =>
"Instead of exporting changes from the working copy, export them ".
"from a Differential revision."
'Instead of exporting changes from the working copy, export them '.
'from a Differential revision.'
),
'diff' => array(
'param' => 'diff_id',
'help' =>
"Instead of exporting changes from the working copy, export them ".
"from a Differential diff."
'Instead of exporting changes from the working copy, export them '.
'from a Differential diff.'
),
'*' => 'paths',
);

View file

@ -82,7 +82,7 @@ EOTEXT
$names = $this->getArgument('branch');
if ($names) {
if (count($names) > 2) {
throw new ArcanistUsageException("Specify only one branch.");
throw new ArcanistUsageException('Specify only one branch.');
}
return $this->checkoutBranch($names);
}
@ -186,7 +186,7 @@ EOTEXT
foreach ($branches as $branch) {
if ($repository_api instanceof ArcanistMercurialAPI) {
$futures[$branch['name']] = $repository_api->execFutureLocal(
"log -l 1 --template %s -r %s",
'log -l 1 --template %s -r %s',
"{node}\1{date|hgdate}\1{p1node}\1{desc|firstline}\1{desc}",
hgsprintf('%s', $branch['name']));

View file

@ -115,7 +115,7 @@ EOTEXT
throw new ArcanistUsageException("You can't both edit and clear a flag.");
}
if (($editing || $clear) && count($objects) != 1) {
throw new ArcanistUsageException("Specify exactly one object.");
throw new ArcanistUsageException('Specify exactly one object.');
}
if (!empty($objects)) {
@ -155,7 +155,7 @@ EOTEXT
} else {
self::flagWasEdited($flag, 'deleted');
}
} elseif ($editing) {
} else if ($editing) {
// Let's set some flags. Just like Minesweeper, but less distracting.
$flag_params = array(
'objectPHID' => head($phids),

View file

@ -47,8 +47,8 @@ EOTEXT
$working_copy = $this->getWorkingCopy();
if (!$working_copy->getProjectID()) {
throw new ArcanistUsageException(
"You have installed a git pre-receive hook in a remote without an ".
".arcconfig.");
'You have installed a git pre-receive hook in a remote without an '.
'.arcconfig.');
}
// Git repositories have special rules in pre-receive hooks. We need to

View file

@ -86,37 +86,37 @@ EOTEXT
if (isset($spec['param'])) {
if (isset($spec['short'])) {
$optref[] = phutil_console_format(
" __--%s__ __%s__, __-%s__ __%s__",
' __--%s__ __%s__, __-%s__ __%s__',
$argument,
$spec['param'],
$spec['short'],
$spec['param']);
} else {
$optref[] = phutil_console_format(
" __--%s__ __%s__",
' __--%s__ __%s__',
$argument,
$spec['param']);
}
} else {
if (isset($spec['short'])) {
$optref[] = phutil_console_format(
" __--%s__, __-%s__",
' __--%s__, __-%s__',
$argument,
$spec['short']);
} else {
$optref[] = phutil_console_format(
" __--%s__",
' __--%s__',
$argument);
}
}
if (isset($config_arguments[$argument])) {
$optref[] = " (This is a custom option for this ".
"project.)";
$optref[] = ' (This is a custom option for this '.
'project.)';
}
if (isset($spec['supports'])) {
$optref[] = " Supports: ".
$optref[] = ' Supports: '.
implode(', ', $spec['supports']);
}

View file

@ -28,12 +28,12 @@ EOTEXT
'revision' => array(
'param' => 'revision_id',
'help' =>
"Display inline comments for a specific revision. If you do not ".
"specify a revision, arc will look in the commit message at HEAD.",
'Display inline comments for a specific revision. If you do not '.
'specify a revision, arc will look in the commit message at HEAD.',
),
'root' => array(
'param' => 'directory',
'help' => "Specify a string printed in front of each path.",
'help' => 'Specify a string printed in front of each path.',
),
);
}
@ -60,7 +60,7 @@ EOTEXT
}
if (!$revision_id) {
throw new ArcanistUsageException("No revisions found.");
throw new ArcanistUsageException('No revisions found.');
}
$comments = array_mergev(

View file

@ -65,7 +65,7 @@ EOTEXT
$conduit->callMethodSynchronous('conduit.ping', array());
} catch (Exception $ex) {
throw new ArcanistUsageException(
"Failed to connect to server: ".$ex->getMessage());
'Failed to connect to server: '.$ex->getMessage());
}
echo "Connection OK!\n";
@ -79,7 +79,7 @@ EOTEXT
echo "\n";
echo " {$token_uri}\n";
echo "\n";
echo "Then paste the token on that page below.";
echo 'Then paste the token on that page below.';
do {
@ -118,15 +118,15 @@ EOTEXT
private function determineConduitURI() {
$uri = $this->getArgument('uri');
if (count($uri) > 1) {
throw new ArcanistUsageException("Specify at most one URI.");
throw new ArcanistUsageException('Specify at most one URI.');
} else if (count($uri) == 1) {
$uri = reset($uri);
} else {
$conduit_uri = $this->getConduitURI();
if (!$conduit_uri) {
throw new ArcanistUsageException(
"Specify an explicit URI or run this command from within a project ".
"which is configured with a .arcconfig.");
'Specify an explicit URI or run this command from within a project '.
'which is configured with a .arcconfig.');
}
$uri = $conduit_uri;
}

View file

@ -318,16 +318,16 @@ EOTEXT
if ($this->useSquash) {
if (!$repository_api->supportsRebase()) {
throw new ArcanistUsageException(
pht("You must enable the rebase extension to use the --squash ".
"strategy."));
pht('You must enable the rebase extension to use the --squash '.
'strategy.'));
}
}
if ($this->branchType != $this->ontoType) {
throw new ArcanistUsageException(pht(
"Source %s is a %s but destination %s is a %s. When landing a ".
"%s, the destination must also be a %s. Use --onto to specify a %s, ".
"or set arc.land.onto.default in .arcconfig.",
'Source %s is a %s but destination %s is a %s. When landing a '.
'%s, the destination must also be a %s. Use --onto to specify a %s, '.
'or set arc.land.onto.default in .arcconfig.',
$this->branch,
$this->branchType,
$this->onto,
@ -361,7 +361,7 @@ EOTEXT
}
echo phutil_console_format(
pht("Switched to %s **%s**. Identifying and merging...",
pht('Switched to %s **%s**. Identifying and merging...',
$this->branchType,
$this->branch).
"\n");
@ -396,7 +396,7 @@ EOTEXT
if (!trim($out)) {
$this->restoreBranch();
throw new ArcanistUsageException(
pht("No commits to land from %s.", $this->branch));
pht('No commits to land from %s.', $this->branch));
}
echo pht("The following commit(s) will be landed:\n\n%s", $out), "\n";
@ -506,7 +506,7 @@ EOTEXT
if (!empty($open_dep_revs)) {
$open_revs = array();
foreach ($open_dep_revs as $id => $title) {
$open_revs[] = " - D".$id.": ".$title;
$open_revs[] = ' - D'.$id.': '.$title;
}
$open_revs = implode("\n", $open_revs);
@ -514,7 +514,7 @@ EOTEXT
"D{$rev_id}: {$rev_title}",
$open_revs);
$ok = phutil_console_confirm(pht("Continue anyway?"));
$ok = phutil_console_confirm(pht('Continue anyway?'));
if (!$ok) {
throw new ArcanistUserAbortException();
}
@ -570,7 +570,7 @@ EOTEXT
} else if ($this->isHg) {
echo phutil_console_format(pht(
"Updating **%s**...",
'Updating **%s**...',
$this->onto) . "\n");
try {
@ -616,7 +616,7 @@ EOTEXT
// Pull succeeded. Now make sure master is not on an outgoing change
if ($repository_api->supportsPhases()) {
list($out) = $repository_api->execxLocal(
'log -r %s --template %s', $this->onto, "{phase}");
'log -r %s --template %s', $this->onto, '{phase}');
if ($out != 'public') {
$local_ahead_of_remote = true;
}
@ -655,7 +655,7 @@ EOTEXT
if ($this->isGit) {
if ($this->shouldUpdateWithRebase) {
echo phutil_console_format(pht(
"Rebasing **%s** onto **%s**",
'Rebasing **%s** onto **%s**',
$this->branch,
$this->onto)."\n");
$err = phutil_passthru('git rebase %s', $this->onto);
@ -669,7 +669,7 @@ EOTEXT
}
} else {
echo phutil_console_format(pht(
"Merging **%s** into **%s**",
'Merging **%s** into **%s**',
$this->branch,
$this->onto)."\n");
$err = phutil_passthru(
@ -687,7 +687,7 @@ EOTEXT
} else if ($this->isHg) {
$onto_tip = $repository_api->getCanonicalRevisionName($this->onto);
$common_ancestor = $repository_api->getCanonicalRevisionName(
hgsprintf("ancestor(%s, %s)",
hgsprintf('ancestor(%s, %s)',
$this->onto,
$this->branch));
@ -745,13 +745,13 @@ EOTEXT
// function). So we're guaranteed to have onto as an ancestor of branch
// when we use first((onto::branch)-onto) below.
$branch_root = $repository_api->getCanonicalRevisionName(
hgsprintf("first((%s::%s)-%s)",
hgsprintf('first((%s::%s)-%s)',
$this->onto,
$this->branch,
$this->onto));
$branch_range = hgsprintf(
"(%s::%s)",
'(%s::%s)',
$branch_root,
$this->branch);
@ -793,8 +793,8 @@ EOTEXT
// check if the branch had children
list($output) = $repository_api->execxLocal(
"log -r %s --template %s",
hgsprintf("children(%s)", $this->branch),
'log -r %s --template %s',
hgsprintf('children(%s)', $this->branch),
'{node}\n');
$child_branch_roots = phutil_split_lines($output, false);
@ -849,7 +849,7 @@ EOTEXT
$this->branch,
$branch_range);
list($alt_branches) = $repository_api->execxLocal(
"log --template %s -r %s",
'log --template %s -r %s',
'{node}\n',
$alt_branch_revset);
@ -890,7 +890,7 @@ EOTEXT
throw new ArcanistUserAbortException();
} else {
throw new ArcanistUsageException(
pht("Invalid choice. Aborting arc land."));
pht('Invalid choice. Aborting arc land.'));
}
}
}
@ -923,7 +923,7 @@ EOTEXT
// The user should never reach this line, since --merge is
// forbidden at the command line argument level.
throw new ArcanistUsageException(pht(
"--merge is not currently supported for hg repos."));
'--merge is not currently supported for hg repos.'));
}
}
@ -961,7 +961,7 @@ EOTEXT
if ($this->getArgument('hold')) {
echo phutil_console_format(pht(
"Holding change in **%s**: it has NOT been pushed yet.",
'Holding change in **%s**: it has NOT been pushed yet.',
$this->onto). "\n");
} else {
echo pht('Pushing change...'), "\n\n";
@ -970,13 +970,13 @@ EOTEXT
if ($this->isGitSvn) {
$err = phutil_passthru('git svn dcommit');
$cmd = "git svn dcommit";
$cmd = 'git svn dcommit';
} else if ($this->isGit) {
$err = phutil_passthru(
'git push %s %s',
$this->remote,
$this->onto);
$cmd = "git push";
$cmd = 'git push';
} else if ($this->isHgSvn) {
// hg-svn doesn't support 'push -r', so we do a normal push
// which hg-svn modifies to only push the current branch and
@ -984,13 +984,13 @@ EOTEXT
$err = $repository_api->execPassthru(
'push %s',
$this->remote);
$cmd = "hg push";
$cmd = 'hg push';
} else if ($this->isHg) {
$err = $repository_api->execPassthru(
'push -r %s %s',
$this->onto,
$this->remote);
$cmd = "hg push";
$cmd = 'hg push';
}
if ($err) {
@ -1070,12 +1070,12 @@ EOTEXT
$this->branch);
} else if ($this->isHg) {
$common_ancestor = $repository_api->getCanonicalRevisionName(
hgsprintf("ancestor(%s,%s)",
hgsprintf('ancestor(%s,%s)',
$this->onto,
$this->branch));
$branch_root = $repository_api->getCanonicalRevisionName(
hgsprintf("first((%s::%s)-%s)",
hgsprintf('first((%s::%s)-%s)',
$common_ancestor,
$this->branch,
$common_ancestor));
@ -1148,9 +1148,9 @@ EOTEXT
private function getBranchType($branch) {
$repository_api = $this->getRepositoryAPI();
if ($this->isHg && $repository_api->isBookmark($branch)) {
return "bookmark";
return 'bookmark';
}
return "branch";
return 'branch';
}
/**

View file

@ -37,34 +37,34 @@ EOTEXT
return array(
'all' => array(
'help' =>
"Drop the module cache before liberating. This will completely ".
"reanalyze the entire library. Thorough, but slow!",
'Drop the module cache before liberating. This will completely '.
'reanalyze the entire library. Thorough, but slow!',
),
'force-update' => array(
'help' =>
"Force the library map to be updated, even in the presence of ".
"lint errors.",
'Force the library map to be updated, even in the presence of '.
'lint errors.',
),
'library-name' => array(
'param' => 'name',
'help' =>
"Use a flag for library name rather than awaiting user input.",
'Use a flag for library name rather than awaiting user input.',
),
'remap' => array(
'hide' => true,
'help' =>
"Internal. Run the remap step of liberation. You do not need to ".
"run this unless you are debugging the workflow.",
'Internal. Run the remap step of liberation. You do not need to '.
'run this unless you are debugging the workflow.',
),
'verify' => array(
'hide' => true,
'help' =>
"Internal. Run the verify step of liberation. You do not need to ".
"run this unless you are debugging the workflow.",
'Internal. Run the verify step of liberation. You do not need to '.
'run this unless you are debugging the workflow.',
),
'upgrade' => array(
'hide' => true,
'help' => "Experimental. Upgrade library to v2.",
'help' => 'Experimental. Upgrade library to v2.',
),
'*' => 'argv',
);
@ -98,8 +98,8 @@ EOTEXT
if ($init) {
if (count($init) > 1) {
throw new ArcanistUsageException(
"Specified directory contains more than one libphutil library. Use ".
"a more specific path.");
'Specified directory contains more than one libphutil library. Use '.
'a more specific path.');
}
$path = Filesystem::resolvePath(dirname(reset($init)), $path);
} else {
@ -186,14 +186,14 @@ EOTEXT
if (Filesystem::pathExists($path)) {
if (!is_dir($path)) {
throw new ArcanistUsageException(
"Provide a directory to create or update a libphutil library in.");
'Provide a directory to create or update a libphutil library in.');
}
return;
}
echo "The directory '{$path}' does not exist.";
if (!phutil_console_confirm('Do you want to create it?')) {
throw new ArcanistUsageException("Cancelled.");
throw new ArcanistUsageException('Cancelled.');
}
execx('mkdir -p %s', $path);
@ -208,7 +208,7 @@ EOTEXT
echo "Creating new libphutil library in '{$path}'.\n";
do {
$name = $this->getArgument("library-name");
$name = $this->getArgument('library-name');
if ($name === null) {
echo "Choose a name for the new library.\n";
$name = phutil_console_prompt('What do you want to name this library?');

View file

@ -63,31 +63,31 @@ EOTEXT
return array(
'lintall' => array(
'help' =>
"Show all lint warnings, not just those on changed lines. When " .
"paths are specified, this is the default behavior.",
'Show all lint warnings, not just those on changed lines. When ' .
'paths are specified, this is the default behavior.',
'conflicts' => array(
'only-changed' => true,
),
),
'only-changed' => array(
'help' =>
"Show lint warnings just on changed lines. When no paths are " .
"specified, this is the default. This differs from only-new " .
"in cases where line modifications introduce lint on other " .
"unmodified lines.",
'Show lint warnings just on changed lines. When no paths are ' .
'specified, this is the default. This differs from only-new ' .
'in cases where line modifications introduce lint on other ' .
'unmodified lines.',
'conflicts' => array(
'lintall' => true,
),
),
'rev' => array(
'param' => 'revision',
'help' => "Lint changes since a specific revision.",
'help' => 'Lint changes since a specific revision.',
'supports' => array(
'git',
'hg',
),
'nosupport' => array(
'svn' => "Lint does not currently support --rev in SVN.",
'svn' => 'Lint does not currently support --rev in SVN.',
),
),
'output' => array(
@ -107,7 +107,7 @@ EOTEXT
'engine' => array(
'param' => 'classname',
'help' =>
"Override configured lint engine for this project."
'Override configured lint engine for this project.'
),
'apply-patches' => array(
'help' =>
@ -193,8 +193,8 @@ EOTEXT
$everything = $this->getArgument('everything');
if ($everything && $paths) {
throw new ArcanistUsageException(
"You can not specify paths with --everything. The --everything ".
"flag lints every file.");
'You can not specify paths with --everything. The --everything '.
'flag lints every file.');
}
if ($use_cache === null) {
$use_cache = (bool)$configuration_manager->getConfigFromAnySource(
@ -203,7 +203,7 @@ EOTEXT
}
if ($rev && $paths) {
throw new ArcanistUsageException("Specify either --rev or paths.");
throw new ArcanistUsageException('Specify either --rev or paths.');
}
@ -503,12 +503,12 @@ EOTEXT
// TODO: Improve the behavior here, make it more like
// difference_render().
list(, $stdout, $stderr) =
exec_manual("diff -u %s %s", $old_file, $new_file);
exec_manual('diff -u %s %s', $old_file, $new_file);
$console->writeOut('%s', $stdout);
$console->writeErr('%s', $stderr);
$prompt = phutil_console_format(
"Apply this patch to __%s__?",
'Apply this patch to __%s__?',
$result->getPath());
if (!$console->confirm($prompt, $default_no = false)) {
continue;
@ -531,7 +531,7 @@ EOTEXT
"with lint patches.\n");
$amend = true;
} else {
$amend = $console->confirm("Amend HEAD with lint patches?");
$amend = $console->confirm('Amend HEAD with lint patches?');
}
if ($amend) {
@ -543,8 +543,8 @@ EOTEXT
$repository_api->amendCommit();
} else {
throw new ArcanistUsageException(
"Sort out the lint changes that were applied to the working ".
"copy and relint.");
'Sort out the lint changes that were applied to the working '.
'copy and relint.');
}
}

View file

@ -67,17 +67,17 @@ EOTEXT
$argv = $this->getArgument('argv');
if (count($argv) > 1) {
throw new ArcanistUsageException("Specify only one paste to retrieve.");
throw new ArcanistUsageException('Specify only one paste to retrieve.');
} else if (count($argv) == 1) {
$id = $argv[0];
if (!preg_match('/^P?\d+/', $id)) {
throw new ArcanistUsageException("Specify a paste ID, like P123.");
throw new ArcanistUsageException('Specify a paste ID, like P123.');
}
$this->id = (int)ltrim($id, 'P');
if ($this->language || $this->title) {
throw new ArcanistUsageException(
"Use options --lang and --title only when creating pastes.");
'Use options --lang and --title only when creating pastes.');
}
}
}

View file

@ -52,10 +52,10 @@ EOTEXT
'diff' => array(
'param' => 'diff_id',
'help' =>
"Apply changes from a Differential diff. Normally you want to use ".
"--revision to get the most recent changes, but you can ".
"specifically apply an out-of-date diff or a diff which was never ".
"attached to a revision by using this flag.",
'Apply changes from a Differential diff. Normally you want to use '.
'--revision to get the most recent changes, but you can '.
'specifically apply an out-of-date diff or a diff which was never '.
'attached to a revision by using this flag.',
),
'arcbundle' => array(
'param' => 'bundlefile',
@ -67,19 +67,19 @@ EOTEXT
'param' => 'patchfile',
'paramtype' => 'file',
'help' =>
"Apply changes from a git patchfile or unified patchfile.",
'Apply changes from a git patchfile or unified patchfile.',
),
'encoding' => array(
'param' => 'encoding',
'help' =>
"Attempt to convert non UTF-8 patch into specified encoding.",
'Attempt to convert non UTF-8 patch into specified encoding.',
),
'update' => array(
'supports' => array(
'git', 'svn', 'hg'
),
'help' =>
"Update the local working copy before applying the patch.",
'Update the local working copy before applying the patch.',
'conflicts' => array(
'nobranch' => true,
'bookmark' => true,
@ -90,8 +90,8 @@ EOTEXT
'git', 'hg'
),
'help' =>
"Normally under git/hg, if the patch is successful, the changes ".
"are committed to the working copy. This flag prevents the commit.",
'Normally under git/hg, if the patch is successful, the changes '.
'are committed to the working copy. This flag prevents the commit.',
),
'skip-dependencies' => array(
'supports' => array(
@ -107,17 +107,17 @@ EOTEXT
'git', 'hg'
),
'help' =>
"Normally, a new branch (git) or bookmark (hg) is created and then ".
"the patch is applied and committed in the new branch/bookmark. ".
"This flag cherry-picks the resultant commit onto the original ".
"branch and deletes the temporary branch.",
'Normally, a new branch (git) or bookmark (hg) is created and then '.
'the patch is applied and committed in the new branch/bookmark. '.
'This flag cherry-picks the resultant commit onto the original '.
'branch and deletes the temporary branch.',
'conflicts' => array(
'update' => true,
),
),
'force' => array(
'help' =>
"Do not run any sanity checks.",
'Do not run any sanity checks.',
),
'*' => 'name',
);
@ -147,7 +147,7 @@ EOTEXT
if ($this->getArgument('name')) {
$namev = $this->getArgument('name');
if (count($namev) > 1) {
throw new ArcanistUsageException("Specify at most one revision name.");
throw new ArcanistUsageException('Specify at most one revision name.');
}
$source = self::SOURCE_REVISION;
$requested++;
@ -216,7 +216,7 @@ EOTEXT
$branch_name = null;
$repository_api = $this->getRepositoryAPI();
$revision_id = $bundle->getRevisionID();
$base_name = "arcpatch";
$base_name = 'arcpatch';
if ($revision_id) {
$base_name .= "-D{$revision_id}";
}
@ -242,8 +242,8 @@ EOTEXT
if (!$branch_name) {
throw new Exception(
"Arc was unable to automagically make a name for this patch. ".
"Please clean up your working copy and try again."
'Arc was unable to automagically make a name for this patch. '.
'Please clean up your working copy and try again.'
);
}
@ -254,7 +254,7 @@ EOTEXT
$bookmark_name = null;
$repository_api = $this->getRepositoryAPI();
$revision_id = $bundle->getRevisionID();
$base_name = "arcpatch";
$base_name = 'arcpatch';
if ($revision_id) {
$base_name .= "-D{$revision_id}";
}
@ -281,8 +281,8 @@ EOTEXT
if (!$bookmark_name) {
throw new Exception(
"Arc was unable to automagically make a name for this patch. ".
"Please clean up your working copy and try again."
'Arc was unable to automagically make a name for this patch. '.
'Please clean up your working copy and try again.'
);
}
@ -362,7 +362,7 @@ EOTEXT
$patch = @file_get_contents('php://stdin');
if (!strlen($patch)) {
throw new ArcanistUsageException(
"Failed to read patch from stdin!");
'Failed to read patch from stdin!');
}
} else {
$patch = Filesystem::readFile($param);
@ -685,7 +685,7 @@ EOTEXT
// can not apply these patches on case-insensitive filesystems and
// there is no way to build a patch which works.
throw new ArcanistUsageException("Unable to apply patch!");
throw new ArcanistUsageException('Unable to apply patch!');
}
// in case there were any submodule changes involved

View file

@ -210,7 +210,7 @@ EOTEXT
}
if ($failures) {
$at = "@";
$at = '@';
$msg = phutil_console_format(
"\n**LINT ERRORS**\n\n".
"This changeset has lint errors. You must fix all lint errors before ".

View file

@ -44,31 +44,31 @@ EOTEXT
return array(
'status' => array(
'param' => 'task_status',
'help' => "Show tasks that or open or closed, default is open.",
'help' => 'Show tasks that or open or closed, default is open.',
),
'owner' => array(
'param' => 'username',
'paramtype' => 'username',
'help' =>
"Only show tasks assigned to the given username, ".
"also accepts @all to show all, default is you.",
'Only show tasks assigned to the given username, '.
'also accepts @all to show all, default is you.',
'conflict' => array(
"unassigned" => "--owner suppresses unassigned",
'unassigned' => '--owner suppresses unassigned',
),
),
'order' => array(
'param' => 'task_order',
'help' =>
"Arrange tasks based on priority, created, or modified, ".
"default is priority.",
'Arrange tasks based on priority, created, or modified, '.
'default is priority.',
),
'limit' => array(
'param' => 'n',
'paramtype' => 'int',
'help' => "Limit the amount of tasks outputted, default is all.",
'help' => 'Limit the amount of tasks outputted, default is all.',
),
'unassigned' => array(
'help' => "Only show tasks that are not assigned (upforgrabs).",
'help' => 'Only show tasks that are not assigned (upforgrabs).',
)
);
}
@ -84,7 +84,7 @@ EOTEXT
if ($owner) {
$owner_phid = $this->findOwnerPhid($owner);
} elseif ($unassigned) {
} else if ($unassigned) {
$owner_phid = null;
} else {
$owner_phid = $this->getUserPHID();
@ -106,7 +106,7 @@ EOTEXT
$output = array();
// Render the "T123" column.
$task_id = "T".$task['id'];
$task_id = 'T'.$task['id'];
$formatted_task_id = phutil_console_format(
'**%s**',
$task_id);
@ -176,7 +176,7 @@ EOTEXT
);
} else {
$output['status'] = array(
'text' => "",
'text' => '',
'len' => 0,
);
}
@ -265,8 +265,8 @@ EOTEXT
$find_params['limit'] = $limit;
}
$find_params['order'] = ($order ? "order-".$order : "order-priority");
$find_params['status'] = ($status ? "status-".$status : "status-open");
$find_params['order'] = ($order ? 'order-'.$order : 'order-priority');
$find_params['status'] = ($status ? 'status-'.$status : 'status-open');
$tasks = $conduit->callMethodSynchronous(
'maniphest.query',

View file

@ -42,19 +42,19 @@ EOTEXT
return array(
'rev' => array(
'param' => 'revision',
'help' => "Run unit tests covering changes since a specific revision.",
'help' => 'Run unit tests covering changes since a specific revision.',
'supports' => array(
'git',
'hg',
),
'nosupport' => array(
'svn' => "Arc unit does not currently support --rev in SVN.",
'svn' => 'Arc unit does not currently support --rev in SVN.',
),
),
'engine' => array(
'param' => 'classname',
'help' =>
"Override configured unit engine for this project."
'Override configured unit engine for this project.'
),
'coverage' => array(
'help' => 'Always enable coverage information.',
@ -66,8 +66,8 @@ EOTEXT
'help' => 'Always disable coverage information.',
),
'detailed-coverage' => array(
'help' => "Show a detailed coverage report on the CLI. Implies ".
"--coverage.",
'help' => 'Show a detailed coverage report on the CLI. Implies '.
'--coverage.',
),
'json' => array(
'help' => 'Report results in JSON format.',
@ -119,8 +119,8 @@ EOTEXT
if (!$engine_class) {
throw new ArcanistNoEngineException(
"No unit test engine is configured for this project. Edit .arcconfig ".
"to specify a unit test engine.");
'No unit test engine is configured for this project. Edit .arcconfig '.
'to specify a unit test engine.');
}
$paths = $this->getArgument('paths');
@ -128,8 +128,8 @@ EOTEXT
$everything = $this->getArgument('everything');
if ($everything && $paths) {
throw new ArcanistUsageException(
"You can not specify paths with --everything. The --everything ".
"flag runs every test.");
'You can not specify paths with --everything. The --everything '.
'flag runs every test.');
}
$paths = $this->selectPathsForWorkflow($paths, $rev);

View file

@ -40,7 +40,7 @@ EOTEXT
protected function didParseArguments() {
if (!$this->getArgument('paths')) {
throw new ArcanistUsageException("Specify one or more files to upload.");
throw new ArcanistUsageException('Specify one or more files to upload.');
}
$this->paths = $this->getArgument('paths');

View file

@ -44,7 +44,7 @@ EOTEXT
public function getArguments() {
return array(
'any-status' => array(
'help' => "Show committed and abandoned revisions.",
'help' => 'Show committed and abandoned revisions.',
),
'base' => array(
'param' => 'rules',
@ -115,7 +115,7 @@ EOTEXT
} else if ($repository_api instanceof ArcanistMercurialAPI) {
$command = "hg diff --rev {$relative}";
} else {
throw new Exception("Unknown VCS!");
throw new Exception('Unknown VCS!');
}
echo phutil_console_wrap(