1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 08:12:40 +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 || $want_working_copy) {
if ($need_working_copy && !$working_copy->getVCSType()) { if ($need_working_copy && !$working_copy->getVCSType()) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"This command must be run in a Git, Mercurial or Subversion working ". 'This command must be run in a Git, Mercurial or Subversion working '.
"copy."); 'copy.');
} }
$configuration_manager->setWorkingCopyIdentity($working_copy); $configuration_manager->setWorkingCopyIdentity($working_copy);
} }
@ -352,7 +352,7 @@ try {
echo phutil_console_format( echo phutil_console_format(
"**Exception**\n%s\n%s\n", "**Exception**\n%s\n%s\n",
$ex->getMessage(), $ex->getMessage(),
"(Run with --trace for a full exception trace.)"); '(Run with --trace for a full exception trace.)');
} }
exit(1); exit(1);

View file

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

View file

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

View file

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

View file

@ -49,7 +49,7 @@ $args->parse(
$root = $args->getArg('root'); $root = $args->getArg('root');
if (count($root) !== 1) { 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)); $root = Filesystem::resolvePath(head($root));

View file

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

View file

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

View file

@ -151,7 +151,7 @@ final class ArcanistConfigurationManager {
return $this->workingCopy->writeLocalArcConfig($config); 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) { public function setUserConfigurationFileLocation($custom_arcrc) {
if (!Filesystem::pathExists($custom_arcrc)) { if (!Filesystem::pathExists($custom_arcrc)) {
throw new Exception( 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; $this->customArcrcFilename = $custom_arcrc;

View file

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

View file

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

View file

@ -181,7 +181,7 @@ final class ArcanistHgProxyServer {
)); ));
if (!$hg->update()) { if (!$hg->update()) {
throw new Exception("Server exited unexpectedly!"); throw new Exception('Server exited unexpectedly!');
} }
// Accept any new clients. // Accept any new clients.
@ -353,7 +353,7 @@ final class ArcanistHgProxyServer {
$ok = stream_set_blocking($socket, 0); $ok = stream_set_blocking($socket, 0);
if ($ok === false) { if ($ok === false) {
throw new Exception("Unable to set socket nonblocking!"); throw new Exception('Unable to set socket nonblocking!');
} }
return $socket; return $socket;
@ -461,7 +461,7 @@ final class ArcanistHgProxyServer {
$pid = pcntl_fork(); $pid = pcntl_fork();
if ($pid === -1) { if ($pid === -1) {
throw new Exception("Unable to fork!"); throw new Exception('Unable to fork!');
} else if ($pid) { } else if ($pid) {
// We're the parent; exit. First, drop our reference to the socket so // 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 // 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) { protected function encodeMessage($argv) {
if (!is_array($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); $command = head($argv);

View file

@ -48,7 +48,7 @@ final class ArcanistLintPatcher {
} }
Filesystem::writeFile($lint, $data); 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) { if ($err) {
throw new Exception( throw new Exception(
"Unable to overwrite path `{$path}', patched version was left ". "Unable to overwrite path `{$path}', patched version was left ".

View file

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

View file

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

View file

@ -204,7 +204,7 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter {
* @task bin * @task bin
*/ */
public function getDefaultInterpreter() { 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 '. 'Unrecognized lint message code "%s". Expected a valid flake8 '.
'lint code like "%s", or "%s", or "%s", or "%s".', 'lint code like "%s", or "%s", or "%s", or "%s".',
$code, $code,
"E225", 'E225',
"W291", 'W291',
"F811", 'F811',
"C901")); 'C901'));
} }
return $code; return $code;

View file

@ -221,7 +221,7 @@ abstract class ArcanistLinter {
if (isset($map[$code])) { if (isset($map[$code])) {
return $map[$code]; return $map[$code];
} }
return "Unknown lint message!"; return 'Unknown lint message!';
} }
final protected function addLintMessage(ArcanistLintMessage $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 '. 'Unrecognized lint message code "%s". Expected a valid PEP8 '.
'lint code like "%s" or "%s".', 'lint code like "%s" or "%s".',
$code, $code,
"E101", 'E101',
"W291")); 'W291'));
} }
return $code; return $code;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -349,7 +349,7 @@ final class ArcanistDiffParser {
$this->parseIndexHunk($change); $this->parseIndexHunk($change);
break; break;
default: default:
$this->didFailParse("Unknown diff type."); $this->didFailParse('Unknown diff type.');
break; break;
} }
} while ($this->getLine() !== null); } while ($this->getLine() !== null);
@ -526,7 +526,7 @@ final class ArcanistDiffParser {
protected function setIsGit($git) { protected function setIsGit($git) {
if ($this->isGit !== null && $this->isGit != $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; $this->isGit = $git;
return $this; return $this;
@ -817,7 +817,7 @@ final class ArcanistDiffParser {
$this->nextNonemptyLine(); $this->nextNonemptyLine();
return; return;
} else if (!preg_match('/^[a-zA-Z]/', $line)) { } 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); } while (true);
} }
@ -878,7 +878,7 @@ final class ArcanistDiffParser {
$line = $this->nextNonemptyLine(); $line = $this->nextNonemptyLine();
$ok = preg_match('/^Property changes on:/', $line); $ok = preg_match('/^Property changes on:/', $line);
if (!$ok) { if (!$ok) {
$this->didFailParse("Confused by empty line"); $this->didFailParse('Confused by empty line');
} }
$line = $this->nextLine(); $line = $this->nextLine();
return $this->parsePropertyHunk($change); return $this->parsePropertyHunk($change);
@ -966,7 +966,7 @@ final class ArcanistDiffParser {
} }
if ($old_len || $new_len) { 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); $corpus = implode('', $real);
@ -1074,7 +1074,7 @@ final class ArcanistDiffParser {
protected function getLine() { protected function getLine() {
if ($this->text === null) { if ($this->text === null) {
throw new Exception("Not parsing!"); throw new Exception('Not parsing!');
} }
if (isset($this->text[$this->line])) { if (isset($this->text[$this->line])) {
return $this->text[$this->line]; return $this->text[$this->line];
@ -1168,7 +1168,7 @@ final class ArcanistDiffParser {
$context = ''; $context = '';
for ($ii = $min; $ii <= $max; $ii++) { for ($ii = $min; $ii <= $max; $ii++) {
$context .= sprintf( $context .= sprintf(
"%8.8s %6.6s %s", '%8.8s %6.6s %s',
($ii == $this->line) ? '>>> ' : '', ($ii == $this->line) ? '>>> ' : '',
$ii + 1, $ii + 1,
$this->text[$ii]); $this->text[$ii]);
@ -1182,7 +1182,7 @@ final class ArcanistDiffParser {
$temp->setPreserveFile(true); $temp->setPreserveFile(true);
Filesystem::writeFile($temp, $this->rawDiff); 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; $out[] = $context;
@ -1392,7 +1392,7 @@ final class ArcanistDiffParser {
// 8. ("--") // 8. ("--")
// 9. Patch footer. // 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($mail_headers, $mail_body) = explode("\n\n", $head, 2);
list($body, $foot) = preg_split('/^-- ?$/m', $tail, 2); list($body, $foot) = preg_split('/^-- ?$/m', $tail, 2);
list($stat, $diff) = explode("\n\n", $body, 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) { foreach ($raw_changes as $change) {
$this->assertTrue( $this->assertTrue(
empty($changes[$change->getCurrentPath()]), empty($changes[$change->getCurrentPath()]),
"Unique Path: ".$change->getCurrentPath()); 'Unique Path: '.$change->getCurrentPath());
$changes[$change->getCurrentPath()] = $change; $changes[$change->getCurrentPath()] = $change;
} }
@ -567,7 +567,7 @@ final class ArcanistBundleTestCase extends ArcanistTestCase {
case '228d7be4840313ed805c25c15bba0f7b188af3e6': case '228d7be4840313ed805c25c15bba0f7b188af3e6':
// "Add a text file." // "Add a text file."
// This commit is never reached because we skip the 0th commit junk. // 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; break;
default: default:
throw new Exception( throw new Exception(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
$absolute_path = Filesystem::resolvePath($path); $absolute_path = Filesystem::resolvePath($path);
if (is_dir($absolute_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)) { if (is_readable($absolute_test_path)) {
$affected_tests[] = $absolute_test_path; $affected_tests[] = $absolute_test_path;
} }
@ -29,7 +29,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
$directory = dirname($path); $directory = dirname($path);
// assumes directory layout: tests/<package>/test_<module>.py // 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); $absolute_test_path = Filesystem::resolvePath($relative_test_path);
if (is_readable($absolute_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) { 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); $xunit_tmp);
if ($this->getEnableCoverage() !== false) { if ($this->getEnableCoverage() !== false) {
$cmd_line .= csprintf(" --with-coverage --cover-xml " . $cmd_line .= csprintf(' --with-coverage --cover-xml ' .
"--cover-xml-file=%s", '--cover-xml-file=%s',
$cover_tmp); $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) { 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)); $coverage_dom->loadXML(Filesystem::readFile($cover_file));
$reports = array(); $reports = array();
$classes = $coverage_dom->getElementsByTagName("class"); $classes = $coverage_dom->getElementsByTagName('class');
foreach ($classes as $class) { foreach ($classes as $class) {
$path = $class->getAttribute("filename"); $path = $class->getAttribute('filename');
$root = $this->getWorkingCopy()->getProjectRoot(); $root = $this->getWorkingCopy()->getProjectRoot();
if (!Filesystem::isDescendant($path, $root)) { if (!Filesystem::isDescendant($path, $root)) {
@ -132,21 +132,21 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
// get total line count in file // get total line count in file
$line_count = count(phutil_split_lines(Filesystem::readFile($path))); $line_count = count(phutil_split_lines(Filesystem::readFile($path)));
$coverage = ""; $coverage = '';
$start_line = 1; $start_line = 1;
$lines = $class->getElementsByTagName("line"); $lines = $class->getElementsByTagName('line');
for ($ii = 0; $ii < $lines->length; $ii++) { for ($ii = 0; $ii < $lines->length; $ii++) {
$line = $lines->item($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++) { for ($start_line; $start_line < $next_line; $start_line++) {
$coverage .= "N"; $coverage .= 'N';
} }
if (intval($line->getAttribute("hits")) == 0) { if (intval($line->getAttribute('hits')) == 0) {
$coverage .= "U"; $coverage .= 'U';
} else if (intval($line->getAttribute("hits")) > 0) { } else if (intval($line->getAttribute('hits')) > 0) {
$coverage .= "C"; $coverage .= 'C';
} }
$start_line++; $start_line++;
@ -154,7 +154,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
if ($start_line < $line_count) { if ($start_line < $line_count) {
foreach (range($start_line, $line_count) as $line_num) { 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; $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', $futures[$test_path] = new ExecFuture('%C %C %C --log-json %s %C %s',
$this->phpunitBinary, $config, $stderr, $json_tmp, $clover, $test_path); $this->phpunitBinary, $config, $stderr, $json_tmp, $clover, $test_path);

View file

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

View file

@ -64,29 +64,29 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
$paths = $this->getPaths(); $paths = $this->getPaths();
$reports = array(); $reports = array();
$classes = $coverage_dom->getElementsByTagName("class"); $classes = $coverage_dom->getElementsByTagName('class');
foreach ($classes as $class) { foreach ($classes as $class) {
// filename is actually python module path with ".py" at the end, // filename is actually python module path with ".py" at the end,
// e.g.: tornado.web.py // e.g.: tornado.web.py
$relative_path = explode(".", $class->getAttribute("filename")); $relative_path = explode('.', $class->getAttribute('filename'));
array_pop($relative_path); 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 // 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. // set relative and absolute paths to have __init__.py at the end.
$absolute_path = Filesystem::resolvePath($relative_path); $absolute_path = Filesystem::resolvePath($relative_path);
if (is_dir($absolute_path)) { if (is_dir($absolute_path)) {
$relative_path .= "/__init__.py"; $relative_path .= '/__init__.py';
$absolute_path .= "/__init__.py"; $absolute_path .= '/__init__.py';
} }
// then we check if the path with ".py" at the end is file (a Python // 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 // submodule), if it is - set relative and absolute paths to have
// ".py" at the end. // ".py" at the end.
if (is_file($absolute_path.".py")) { if (is_file($absolute_path.'.py')) {
$relative_path .= ".py"; $relative_path .= '.py';
$absolute_path .= ".py"; $absolute_path .= '.py';
} }
if (!file_exists($absolute_path)) { if (!file_exists($absolute_path)) {
@ -100,22 +100,22 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
// get total line count in file // get total line count in file
$line_count = count(file($absolute_path)); $line_count = count(file($absolute_path));
$coverage = ""; $coverage = '';
$start_line = 1; $start_line = 1;
$lines = $class->getElementsByTagName("line"); $lines = $class->getElementsByTagName('line');
for ($ii = 0; $ii < $lines->length; $ii++) { for ($ii = 0; $ii < $lines->length; $ii++) {
$line = $lines->item($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++) { for ($start_line; $start_line < $next_line; $start_line++) {
$coverage .= "N"; $coverage .= 'N';
} }
if (intval($line->getAttribute("hits")) == 0) { if (intval($line->getAttribute('hits')) == 0) {
$coverage .= "U"; $coverage .= 'U';
} }
else if (intval($line->getAttribute("hits")) > 0) { else if (intval($line->getAttribute('hits')) > 0) {
$coverage .= "C"; $coverage .= 'C';
} }
$start_line++; $start_line++;
@ -123,7 +123,7 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
if ($start_line < $line_count) { if ($start_line < $line_count) {
foreach (range($start_line, $line_count) as $line_num) { 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(); $this->projectRoot = $this->getWorkingCopy()->getProjectRoot();
// Determine build engine. // Determine build engine.
if (Filesystem::binaryExists("msbuild")) { if (Filesystem::binaryExists('msbuild')) {
$this->buildEngine = "msbuild"; $this->buildEngine = 'msbuild';
} else if (Filesystem::binaryExists("xbuild")) { } else if (Filesystem::binaryExists('xbuild')) {
$this->buildEngine = "xbuild"; $this->buildEngine = 'xbuild';
} else { } 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). // Determine runtime engine (.NET or Mono).
if (phutil_is_windows()) { if (phutil_is_windows()) {
$this->runtimeEngine = ""; $this->runtimeEngine = '';
} else if (Filesystem::binaryExists("mono")) { } else if (Filesystem::binaryExists('mono')) {
$this->runtimeEngine = Filesystem::resolveBinary("mono"); $this->runtimeEngine = Filesystem::resolveBinary('mono');
} else { } 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. // Read the discovery rules.
@ -61,8 +61,8 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
'unit.csharp.discovery'); 'unit.csharp.discovery');
if ($this->discoveryRules === null) { if ($this->discoveryRules === null) {
throw new Exception( throw new Exception(
"You must configure discovery rules to map C# files ". 'You must configure discovery rules to map C# files '.
"back to test projects (`unit.csharp.discovery` in .arcconfig)."); 'back to test projects (`unit.csharp.discovery` in .arcconfig).');
} }
// Determine xUnit test runner path. // Determine xUnit test runner path.
@ -74,8 +74,8 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$xunit = $this->projectRoot.DIRECTORY_SEPARATOR.$this->xunitHintPath; $xunit = $this->projectRoot.DIRECTORY_SEPARATOR.$this->xunitHintPath;
if (file_exists($xunit) && $this->xunitHintPath !== null) { if (file_exists($xunit) && $this->xunitHintPath !== null) {
$this->testEngine = Filesystem::resolvePath($xunit); $this->testEngine = Filesystem::resolvePath($xunit);
} else if (Filesystem::binaryExists("xunit.console.clr4.exe")) { } else if (Filesystem::binaryExists('xunit.console.clr4.exe')) {
$this->testEngine = "xunit.console.clr4.exe"; $this->testEngine = 'xunit.console.clr4.exe';
} else { } else {
throw new Exception( throw new Exception(
"Unable to locate xUnit console runner. Configure ". "Unable to locate xUnit console runner. Configure ".
@ -204,23 +204,23 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
private function generateProjects() { private function generateProjects() {
// No "Build" directory; so skip generation of projects. // 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(); return array();
} }
// No "Protobuild.exe" file; so skip generation of projects. // No "Protobuild.exe" file; so skip generation of projects.
if (!is_file(Filesystem::resolvePath( if (!is_file(Filesystem::resolvePath(
$this->projectRoot."/Protobuild.exe"))) { $this->projectRoot.'/Protobuild.exe'))) {
return array(); return array();
} }
// Work out what platform the user is building for already. // 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); $files = Filesystem::listDirectory($this->projectRoot);
foreach ($files as $file) { foreach ($files as $file) {
if (strtolower(substr($file, -4)) == ".sln") { if (strtolower(substr($file, -4)) == '.sln') {
$parts = explode(".", $file); $parts = explode('.', $file);
$platform = $parts[count($parts) - 2]; $platform = $parts[count($parts) - 2];
break; break;
} }
@ -228,7 +228,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$regenerate_start = microtime(true); $regenerate_start = microtime(true);
$regenerate_future = new ExecFuture( $regenerate_future = new ExecFuture(
"%C Protobuild.exe --resync %s", '%C Protobuild.exe --resync %s',
$this->runtimeEngine, $this->runtimeEngine,
$platform); $platform);
$regenerate_future->setCWD(Filesystem::resolvePath( $regenerate_future->setCWD(Filesystem::resolvePath(
@ -271,9 +271,9 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$results = array(); $results = array();
foreach ($test_assemblies as $test_assembly) { foreach ($test_assemblies as $test_assembly) {
$build_future = new ExecFuture( $build_future = new ExecFuture(
"%C %s", '%C %s',
$this->buildEngine, $this->buildEngine,
"/p:SkipTestsOnBuild=True"); '/p:SkipTestsOnBuild=True');
$build_future->setCWD(Filesystem::resolvePath( $build_future->setCWD(Filesystem::resolvePath(
dirname($test_assembly['project']))); dirname($test_assembly['project'])));
$build_futures[$test_assembly['project']] = $build_future; $build_futures[$test_assembly['project']] = $build_future;
@ -281,7 +281,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$iterator = Futures($build_futures)->limit(1); $iterator = Futures($build_futures)->limit(1);
foreach ($iterator as $test_assembly => $future) { foreach ($iterator as $test_assembly => $future) {
$result = new ArcanistUnitTestResult(); $result = new ArcanistUnitTestResult();
$result->setName("(build) ".$test_assembly); $result->setName('(build) '.$test_assembly);
try { try {
$future->resolvex(); $future->resolvex();
@ -314,20 +314,20 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
// FIXME: Can't use TempFile here as xUnit doesn't like // FIXME: Can't use TempFile here as xUnit doesn't like
// UNIX-style full paths. It sees the leading / as the // UNIX-style full paths. It sees the leading / as the
// start of an option flag, even when quoted. // 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)) { if (file_exists($xunit_temp)) {
unlink($xunit_temp); unlink($xunit_temp);
} }
$future = new ExecFuture( $future = new ExecFuture(
"%C %s /xml %s", '%C %s /xml %s',
trim($this->runtimeEngine." ".$this->testEngine), trim($this->runtimeEngine.' '.$this->testEngine),
$test_assembly, $test_assembly,
$xunit_temp); $xunit_temp);
$folder = Filesystem::resolvePath($this->projectRoot); $folder = Filesystem::resolvePath($this->projectRoot);
$future->setCWD($folder); $future->setCWD($folder);
$combined = $folder."/".$xunit_temp; $combined = $folder.'/'.$xunit_temp;
if (phutil_is_windows()) { if (phutil_is_windows()) {
$combined = $folder."\\".$xunit_temp; $combined = $folder.'\\'.$xunit_temp;
} }
return array($future, $combined, null); return array($future, $combined, null);
} }
@ -408,32 +408,32 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
$xunit_dom->loadXML(Filesystem::readFile($xunit_tmp)); $xunit_dom->loadXML(Filesystem::readFile($xunit_tmp));
$results = array(); $results = array();
$tests = $xunit_dom->getElementsByTagName("test"); $tests = $xunit_dom->getElementsByTagName('test');
foreach ($tests as $test) { foreach ($tests as $test) {
$name = $test->getAttribute("name"); $name = $test->getAttribute('name');
$time = $test->getAttribute("time"); $time = $test->getAttribute('time');
$status = ArcanistUnitTestResult::RESULT_UNSOUND; $status = ArcanistUnitTestResult::RESULT_UNSOUND;
switch ($test->getAttribute("result")) { switch ($test->getAttribute('result')) {
case "Pass": case 'Pass':
$status = ArcanistUnitTestResult::RESULT_PASS; $status = ArcanistUnitTestResult::RESULT_PASS;
break; break;
case "Fail": case 'Fail':
$status = ArcanistUnitTestResult::RESULT_FAIL; $status = ArcanistUnitTestResult::RESULT_FAIL;
break; break;
case "Skip": case 'Skip':
$status = ArcanistUnitTestResult::RESULT_SKIP; $status = ArcanistUnitTestResult::RESULT_SKIP;
break; break;
} }
$userdata = ""; $userdata = '';
$reason = $test->getElementsByTagName("reason"); $reason = $test->getElementsByTagName('reason');
$failure = $test->getElementsByTagName("failure"); $failure = $test->getElementsByTagName('failure');
if ($reason->length > 0 || $failure->length > 0) { if ($reason->length > 0 || $failure->length > 0) {
$node = ($reason->length > 0) ? $reason : $failure; $node = ($reason->length > 0) ? $reason : $failure;
$message = $node->item(0)->getElementsByTagName("message"); $message = $node->item(0)->getElementsByTagName('message');
if ($message->length > 0) { if ($message->length > 0) {
$userdata = $message->item(0)->nodeValue; $userdata = $message->item(0)->nodeValue;
} }
$stacktrace = $node->item(0)->getElementsByTagName("stack-trace"); $stacktrace = $node->item(0)->getElementsByTagName('stack-trace');
if ($stacktrace->length > 0) { if ($stacktrace->length > 0) {
$userdata .= "\n".$stacktrace->item(0)->nodeValue; $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(2, count($parsed_results));
$this->assertEqual( $this->assertEqual(
"Go::Test::package::subpackage::TestFoo", 'Go::Test::package::subpackage::TestFoo',
$parsed_results[0]->getName()); $parsed_results[0]->getName());
foreach ($parsed_results as $result) { foreach ($parsed_results as $result) {
$this->assertEqual( $this->assertEqual(
@ -53,10 +53,10 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
$this->assertEqual(3, count($parsed_results)); $this->assertEqual(3, count($parsed_results));
$this->assertEqual( $this->assertEqual(
"Go::Test::package::subpackage1::TestFoo1", 'Go::Test::package::subpackage1::TestFoo1',
$parsed_results[0]->getName()); $parsed_results[0]->getName());
$this->assertEqual( $this->assertEqual(
"Go::Test::package::subpackage2::TestFoo2", 'Go::Test::package::subpackage2::TestFoo2',
$parsed_results[2]->getName()); $parsed_results[2]->getName());
foreach ($parsed_results as $result) { foreach ($parsed_results as $result) {
$this->assertEqual( $this->assertEqual(
@ -74,10 +74,10 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
$this->assertEqual(3, count($parsed_results)); $this->assertEqual(3, count($parsed_results));
$this->assertEqual( $this->assertEqual(
"Go::Test::package::subpackage1::TestFoo1", 'Go::Test::package::subpackage1::TestFoo1',
$parsed_results[0]->getName()); $parsed_results[0]->getName());
$this->assertEqual( $this->assertEqual(
"Go::Test::package::subpackage2::TestFoo2", 'Go::Test::package::subpackage2::TestFoo2',
$parsed_results[2]->getName()); $parsed_results[2]->getName());
$this->assertEqual( $this->assertEqual(
ArcanistUnitTestResult::RESULT_PASS, ArcanistUnitTestResult::RESULT_PASS,
@ -96,10 +96,10 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
$this->assertEqual(2, count($parsed_results)); $this->assertEqual(2, count($parsed_results));
$this->assertEqual( $this->assertEqual(
"Go::TestCase::package::subpackage1", 'Go::TestCase::package::subpackage1',
$parsed_results[0]->getName()); $parsed_results[0]->getName());
$this->assertEqual( $this->assertEqual(
"Go::TestCase::package::subpackage2", 'Go::TestCase::package::subpackage2',
$parsed_results[1]->getName()); $parsed_results[1]->getName());
foreach ($parsed_results as $result) { foreach ($parsed_results as $result) {
$this->assertEqual( $this->assertEqual(

View file

@ -43,7 +43,7 @@ final class PhutilUnitTestEngineTestCase extends ArcanistTestCase {
public function __destruct() { public function __destruct() {
if (self::$allTestsCounter !== 0) { if (self::$allTestsCounter !== 0) {
throw new Exception( 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) { protected function throwIfFalsey($input) {
if (!$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) { if ($message !== null) {
$output = pht( $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, $file,
$line, $line,
$message); $message);
} else { } else {
$output = pht( $output = pht(
"Assertion failed, expected values to be equal (at %s:%d).", 'Assertion failed, expected values to be equal (at %s:%d).',
$file, $file,
$line); $line);
} }
@ -216,7 +216,7 @@ abstract class ArcanistPhutilTestCase {
if (count($inputs) !== count($expect)) { if (count($inputs) !== count($expect)) {
$this->assertFailure( $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); $labels = array_keys($inputs);
@ -500,7 +500,7 @@ abstract class ArcanistPhutilTestCase {
throw head($exceptions); throw head($exceptions);
} else { } else {
throw new PhutilAggregateException( throw new PhutilAggregateException(
"Multiple exceptions were raised during test execution.", 'Multiple exceptions were raised during test execution.',
$exceptions); $exceptions);
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,15 +52,15 @@ EOTEXT
protected function didParseArguments() { protected function didParseArguments() {
$argv = $this->getArgument('argv'); $argv = $this->getArgument('argv');
if (!$argv) { if (!$argv) {
throw new ArcanistUsageException("Specify a file to download."); throw new ArcanistUsageException('Specify a file to download.');
} }
if (count($argv) > 1) { 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); $file = reset($argv);
if (!preg_match('/^F?\d+$/', $file)) { 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'); $this->id = (int)ltrim($file, 'F');

View file

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

View file

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

View file

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

View file

@ -47,8 +47,8 @@ EOTEXT
$working_copy = $this->getWorkingCopy(); $working_copy = $this->getWorkingCopy();
if (!$working_copy->getProjectID()) { if (!$working_copy->getProjectID()) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"You have installed a git pre-receive hook in a remote without an ". 'You have installed a git pre-receive hook in a remote without an '.
".arcconfig."); '.arcconfig.');
} }
// Git repositories have special rules in pre-receive hooks. We need to // 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['param'])) {
if (isset($spec['short'])) { if (isset($spec['short'])) {
$optref[] = phutil_console_format( $optref[] = phutil_console_format(
" __--%s__ __%s__, __-%s__ __%s__", ' __--%s__ __%s__, __-%s__ __%s__',
$argument, $argument,
$spec['param'], $spec['param'],
$spec['short'], $spec['short'],
$spec['param']); $spec['param']);
} else { } else {
$optref[] = phutil_console_format( $optref[] = phutil_console_format(
" __--%s__ __%s__", ' __--%s__ __%s__',
$argument, $argument,
$spec['param']); $spec['param']);
} }
} else { } else {
if (isset($spec['short'])) { if (isset($spec['short'])) {
$optref[] = phutil_console_format( $optref[] = phutil_console_format(
" __--%s__, __-%s__", ' __--%s__, __-%s__',
$argument, $argument,
$spec['short']); $spec['short']);
} else { } else {
$optref[] = phutil_console_format( $optref[] = phutil_console_format(
" __--%s__", ' __--%s__',
$argument); $argument);
} }
} }
if (isset($config_arguments[$argument])) { if (isset($config_arguments[$argument])) {
$optref[] = " (This is a custom option for this ". $optref[] = ' (This is a custom option for this '.
"project.)"; 'project.)';
} }
if (isset($spec['supports'])) { if (isset($spec['supports'])) {
$optref[] = " Supports: ". $optref[] = ' Supports: '.
implode(', ', $spec['supports']); implode(', ', $spec['supports']);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -40,7 +40,7 @@ EOTEXT
protected function didParseArguments() { protected function didParseArguments() {
if (!$this->getArgument('paths')) { 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'); $this->paths = $this->getArgument('paths');

View file

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