From 17820442da3c6e980586f43111f4c5acdd61e546 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Fri, 23 May 2014 13:53:05 -0700 Subject: [PATCH] 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 --- scripts/arcanist.php | 6 +- scripts/hgdaemon/hgdaemon_client.php | 2 +- scripts/hgdaemon/hgdaemon_server.php | 2 +- scripts/lib/PhutilLibraryMapBuilder.php | 2 +- scripts/phutil_rebuild_map.php | 2 +- scripts/phutil_symbols.php | 2 +- src/configuration/ArcanistConfiguration.php | 2 +- .../ArcanistConfigurationManager.php | 4 +- src/configuration/ArcanistSettings.php | 6 +- .../__tests__/ArcanistDiffUtilsTestCase.php | 18 +-- src/hgdaemon/ArcanistHgClientChannel.php | 2 +- src/hgdaemon/ArcanistHgProxyServer.php | 6 +- src/hgdaemon/ArcanistHgServerChannel.php | 2 +- src/lint/ArcanistLintPatcher.php | 2 +- src/lint/engine/ArcanistLintEngine.php | 4 +- src/lint/linter/ArcanistCSharpLinter.php | 36 +++--- src/lint/linter/ArcanistExternalLinter.php | 2 +- src/lint/linter/ArcanistFlake8Linter.php | 8 +- src/lint/linter/ArcanistLinter.php | 2 +- src/lint/linter/ArcanistPEP8Linter.php | 4 +- src/lint/linter/ArcanistPyLintLinter.php | 16 +-- src/lint/linter/ArcanistRubyLinter.php | 2 +- src/lint/linter/ArcanistTextLinter.php | 2 +- src/lint/linter/ArcanistXHPASTLinter.php | 24 ++-- .../ArcanistClosureLinterTestCase.php | 2 +- .../renderer/ArcanistLintConsoleRenderer.php | 4 +- .../renderer/ArcanistLintJSONRenderer.php | 2 +- .../ArcanistLintLikeCompilerRenderer.php | 2 +- .../renderer/ArcanistLintSummaryRenderer.php | 2 +- src/parser/ArcanistBaseCommitParser.php | 6 +- src/parser/ArcanistBundle.php | 10 +- src/parser/ArcanistDiffParser.php | 18 +-- .../__tests__/ArcanistBundleTestCase.php | 4 +- .../__tests__/ArcanistDiffParserTestCase.php | 14 +- src/parser/diff/ArcanistDiffChange.php | 6 +- src/repository/api/ArcanistGitAPI.php | 24 ++-- src/repository/api/ArcanistMercurialAPI.php | 32 ++--- src/repository/api/ArcanistRepositoryAPI.php | 8 +- src/repository/api/ArcanistSubversionAPI.php | 4 +- .../engine/ArcanistXUnitTestResultParser.php | 18 +-- src/unit/engine/CSharpToolsTestEngine.php | 42 +++--- src/unit/engine/GoTestResultParser.php | 16 +-- src/unit/engine/NoseTestEngine.php | 34 ++--- src/unit/engine/PhpunitTestEngine.php | 2 +- src/unit/engine/PhutilUnitTestEngine.php | 6 +- src/unit/engine/PytestTestEngine.php | 34 ++--- src/unit/engine/XUnitTestEngine.php | 78 +++++------ .../__tests__/GoTestResultParserTestCase.php | 14 +- .../PhutilUnitTestEngineTestCase.php | 4 +- .../engine/phutil/ArcanistPhutilTestCase.php | 8 +- .../renderer/ArcanistUnitConsoleRenderer.php | 2 +- src/workflow/ArcanistAmendWorkflow.php | 10 +- src/workflow/ArcanistBackoutWorkflow.php | 8 +- src/workflow/ArcanistBaseWorkflow.php | 34 ++--- src/workflow/ArcanistCallConduitWorkflow.php | 4 +- .../ArcanistCloseRevisionWorkflow.php | 4 +- src/workflow/ArcanistCloseWorkflow.php | 4 +- src/workflow/ArcanistCommitWorkflow.php | 12 +- src/workflow/ArcanistCoverWorkflow.php | 2 +- src/workflow/ArcanistDiffWorkflow.php | 122 +++++++++--------- src/workflow/ArcanistDownloadWorkflow.php | 6 +- src/workflow/ArcanistExportWorkflow.php | 10 +- src/workflow/ArcanistFeatureWorkflow.php | 4 +- src/workflow/ArcanistFlagWorkflow.php | 4 +- .../ArcanistGitHookPreReceiveWorkflow.php | 4 +- src/workflow/ArcanistHelpWorkflow.php | 14 +- src/workflow/ArcanistInlinesWorkflow.php | 8 +- .../ArcanistInstallCertificateWorkflow.php | 10 +- src/workflow/ArcanistLandWorkflow.php | 60 ++++----- src/workflow/ArcanistLiberateWorkflow.php | 30 ++--- src/workflow/ArcanistLintWorkflow.php | 34 ++--- src/workflow/ArcanistPasteWorkflow.php | 6 +- src/workflow/ArcanistPatchWorkflow.php | 46 +++---- .../ArcanistSvnHookPreCommitWorkflow.php | 2 +- src/workflow/ArcanistTasksWorkflow.php | 26 ++-- src/workflow/ArcanistUnitWorkflow.php | 18 +-- src/workflow/ArcanistUploadWorkflow.php | 2 +- src/workflow/ArcanistWhichWorkflow.php | 4 +- 78 files changed, 521 insertions(+), 521 deletions(-) diff --git a/scripts/arcanist.php b/scripts/arcanist.php index f4e6bc54..a304a28c 100755 --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -195,8 +195,8 @@ try { if ($need_working_copy || $want_working_copy) { if ($need_working_copy && !$working_copy->getVCSType()) { throw new ArcanistUsageException( - "This command must be run in a Git, Mercurial or Subversion working ". - "copy."); + 'This command must be run in a Git, Mercurial or Subversion working '. + 'copy.'); } $configuration_manager->setWorkingCopyIdentity($working_copy); } @@ -352,7 +352,7 @@ try { echo phutil_console_format( "**Exception**\n%s\n%s\n", $ex->getMessage(), - "(Run with --trace for a full exception trace.)"); + '(Run with --trace for a full exception trace.)'); } exit(1); diff --git a/scripts/hgdaemon/hgdaemon_client.php b/scripts/hgdaemon/hgdaemon_client.php index dab5702a..88f9f72d 100755 --- a/scripts/hgdaemon/hgdaemon_client.php +++ b/scripts/hgdaemon/hgdaemon_client.php @@ -22,7 +22,7 @@ $args->parse( $repo = $args->getArg('repository'); if (count($repo) !== 1) { - throw new Exception("Specify exactly one working copy!"); + throw new Exception('Specify exactly one working copy!'); } $repo = head($repo); diff --git a/scripts/hgdaemon/hgdaemon_server.php b/scripts/hgdaemon/hgdaemon_server.php index d1cd90e3..41acc0b5 100755 --- a/scripts/hgdaemon/hgdaemon_server.php +++ b/scripts/hgdaemon/hgdaemon_server.php @@ -40,7 +40,7 @@ $args->parse( $repo = $args->getArg('repository'); if (count($repo) !== 1) { - throw new Exception("Specify exactly one working copy!"); + throw new Exception('Specify exactly one working copy!'); } $repo = head($repo); diff --git a/scripts/lib/PhutilLibraryMapBuilder.php b/scripts/lib/PhutilLibraryMapBuilder.php index 88a73946..bd37934f 100644 --- a/scripts/lib/PhutilLibraryMapBuilder.php +++ b/scripts/lib/PhutilLibraryMapBuilder.php @@ -152,7 +152,7 @@ final class PhutilLibraryMapBuilder { $result['error']); exit(1); } - $this->log("."); + $this->log('.'); } $this->log("\nDone.\n"); } diff --git a/scripts/phutil_rebuild_map.php b/scripts/phutil_rebuild_map.php index ae254bcb..517ba97b 100755 --- a/scripts/phutil_rebuild_map.php +++ b/scripts/phutil_rebuild_map.php @@ -49,7 +49,7 @@ $args->parse( $root = $args->getArg('root'); if (count($root) !== 1) { - throw new Exception("Provide exactly one library root!"); + throw new Exception('Provide exactly one library root!'); } $root = Filesystem::resolvePath(head($root)); diff --git a/scripts/phutil_symbols.php b/scripts/phutil_symbols.php index 8a7fbeed..4de03121 100755 --- a/scripts/phutil_symbols.php +++ b/scripts/phutil_symbols.php @@ -52,7 +52,7 @@ $args->parse( $paths = $args->getArg('path'); if (count($paths) !== 1) { - throw new Exception("Specify exactly one path!"); + throw new Exception('Specify exactly one path!'); } $path = Filesystem::resolvePath(head($paths)); diff --git a/src/configuration/ArcanistConfiguration.php b/src/configuration/ArcanistConfiguration.php index 373a9195..790dc195 100644 --- a/src/configuration/ArcanistConfiguration.php +++ b/src/configuration/ArcanistConfiguration.php @@ -168,7 +168,7 @@ class ArcanistConfiguration { private function raiseUnknownCommand($command, array $maybe = array()) { $message = pht("Unknown command '%s'. Try 'arc help'.", $command); if ($maybe) { - $message .= "\n\n".pht("Did you mean:")."\n"; + $message .= "\n\n".pht('Did you mean:')."\n"; sort($maybe); foreach ($maybe as $other) { $message .= " ".$other."\n"; diff --git a/src/configuration/ArcanistConfigurationManager.php b/src/configuration/ArcanistConfigurationManager.php index ec5a22f1..dadbd3e6 100644 --- a/src/configuration/ArcanistConfigurationManager.php +++ b/src/configuration/ArcanistConfigurationManager.php @@ -151,7 +151,7 @@ final class ArcanistConfigurationManager { return $this->workingCopy->writeLocalArcConfig($config); } - throw new Exception(pht("No working copy to write config to!")); + throw new Exception(pht('No working copy to write config to!')); } /** @@ -235,7 +235,7 @@ final class ArcanistConfigurationManager { public function setUserConfigurationFileLocation($custom_arcrc) { if (!Filesystem::pathExists($custom_arcrc)) { throw new Exception( - "Custom arcrc file was specified, but it was not found!"); + 'Custom arcrc file was specified, but it was not found!'); } $this->customArcrcFilename = $custom_arcrc; diff --git a/src/configuration/ArcanistSettings.php b/src/configuration/ArcanistSettings.php index 08289abf..a89ef574 100644 --- a/src/configuration/ArcanistSettings.php +++ b/src/configuration/ArcanistSettings.php @@ -142,7 +142,7 @@ final class ArcanistSettings { 'browser' => array( 'type' => 'string', 'help' => - "Command to use to invoke a web browser.", + 'Command to use to invoke a web browser.', 'example' => '"gnome-www-browser"', ), 'events.listeners' => array( @@ -154,13 +154,13 @@ final class ArcanistSettings { 'http.basicauth.user' => array( 'type' => 'string', 'help' => - "Username to use for basic auth over http transports", + 'Username to use for basic auth over http transports', 'example' => '"bob"', ), 'http.basicauth.pass' => array( 'type' => 'string', 'help' => - "Password to use for basic auth over http transports", + 'Password to use for basic auth over http transports', 'example' => '"bobhasasecret"', ), 'arc.autostash' => array( diff --git a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php index fa656464..e07da6a4 100644 --- a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php +++ b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php @@ -100,7 +100,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { $utf8_tests = array( array( - "GrumpyCat", + 'GrumpyCat', "Grumpy\xE2\x98\x83at", 'ssssssxss', ), @@ -118,8 +118,8 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { public function testGenerateUTF8IntralineDiff() { // Both Strings Empty. - $left = ""; - $right = ""; + $left = ''; + $right = ''; $result = array( array(array(0, 0)), array(array(0, 0)) @@ -129,7 +129,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { ArcanistDiffUtils::generateIntralineDiff($left, $right)); // Left String Empty. - $left = ""; + $left = ''; $right = "Grumpy\xE2\x98\x83at"; $result = array( array(array(0, 0)), @@ -141,7 +141,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { // Right String Empty. $left = "Grumpy\xE2\x98\x83at"; - $right = ""; + $right = ''; $result = array( array(array(0, 11)), array(array(0, 0)) @@ -163,7 +163,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { // Both Strings are different. $left = "Grumpy\xE2\x98\x83at"; - $right = "Smiling Dog"; + $right = 'Smiling Dog'; $result = array( array(array(1, 11)), array(array(1, 11)) @@ -173,7 +173,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { ArcanistDiffUtils::generateIntralineDiff($left, $right)); // String with one difference in the middle. - $left = "GrumpyCat"; + $left = 'GrumpyCat'; $right = "Grumpy\xE2\x98\x83at"; $result = array( array(array(0, 6), array(1, 1), array(0, 2)), @@ -184,7 +184,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { ArcanistDiffUtils::generateIntralineDiff($left, $right)); // Differences in middle, not connected to each other. - $left = "GrumpyCat"; + $left = 'GrumpyCat'; $right = "Grumpy\xE2\x98\x83a\xE2\x98\x83t"; $result = array( array(array(0, 6), array(1, 2), array(0, 1)), @@ -229,7 +229,7 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { // This is a unicode combining character, "COMBINING DOUBLE TILDE". $cc = "\xCD\xA0"; - $left = "Senor"; + $left = 'Senor'; $right = "Sen{$cc}or"; $result = array( array(array(0, 2), array(1, 1), array(0, 2)), diff --git a/src/hgdaemon/ArcanistHgClientChannel.php b/src/hgdaemon/ArcanistHgClientChannel.php index 61b97940..a1c803a5 100644 --- a/src/hgdaemon/ArcanistHgClientChannel.php +++ b/src/hgdaemon/ArcanistHgClientChannel.php @@ -57,7 +57,7 @@ final class ArcanistHgClientChannel extends PhutilProtocolChannel { */ protected function encodeMessage($argv) { if (!is_array($argv) || count($argv) !== 2) { - throw new Exception("Message should be ."); + throw new Exception('Message should be .'); } $channel = head($argv); diff --git a/src/hgdaemon/ArcanistHgProxyServer.php b/src/hgdaemon/ArcanistHgProxyServer.php index 04097cdb..2cef30eb 100644 --- a/src/hgdaemon/ArcanistHgProxyServer.php +++ b/src/hgdaemon/ArcanistHgProxyServer.php @@ -181,7 +181,7 @@ final class ArcanistHgProxyServer { )); if (!$hg->update()) { - throw new Exception("Server exited unexpectedly!"); + throw new Exception('Server exited unexpectedly!'); } // Accept any new clients. @@ -353,7 +353,7 @@ final class ArcanistHgProxyServer { $ok = stream_set_blocking($socket, 0); if ($ok === false) { - throw new Exception("Unable to set socket nonblocking!"); + throw new Exception('Unable to set socket nonblocking!'); } return $socket; @@ -461,7 +461,7 @@ final class ArcanistHgProxyServer { $pid = pcntl_fork(); if ($pid === -1) { - throw new Exception("Unable to fork!"); + throw new Exception('Unable to fork!'); } else if ($pid) { // We're the parent; exit. First, drop our reference to the socket so // our __destruct() doesn't tear it down; the child will tear it down diff --git a/src/hgdaemon/ArcanistHgServerChannel.php b/src/hgdaemon/ArcanistHgServerChannel.php index da57e81f..b16f3bd1 100644 --- a/src/hgdaemon/ArcanistHgServerChannel.php +++ b/src/hgdaemon/ArcanistHgServerChannel.php @@ -86,7 +86,7 @@ final class ArcanistHgServerChannel extends PhutilProtocolChannel { */ protected function encodeMessage($argv) { if (!is_array($argv)) { - throw new Exception("Message to Mercurial server should be an array."); + throw new Exception('Message to Mercurial server should be an array.'); } $command = head($argv); diff --git a/src/lint/ArcanistLintPatcher.php b/src/lint/ArcanistLintPatcher.php index 5ec3825d..51639d3e 100644 --- a/src/lint/ArcanistLintPatcher.php +++ b/src/lint/ArcanistLintPatcher.php @@ -48,7 +48,7 @@ final class ArcanistLintPatcher { } Filesystem::writeFile($lint, $data); - list($err) = exec_manual("mv -f %s %s", $lint, $path); + list($err) = exec_manual('mv -f %s %s', $lint, $path); if ($err) { throw new Exception( "Unable to overwrite path `{$path}', patched version was left ". diff --git a/src/lint/engine/ArcanistLintEngine.php b/src/lint/engine/ArcanistLintEngine.php index aeb5fea7..8ccfd5f9 100644 --- a/src/lint/engine/ArcanistLintEngine.php +++ b/src/lint/engine/ArcanistLintEngine.php @@ -208,7 +208,7 @@ abstract class ArcanistLintEngine { final public function run() { $linters = $this->buildLinters(); if (!$linters) { - throw new ArcanistNoEffectException("No linters to run."); + throw new ArcanistNoEffectException('No linters to run.'); } $linters = msort($linters, 'getLinterPriority'); @@ -225,7 +225,7 @@ abstract class ArcanistLintEngine { } if (!$have_paths) { - throw new ArcanistNoEffectException("No paths are lintable."); + throw new ArcanistNoEffectException('No paths are lintable.'); } $versions = array($this->getCacheVersion()); diff --git a/src/lint/linter/ArcanistCSharpLinter.php b/src/lint/linter/ArcanistCSharpLinter.php index aaedab86..33014253 100644 --- a/src/lint/linter/ArcanistCSharpLinter.php +++ b/src/lint/linter/ArcanistCSharpLinter.php @@ -60,7 +60,7 @@ final class ArcanistCSharpLinter extends ArcanistLinter { public function setCustomSeverityMap(array $map) { foreach ($map as $code => $severity) { - if (substr($code, 0, 2) === "SA" && $severity == "disabled") { + if (substr($code, 0, 2) === 'SA' && $severity == 'disabled') { throw new Exception( "In order to keep StyleCop integration with IDEs and other tools ". "consistent with Arcanist results, you aren't permitted to ". @@ -88,42 +88,42 @@ final class ArcanistCSharpLinter extends ArcanistLinter { // Determine runtime engine (.NET or Mono). if (phutil_is_windows()) { - $this->runtimeEngine = ""; - } else if (Filesystem::binaryExists("mono")) { - $this->runtimeEngine = "mono "; + $this->runtimeEngine = ''; + } else if (Filesystem::binaryExists('mono')) { + $this->runtimeEngine = 'mono '; } else { - throw new Exception("Unable to find Mono and you are not on Windows!"); + throw new Exception('Unable to find Mono and you are not on Windows!'); } // Determine cslint path. $cslint = $this->cslintHintPath; if ($cslint !== null && file_exists($cslint)) { $this->cslintEngine = Filesystem::resolvePath($cslint); - } else if (Filesystem::binaryExists("cslint.exe")) { - $this->cslintEngine = "cslint.exe"; + } else if (Filesystem::binaryExists('cslint.exe')) { + $this->cslintEngine = 'cslint.exe'; } else { - throw new Exception("Unable to locate cslint."); + throw new Exception('Unable to locate cslint.'); } // Determine cslint version. $ver_future = new ExecFuture( - "%C -v", + '%C -v', $this->runtimeEngine.$this->cslintEngine); list($err, $stdout, $stderr) = $ver_future->resolve(); if ($err !== 0) { throw new Exception( - "You are running an old version of cslint. Please ". - "upgrade to version ".self::SUPPORTED_VERSION."."); + 'You are running an old version of cslint. Please '. + 'upgrade to version '.self::SUPPORTED_VERSION.'.'); } $ver = (int)$stdout; if ($ver < self::SUPPORTED_VERSION) { throw new Exception( - "You are running an old version of cslint. Please ". - "upgrade to version ".self::SUPPORTED_VERSION."."); - } elseif ($ver > self::SUPPORTED_VERSION) { + 'You are running an old version of cslint. Please '. + 'upgrade to version '.self::SUPPORTED_VERSION.'.'); + } else if ($ver > self::SUPPORTED_VERSION) { throw new Exception( - "Arcanist does not support this version of cslint (it is ". - "newer). You can try upgrading Arcanist with `arc upgrade`."); + 'Arcanist does not support this version of cslint (it is '. + 'newer). You can try upgrading Arcanist with `arc upgrade`.'); } $this->loaded = true; @@ -158,7 +158,7 @@ final class ArcanistCSharpLinter extends ArcanistLinter { // settings JSON through base64-encoded to mitigate // this issue. $futures[] = new ExecFuture( - "%C --settings-base64=%s -r=. %Ls", + '%C --settings-base64=%s -r=. %Ls', $this->runtimeEngine.$this->cslintEngine, base64_encode(json_encode($this->discoveryMap)), $current_paths); @@ -173,7 +173,7 @@ final class ArcanistCSharpLinter extends ArcanistLinter { // a future for those too. if (count($current_paths) > 0) { $futures[] = new ExecFuture( - "%C --settings-base64=%s -r=. %Ls", + '%C --settings-base64=%s -r=. %Ls', $this->runtimeEngine.$this->cslintEngine, base64_encode(json_encode($this->discoveryMap)), $current_paths); diff --git a/src/lint/linter/ArcanistExternalLinter.php b/src/lint/linter/ArcanistExternalLinter.php index 04e0631a..ec889d89 100644 --- a/src/lint/linter/ArcanistExternalLinter.php +++ b/src/lint/linter/ArcanistExternalLinter.php @@ -204,7 +204,7 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter { * @task bin */ public function getDefaultInterpreter() { - throw new Exception("Incomplete implementation!"); + throw new Exception('Incomplete implementation!'); } diff --git a/src/lint/linter/ArcanistFlake8Linter.php b/src/lint/linter/ArcanistFlake8Linter.php index b98c8a6e..a9102392 100644 --- a/src/lint/linter/ArcanistFlake8Linter.php +++ b/src/lint/linter/ArcanistFlake8Linter.php @@ -128,10 +128,10 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter { 'Unrecognized lint message code "%s". Expected a valid flake8 '. 'lint code like "%s", or "%s", or "%s", or "%s".', $code, - "E225", - "W291", - "F811", - "C901")); + 'E225', + 'W291', + 'F811', + 'C901')); } return $code; diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php index b6b566e2..60cc53f1 100644 --- a/src/lint/linter/ArcanistLinter.php +++ b/src/lint/linter/ArcanistLinter.php @@ -221,7 +221,7 @@ abstract class ArcanistLinter { if (isset($map[$code])) { return $map[$code]; } - return "Unknown lint message!"; + return 'Unknown lint message!'; } final protected function addLintMessage(ArcanistLintMessage $message) { diff --git a/src/lint/linter/ArcanistPEP8Linter.php b/src/lint/linter/ArcanistPEP8Linter.php index e02134d1..bb93acb4 100644 --- a/src/lint/linter/ArcanistPEP8Linter.php +++ b/src/lint/linter/ArcanistPEP8Linter.php @@ -125,8 +125,8 @@ final class ArcanistPEP8Linter extends ArcanistExternalLinter { 'Unrecognized lint message code "%s". Expected a valid PEP8 '. 'lint code like "%s" or "%s".', $code, - "E101", - "W291")); + 'E101', + 'W291')); } return $code; diff --git a/src/lint/linter/ArcanistPyLintLinter.php b/src/lint/linter/ArcanistPyLintLinter.php index aeb3f7fc..9ce9202d 100644 --- a/src/lint/linter/ArcanistPyLintLinter.php +++ b/src/lint/linter/ArcanistPyLintLinter.php @@ -98,13 +98,13 @@ final class ArcanistPyLintLinter extends ArcanistLinter { } private function getPyLintPath() { - $pylint_bin = "pylint"; + $pylint_bin = 'pylint'; // Use the PyLint prefix specified in the config file $config = $this->getEngine()->getConfigurationManager(); $prefix = $config->getConfigFromAnySource('lint.pylint.prefix'); if ($prefix !== null) { - $pylint_bin = $prefix."/bin/".$pylint_bin; + $pylint_bin = $prefix.'/bin/'.$pylint_bin; } if (!Filesystem::pathExists($pylint_bin)) { @@ -156,7 +156,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter { } $python_path[] = ''; - return implode(":", $python_path); + return implode(':', $python_path); } private function getPyLintOptions() { @@ -164,8 +164,8 @@ final class ArcanistPyLintLinter extends ArcanistLinter { $options = array('-rn'); // Version 0.x.x include the pylint message ids in the output - if (version_compare($this->getLinterVersion(), "1", 'lt')) { - array_push($options, '-iy', "--output-format=text"); + if (version_compare($this->getLinterVersion(), '1', 'lt')) { + array_push($options, '-iy', '--output-format=text'); } // Version 1.x.x set the output specifically to the 0.x.x format else { @@ -192,7 +192,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter { $options = array_merge($options, $config_options); } - return implode(" ", $options); + return implode(' ', $options); } public function getLinterName() { @@ -216,7 +216,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter { // Assume a future version that at least is compatible with 1.x.x if (count($lines) == 0 || !preg_match('/pylint\s((?:\d+\.?)+)/', $lines[0], $matches)) { - return "999"; + return '999'; } return $matches[1]; @@ -264,7 +264,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter { $message->setPath($path); $message->setLine($matches[2]); $message->setCode($matches[1]); - $message->setName($this->getLinterName()." ".$matches[1]); + $message->setName($this->getLinterName().' '.$matches[1]); $message->setDescription($matches[3]); $message->setSeverity($this->getMessageCodeSeverity($matches[1])); $this->addLintMessage($message); diff --git a/src/lint/linter/ArcanistRubyLinter.php b/src/lint/linter/ArcanistRubyLinter.php index 38c60702..1d093733 100644 --- a/src/lint/linter/ArcanistRubyLinter.php +++ b/src/lint/linter/ArcanistRubyLinter.php @@ -75,7 +75,7 @@ final class ArcanistRubyLinter extends ArcanistExternalLinter { foreach ($lines as $line) { $matches = null; - if (!preg_match("/(.*?):(\d+): (.*?)$/", $line, $matches)) { + if (!preg_match('/(.*?):(\d+): (.*?)$/', $line, $matches)) { continue; } diff --git a/src/lint/linter/ArcanistTextLinter.php b/src/lint/linter/ArcanistTextLinter.php index 115f5bd5..c7558199 100644 --- a/src/lint/linter/ArcanistTextLinter.php +++ b/src/lint/linter/ArcanistTextLinter.php @@ -170,7 +170,7 @@ final class ArcanistTextLinter extends ArcanistLinter { $this->raiseLintAtOffset( strlen($data), self::LINT_EOF_NEWLINE, - "Files must end in a newline.", + 'Files must end in a newline.', '', "\n"); } diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 8f85353f..65f41323 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -302,12 +302,12 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $this->raiseLintAtNode( $strstr, self::LINT_SLOWNESS, - "Use strpos() for checking if the string contains something."); + 'Use strpos() for checking if the string contains something.'); } else if ($name == 'stristr') { $this->raiseLintAtNode( $strstr, self::LINT_SLOWNESS, - "Use stripos() for checking if the string contains something."); + 'Use stripos() for checking if the string contains something.'); } } } @@ -344,13 +344,13 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $this->raiseLintAtNode( $strpos, self::LINT_SLOWNESS, - "Use strncmp() for checking if the string starts with something."); + 'Use strncmp() for checking if the string starts with something.'); } else if ($name == 'stripos') { $this->raiseLintAtNode( $strpos, self::LINT_SLOWNESS, - "Use strncasecmp() for checking if the string starts with ". - "something."); + 'Use strncasecmp() for checking if the string starts with '. + 'something.'); } } } @@ -480,7 +480,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { self::LINT_PHP_53_FEATURES, "This codebase targets PHP 5.3.0 on Windows, but `{$name}()` is not ". "available there". - ($windows ? " until PHP {$windows}" : "")."."); + ($windows ? " until PHP {$windows}" : '')."."); } } @@ -510,9 +510,9 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $this->raiseLintAtNode( $index->getChildByIndex(1), self::LINT_PHP_54_FEATURES, - "The f()[...] syntax was not introduced until PHP 5.4, but this ". - "codebase targets an earlier version of PHP. You can rewrite ". - "this expression using idx()."); + 'The f()[...] syntax was not introduced until PHP 5.4, but this '. + 'codebase targets an earlier version of PHP. You can rewrite '. + 'this expression using idx().'); break; } } @@ -2044,7 +2044,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $this->raiseLintAtNode( $unary, self::LINT_EXIT_EXPRESSION, - "Use exit as a statement, not an expression."); + 'Use exit as a statement, not an expression.'); } } } @@ -2208,8 +2208,8 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $message = $this->raiseLintAtNode( $node, self::LINT_DUPLICATE_KEYS_IN_ARRAY, - "Duplicate key in array initializer. PHP will ignore all ". - "but the last entry."); + 'Duplicate key in array initializer. PHP will ignore all '. + 'but the last entry.'); $locations = array(); foreach ($nodes_by_key[$key] as $node) { diff --git a/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php b/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php index 45afe24f..9619f6ab 100644 --- a/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php +++ b/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php @@ -5,7 +5,7 @@ final class ArcanistClosureLinterTestCase public function testClosureLinter() { $linter = new ArcanistClosureLinter(); - $linter->setFlags(array("--additional_extensions=lint-test")); + $linter->setFlags(array('--additional_extensions=lint-test')); $this->executeTestsInDirectory( dirname(__FILE__).'/gjslint/', diff --git a/src/lint/renderer/ArcanistLintConsoleRenderer.php b/src/lint/renderer/ArcanistLintConsoleRenderer.php index c7b29540..6e3076e7 100644 --- a/src/lint/renderer/ArcanistLintConsoleRenderer.php +++ b/src/lint/renderer/ArcanistLintConsoleRenderer.php @@ -43,7 +43,7 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer { foreach ($message->getOtherLocations() as $location) { $locations[] = idx($location, 'path', $path). - (!empty($location['line']) ? ":{$location['line']}" : ""); + (!empty($location['line']) ? ":{$location['line']}" : ''); } $description .= "\nOther locations: ".implode(', ', $locations); } @@ -226,7 +226,7 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer { protected function renderLine($line, $data, $chevron = false, $diff = null) { $chevron = $chevron ? '>>>' : ''; return sprintf( - " %3s %1s %6s %s", + ' %3s %1s %6s %s', $chevron, $diff, $line, diff --git a/src/lint/renderer/ArcanistLintJSONRenderer.php b/src/lint/renderer/ArcanistLintJSONRenderer.php index 1a3ee2eb..bc0b68f7 100644 --- a/src/lint/renderer/ArcanistLintJSONRenderer.php +++ b/src/lint/renderer/ArcanistLintJSONRenderer.php @@ -30,6 +30,6 @@ final class ArcanistLintJSONRenderer extends ArcanistLintRenderer { } public function renderOkayResult() { - return ""; + return ''; } } diff --git a/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php index 435a134e..20b328ef 100644 --- a/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php +++ b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php @@ -30,6 +30,6 @@ final class ArcanistLintLikeCompilerRenderer extends ArcanistLintRenderer { } public function renderOkayResult() { - return ""; + return ''; } } diff --git a/src/lint/renderer/ArcanistLintSummaryRenderer.php b/src/lint/renderer/ArcanistLintSummaryRenderer.php index 578e5c20..42e1f7b2 100644 --- a/src/lint/renderer/ArcanistLintSummaryRenderer.php +++ b/src/lint/renderer/ArcanistLintSummaryRenderer.php @@ -20,7 +20,7 @@ final class ArcanistLintSummaryRenderer extends ArcanistLintRenderer { $text[] = "{$path}:{$line}:{$severity}: {$name}\n"; } - return implode("", $text); + return implode('', $text); } public function renderOkayResult() { diff --git a/src/parser/ArcanistBaseCommitParser.php b/src/parser/ArcanistBaseCommitParser.php index a2fc8a78..df3331cb 100644 --- a/src/parser/ArcanistBaseCommitParser.php +++ b/src/parser/ArcanistBaseCommitParser.php @@ -121,10 +121,10 @@ final class ArcanistBaseCommitParser { switch ($name) { case 'verbose': $this->verbose = true; - $this->log("Enabled verbose mode."); + $this->log('Enabled verbose mode.'); break; case 'prompt': - $reason = "it is what you typed when prompted."; + $reason = 'it is what you typed when prompted.'; $this->api->setBaseCommitExplanation($reason); return phutil_console_prompt('Against which commit?'); case 'local': @@ -144,7 +144,7 @@ final class ArcanistBaseCommitParser { case 'halt': // Dump the whole stack. $this->try = array(); - $this->log("Halting all rule processing."); + $this->log('Halting all rule processing.'); return false; case 'skip': return null; diff --git a/src/parser/ArcanistBundle.php b/src/parser/ArcanistBundle.php index 6e46b8e8..0ea663bf 100644 --- a/src/parser/ArcanistBundle.php +++ b/src/parser/ArcanistBundle.php @@ -379,7 +379,7 @@ final class ArcanistBundle { if (!$decompose_okay) { throw new Exception( - "Failed to decompose multicopy changeset in order to generate diff."); + 'Failed to decompose multicopy changeset in order to generate diff.'); } } @@ -763,7 +763,7 @@ final class ArcanistBundle { $content = array(); $content[] = "index {$old_sha1}..{$new_sha1}".$eol; - $content[] = "GIT binary patch".$eol; + $content[] = 'GIT binary patch'.$eol; $content[] = "literal {$new_length}".$eol; $content[] = $this->emitBinaryDiffBody($new_data).$eol; @@ -779,9 +779,9 @@ final class ArcanistBundle { if (!function_exists('gzcompress')) { throw new Exception( - "This patch has binary data. The PHP zlib extension is required to ". - "apply patches with binary data to git. Install the PHP zlib ". - "extension to continue."); + 'This patch has binary data. The PHP zlib extension is required to '. + 'apply patches with binary data to git. Install the PHP zlib '. + 'extension to continue.'); } // See emit_binary_diff_body() in diff.c for git's implementation. diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php index ecf5d4dd..7575d311 100644 --- a/src/parser/ArcanistDiffParser.php +++ b/src/parser/ArcanistDiffParser.php @@ -349,7 +349,7 @@ final class ArcanistDiffParser { $this->parseIndexHunk($change); break; default: - $this->didFailParse("Unknown diff type."); + $this->didFailParse('Unknown diff type.'); break; } } while ($this->getLine() !== null); @@ -526,7 +526,7 @@ final class ArcanistDiffParser { protected function setIsGit($git) { if ($this->isGit !== null && $this->isGit != $git) { - throw new Exception("Git status has changed!"); + throw new Exception('Git status has changed!'); } $this->isGit = $git; return $this; @@ -817,7 +817,7 @@ final class ArcanistDiffParser { $this->nextNonemptyLine(); return; } else if (!preg_match('/^[a-zA-Z]/', $line)) { - $this->didFailParse("Expected base85 line length character (a-zA-Z)."); + $this->didFailParse('Expected base85 line length character (a-zA-Z).'); } } while (true); } @@ -878,7 +878,7 @@ final class ArcanistDiffParser { $line = $this->nextNonemptyLine(); $ok = preg_match('/^Property changes on:/', $line); if (!$ok) { - $this->didFailParse("Confused by empty line"); + $this->didFailParse('Confused by empty line'); } $line = $this->nextLine(); return $this->parsePropertyHunk($change); @@ -966,7 +966,7 @@ final class ArcanistDiffParser { } if ($old_len || $new_len) { - $this->didFailParse("Found the wrong number of hunk lines."); + $this->didFailParse('Found the wrong number of hunk lines.'); } $corpus = implode('', $real); @@ -1074,7 +1074,7 @@ final class ArcanistDiffParser { protected function getLine() { if ($this->text === null) { - throw new Exception("Not parsing!"); + throw new Exception('Not parsing!'); } if (isset($this->text[$this->line])) { return $this->text[$this->line]; @@ -1168,7 +1168,7 @@ final class ArcanistDiffParser { $context = ''; for ($ii = $min; $ii <= $max; $ii++) { $context .= sprintf( - "%8.8s %6.6s %s", + '%8.8s %6.6s %s', ($ii == $this->line) ? '>>> ' : '', $ii + 1, $this->text[$ii]); @@ -1182,7 +1182,7 @@ final class ArcanistDiffParser { $temp->setPreserveFile(true); Filesystem::writeFile($temp, $this->rawDiff); - $out[] = "Raw input file was written to: ".(string)$temp; + $out[] = 'Raw input file was written to: '.(string)$temp; } $out[] = $context; @@ -1392,7 +1392,7 @@ final class ArcanistDiffParser { // 8. ("--") // 9. Patch footer. - list($head, $tail) = preg_split("/^---$/m", $diff, 2); + list($head, $tail) = preg_split('/^---$/m', $diff, 2); list($mail_headers, $mail_body) = explode("\n\n", $head, 2); list($body, $foot) = preg_split('/^-- ?$/m', $tail, 2); list($stat, $diff) = explode("\n\n", $body, 2); diff --git a/src/parser/__tests__/ArcanistBundleTestCase.php b/src/parser/__tests__/ArcanistBundleTestCase.php index bc8c4438..6dc2a0a0 100644 --- a/src/parser/__tests__/ArcanistBundleTestCase.php +++ b/src/parser/__tests__/ArcanistBundleTestCase.php @@ -148,7 +148,7 @@ final class ArcanistBundleTestCase extends ArcanistTestCase { foreach ($raw_changes as $change) { $this->assertTrue( empty($changes[$change->getCurrentPath()]), - "Unique Path: ".$change->getCurrentPath()); + 'Unique Path: '.$change->getCurrentPath()); $changes[$change->getCurrentPath()] = $change; } @@ -567,7 +567,7 @@ final class ArcanistBundleTestCase extends ArcanistTestCase { case '228d7be4840313ed805c25c15bba0f7b188af3e6': // "Add a text file." // This commit is never reached because we skip the 0th commit junk. - $this->assertTrue(true, "This is never reached."); + $this->assertTrue(true, 'This is never reached.'); break; default: throw new Exception( diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php index 87f4ae45..214b81bc 100644 --- a/src/parser/__tests__/ArcanistDiffParserTestCase.php +++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php @@ -583,7 +583,7 @@ EOTEXT $this->assertEqual( ArcanistDiffChangeType::TYPE_MESSAGE, $change->getType()); - $this->assertEqual("WIP", $change->getMetadata('message')); + $this->assertEqual('WIP', $change->getMetadata('message')); $change = array_shift($changes); $this->assertEqual( @@ -620,11 +620,11 @@ EOTEXT public function testGitPathSplitting() { static $tests = array( - "a/old.c b/new.c" => array('old.c', 'new.c'), + 'a/old.c b/new.c' => array('old.c', 'new.c'), "a/old.c b/new.c\n" => array('old.c', 'new.c'), "a/old.c b/new.c\r\n" => array('old.c', 'new.c'), - "old.c new.c" => array('old.c', 'new.c'), - "1/old.c 2/new.c" => array('old.c', 'new.c'), + 'old.c new.c' => array('old.c', 'new.c'), + '1/old.c 2/new.c' => array('old.c', 'new.c'), '"a/\\"quotes1\\"" "b/\\"quotes2\\""' => array( '"quotes1"', '"quotes2"', @@ -637,11 +637,11 @@ EOTEXT "\xE2\x98\x831", "\xE2\x98\x832", ), - "a/Core Data/old.c b/Core Data/new.c" => array( + 'a/Core Data/old.c b/Core Data/new.c' => array( 'Core Data/old.c', 'Core Data/new.c', ), - "some file with spaces.c some file with spaces.c" => array( + 'some file with spaces.c some file with spaces.c' => array( 'some file with spaces.c', 'some file with spaces.c', ), @@ -657,7 +657,7 @@ EOTEXT static $ambiguous = array( - "old file with spaces.c new file with spaces.c", + 'old file with spaces.c new file with spaces.c', ); foreach ($ambiguous as $input) { diff --git a/src/parser/diff/ArcanistDiffChange.php b/src/parser/diff/ArcanistDiffChange.php index 26d187b9..ec9762b3 100644 --- a/src/parser/diff/ArcanistDiffChange.php +++ b/src/parser/diff/ArcanistDiffChange.php @@ -271,7 +271,7 @@ final class ArcanistDiffChange { $summary = array(); $summary[] = sprintf( - "%s %5.5s %s", + '%s %5.5s %s', $char, $attr, $this->getCurrentPath()); @@ -289,14 +289,14 @@ final class ArcanistDiffChange { public function getSymlinkTarget() { if ($this->getFileType() != ArcanistDiffChangeType::FILE_SYMLINK) { - throw new Exception("Not a symlink!"); + throw new Exception('Not a symlink!'); } $hunks = $this->getHunks(); $hunk = reset($hunks); $corpus = $hunk->getCorpus(); $match = null; if (!preg_match('/^\+(?:link )?(.*)$/m', $corpus, $match)) { - throw new Exception("Failed to extract link target!"); + throw new Exception('Failed to extract link target!'); } return trim($match[1]); } diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 6a0c0262..45bae424 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -156,7 +156,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { if ($symbolic_commit !== null) { if ($symbolic_commit == ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT) { $this->setBaseCommitExplanation( - "you explicitly specified the empty tree."); + 'you explicitly specified the empty tree.'); return $symbolic_commit; } @@ -187,10 +187,10 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { if ($this->repositoryHasNoCommits) { $this->setBaseCommitExplanation( - "the repository has no commits."); + 'the repository has no commits.'); } else { $this->setBaseCommitExplanation( - "the repository has only one commit."); + 'the repository has only one commit.'); } return self::GIT_MAGIC_ROOT_COMMIT; @@ -265,7 +265,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { "(Technically: the merge-base of the selected revision and HEAD is ". "used to determine the start of the commit range.)"); - $prompt = "What default do you want to use? [origin/master]"; + $prompt = 'What default do you want to use? [origin/master]'; $default = phutil_console_prompt($prompt); if (!strlen(trim($default))) { @@ -453,13 +453,13 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { // Convert svn revision number to git hash public function getHashFromFromSVNRevisionNumber($revision_id) { - return $this->executeSVNFindRev("r".$revision_id, "Git"); + return $this->executeSVNFindRev('r'.$revision_id, 'Git'); } // Convert a git hash to svn revision number public function getSVNRevisionNumberFromHash($hash) { - return $this->executeSVNFindRev($hash, "SVN"); + return $this->executeSVNFindRev($hash, 'SVN'); } @@ -710,7 +710,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { $line, $matches); if (!$ok) { - throw new Exception("Failed to parse git ls-tree output!"); + throw new Exception('Failed to parse git ls-tree output!'); } $result[$matches[4]] = array( 'mode' => $matches[1], @@ -836,7 +836,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { public function performLocalBranchMerge($branch, $message) { if (!$branch) { throw new ArcanistUsageException( - "Under git, you must specify the branch you want to merge."); + 'Under git, you must specify the branch you want to merge.'); } $err = phutil_passthru( '(cd %s && git merge --no-ff -m %s %s)', @@ -845,7 +845,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { $branch); if ($err) { - throw new ArcanistUsageException("Merge failed!"); + throw new ArcanistUsageException('Merge failed!'); } } @@ -917,8 +917,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { foreach ($results as $key => $result) { $results[$key]['why'] = - "A git commit or tree hash in the commit range is already attached ". - "to the Differential revision."; + 'A git commit or tree hash in the commit range is already attached '. + 'to the Differential revision.'; } return $results; @@ -953,7 +953,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { } public function getBackoutMessage($commit_hash) { - return "This reverts commit ".$commit_hash."."; + return 'This reverts commit '.$commit_hash.'.'; } public function isGitSubversionRepo() { diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php index 2af7bbb4..b77d2254 100644 --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -133,8 +133,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { } } - $this->setBaseCommitExplanation("it is the greatest common ancestor of ". - "the working directory and the commit you specified explicitly."); + $this->setBaseCommitExplanation('it is the greatest common ancestor of '. + 'the working directory and the commit you specified explicitly.'); return $commit; } @@ -174,8 +174,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { if (!$logs) { $this->setBaseCommitExplanation( - "you have no outgoing commits, so arc assumes you intend to submit ". - "uncommitted changes in the working copy."); + 'you have no outgoing commits, so arc assumes you intend to submit '. + 'uncommitted changes in the working copy.'); return $this->getWorkingCopyRevision(); } @@ -217,11 +217,11 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { if ($against == 'null') { $this->setBaseCommitExplanation( - "this is a new repository (all changes are outgoing)."); + 'this is a new repository (all changes are outgoing).'); } else { $this->setBaseCommitExplanation( - "it is the first commit reachable from the working copy state ". - "which is not outgoing."); + 'it is the first commit reachable from the working copy state '. + 'which is not outgoing.'); } return $against; @@ -231,7 +231,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { if ($this->localCommitInfo === null) { $base_commit = $this->getBaseCommit(); list($info) = $this->execxLocal( - "log --template %s --rev %s --branch %s --", + 'log --template %s --rev %s --branch %s --', "{node}\1{rev}\1{author}\1". "{date|rfc822date}\1{branch}\1{tag}\1{parents}\1{desc}\2", hgsprintf('(%s::. - %s)', $base_commit, $base_commit), @@ -522,13 +522,13 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { if ($err) { return false; } else { - return (strpos($stdout, "amend") !== false); + return (strpos($stdout, 'amend') !== false); } } public function supportsRebase() { if ($this->supportsRebase === null) { - list ($err) = $this->execManualLocal("help rebase"); + list ($err) = $this->execManualLocal('help rebase'); $this->supportsRebase = $err === 0; } @@ -537,7 +537,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { public function supportsPhases() { if ($this->supportsPhases === null) { - list ($err) = $this->execManualLocal("help phase"); + list ($err) = $this->execManualLocal('help phase'); $this->supportsPhases = $err === 0; } @@ -616,7 +616,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { } if ($err) { - throw new ArcanistUsageException("Merge failed!"); + throw new ArcanistUsageException('Merge failed!'); } } @@ -628,7 +628,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { public function getCommitMessageLog() { $base_commit = $this->getBaseCommit(); list($stdout) = $this->execxLocal( - "log --template %s --rev %s --branch %s --", + 'log --template %s --rev %s --branch %s --', "{node}\1{desc}\2", hgsprintf('(%s::. - %s)', $base_commit, $base_commit), $this->getBranchName()); @@ -698,8 +698,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { foreach ($results as $key => $hash) { $results[$key]['why'] = - "A mercurial commit hash in the commit range is already attached ". - "to the Differential revision."; + 'A mercurial commit hash in the commit range is already attached '. + 'to the Differential revision.'; } return $results; @@ -796,7 +796,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { } public function getBackoutMessage($commit_hash) { - return "Backed out changeset ".$commit_hash."."; + return 'Backed out changeset '.$commit_hash.'.'; } public function resolveBaseCommitRule($rule, $source) { diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php index 85faa3cf..69a89b57 100644 --- a/src/repository/api/ArcanistRepositoryAPI.php +++ b/src/repository/api/ArcanistRepositoryAPI.php @@ -64,7 +64,7 @@ abstract class ArcanistRepositoryAPI { if (!$working_copy) { throw new Exception( pht( - "Trying to create a RepositoryAPI without a working copy!")); + 'Trying to create a RepositoryAPI without a working copy!')); } $root = $working_copy->getProjectRoot(); @@ -81,9 +81,9 @@ abstract class ArcanistRepositoryAPI { default: throw new Exception( pht( - "The current working directory is not part of a working copy for ". - "a supported version control system (Git, Subversion or ". - "Mercurial).")); + 'The current working directory is not part of a working copy for '. + 'a supported version control system (Git, Subversion or '. + 'Mercurial).')); } $api->configurationManager = $configuration_manager; diff --git a/src/repository/api/ArcanistSubversionAPI.php b/src/repository/api/ArcanistSubversionAPI.php index 27da36d0..27e2aeef 100644 --- a/src/repository/api/ArcanistSubversionAPI.php +++ b/src/repository/api/ArcanistSubversionAPI.php @@ -631,7 +631,7 @@ EODIFF; public function getFinalizedRevisionMessage() { // In other VCSes we give push instructions here, but it never makes sense // in SVN. - return "Done."; + return 'Done.'; } public function loadWorkingCopyDifferentialRevisions( @@ -660,7 +660,7 @@ EODIFF; foreach ($results as $key => $result) { $results[$key]['why'] = - "Matching arcanist project name and working copy directory path."; + 'Matching arcanist project name and working copy directory path.'; } return $results; diff --git a/src/unit/engine/ArcanistXUnitTestResultParser.php b/src/unit/engine/ArcanistXUnitTestResultParser.php index 39a2ab97..4c75b7e6 100644 --- a/src/unit/engine/ArcanistXUnitTestResultParser.php +++ b/src/unit/engine/ArcanistXUnitTestResultParser.php @@ -32,18 +32,18 @@ final class ArcanistXUnitTestResultParser { } $results = array(); - $testcases = $xunit_dom->getElementsByTagName("testcase"); + $testcases = $xunit_dom->getElementsByTagName('testcase'); foreach ($testcases as $testcase) { - $classname = $testcase->getAttribute("classname"); - $name = $testcase->getAttribute("name"); - $time = $testcase->getAttribute("time"); + $classname = $testcase->getAttribute('classname'); + $name = $testcase->getAttribute('name'); + $time = $testcase->getAttribute('time'); $status = ArcanistUnitTestResult::RESULT_PASS; - $user_data = ""; + $user_data = ''; // A skipped test is a test which was ignored using framework // mechanizms (e.g. @skip decorator) - $skipped = $testcase->getElementsByTagName("skipped"); + $skipped = $testcase->getElementsByTagName('skipped'); if ($skipped->length > 0) { $status = ArcanistUnitTestResult::RESULT_SKIP; $messages = array(); @@ -56,7 +56,7 @@ final class ArcanistXUnitTestResultParser { // Failure is a test which the code has explicitly failed by using // the mechanizms for that purpose. e.g., via an assertEquals - $failures = $testcase->getElementsByTagName("failure"); + $failures = $testcase->getElementsByTagName('failure'); if ($failures->length > 0) { $status = ArcanistUnitTestResult::RESULT_FAIL; $messages = array(); @@ -70,7 +70,7 @@ final class ArcanistXUnitTestResultParser { // An errored test is one that had an unanticipated problem. e.g., an // unchecked throwable, or a problem with an implementation of the // test. - $errors = $testcase->getElementsByTagName("error"); + $errors = $testcase->getElementsByTagName('error'); if ($errors->length > 0) { $status = ArcanistUnitTestResult::RESULT_BROKEN; $messages = array(); @@ -82,7 +82,7 @@ final class ArcanistXUnitTestResultParser { } $result = new ArcanistUnitTestResult(); - $result->setName($classname.".".$name); + $result->setName($classname.'.'.$name); $result->setResult($status); $result->setDuration($time); $result->setUserData($user_data); diff --git a/src/unit/engine/CSharpToolsTestEngine.php b/src/unit/engine/CSharpToolsTestEngine.php index d2557894..f39e9796 100644 --- a/src/unit/engine/CSharpToolsTestEngine.php +++ b/src/unit/engine/CSharpToolsTestEngine.php @@ -50,8 +50,8 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { $this->coverEngine = Filesystem::resolvePath($cscover); } else { throw new Exception( - "Unable to locate cscover coverage runner ". - "(have you built yet?)"); + 'Unable to locate cscover coverage runner '. + '(have you built yet?)'); } } @@ -95,7 +95,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { // FIXME: Can't use TempFile here as xUnit doesn't like // UNIX-style full paths. It sees the leading / as the // start of an option flag, even when quoted. - $xunit_temp = Filesystem::readRandomCharacters(10).".results.xml"; + $xunit_temp = Filesystem::readRandomCharacters(10).'.results.xml'; if (file_exists($xunit_temp)) { unlink($xunit_temp); } @@ -103,15 +103,15 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { $cover_temp->setPreserveFile(true); $xunit_cmd = $this->runtimeEngine; $xunit_args = null; - if ($xunit_cmd === "") { + if ($xunit_cmd === '') { $xunit_cmd = $this->testEngine; $xunit_args = csprintf( - "%s /xml %s", + '%s /xml %s', $test_assembly, $xunit_temp); } else { $xunit_args = csprintf( - "%s %s /xml %s", + '%s %s /xml %s', $this->testEngine, $test_assembly, $xunit_temp); @@ -119,7 +119,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { $assembly_dir = dirname($test_assembly); $assemblies_to_instrument = array(); foreach (Filesystem::listDirectory($assembly_dir) as $file) { - if (substr($file, -4) == ".dll" || substr($file, -4) == ".exe") { + if (substr($file, -4) == '.dll' || substr($file, -4) == '.exe') { if ($this->assemblyShouldBeInstrumented($file)) { $assemblies_to_instrument[] = $assembly_dir.DIRECTORY_SEPARATOR.$file; } @@ -129,8 +129,8 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { return parent::buildTestFuture($test_assembly); } $future = new ExecFuture( - "%C -o %s -c %s -a %s -w %s %Ls", - trim($this->runtimeEngine." ".$this->coverEngine), + '%C -o %s -c %s -a %s -w %s %Ls', + trim($this->runtimeEngine.' '.$this->coverEngine), $cover_temp, $xunit_cmd, $xunit_args, @@ -200,9 +200,9 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { $results = array(); foreach ($tags as $tag) { $results[] = array( - "file" => $tag->getAttribute("file"), - "start" => $tag->getAttribute("start"), - "end" => $tag->getAttribute("end")); + 'file' => $tag->getAttribute('file'), + 'start' => $tag->getAttribute('start'), + 'end' => $tag->getAttribute('end')); } return $results; } @@ -229,12 +229,12 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { $executed = array(); $instrumented = $this->processTags( - $coverage_dom->getElementsByTagName("instrumented")); + $coverage_dom->getElementsByTagName('instrumented')); $executed = $this->processTags( - $coverage_dom->getElementsByTagName("executed")); + $coverage_dom->getElementsByTagName('executed')); foreach ($instrumented as $instrument) { - $absolute_file = $instrument["file"]; + $absolute_file = $instrument['file']; $relative_file = substr($absolute_file, strlen($this->projectRoot) + 1); if (!in_array($relative_file, $files)) { $files[] = $relative_file; @@ -254,24 +254,24 @@ final class CSharpToolsTestEngine extends XUnitTestEngine { } foreach ($instrumented as $instrument) { - if ($instrument["file"] !== $absolute_file) { + if ($instrument['file'] !== $absolute_file) { continue; } for ( - $i = $instrument["start"]; - $i <= $instrument["end"]; + $i = $instrument['start']; + $i <= $instrument['end']; $i++) { $coverage[$i - 1] = 'U'; } } foreach ($executed as $execute) { - if ($execute["file"] !== $absolute_file) { + if ($execute['file'] !== $absolute_file) { continue; } for ( - $i = $execute["start"]; - $i <= $execute["end"]; + $i = $execute['start']; + $i <= $execute['end']; $i++) { $coverage[$i - 1] = 'C'; } diff --git a/src/unit/engine/GoTestResultParser.php b/src/unit/engine/GoTestResultParser.php index 5debcbf4..827f4ab7 100644 --- a/src/unit/engine/GoTestResultParser.php +++ b/src/unit/engine/GoTestResultParser.php @@ -28,13 +28,13 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser { $results = array(); // We'll get our full test case name at the end and add it back in - $test_case_name = ""; + $test_case_name = ''; // Temp store for test case results (in case we run multiple test cases) $test_case_results = array(); foreach ($test_results as $i => $line) { - if (strncmp($line, "--- PASS", 8) === 0) { + if (strncmp($line, '--- PASS', 8) === 0) { // We have a passing test $meta = array(); preg_match( @@ -53,7 +53,7 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser { continue; } - if (strncmp($line, "--- FAIL", 8) === 0) { + if (strncmp($line, '--- FAIL', 8) === 0) { // We have a failing test $reason = trim($test_results[$i + 1]); $meta = array(); @@ -73,21 +73,21 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser { continue; } - if (strncmp($line, "ok", 2) === 0) { + if (strncmp($line, 'ok', 2) === 0) { $meta = array(); preg_match( '/^ok[\s\t]+(?P\w.*)[\s\t]+(?P