From 7a67173b972ff229888c6dd6ebfc1e8bdfc2035e Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 19 Feb 2013 14:09:20 -0800 Subject: [PATCH] Apply new whitespace lint rules to arcanist/ Summary: Automated changes from `arc lint`. Test Plan: Looked them over. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D5017 --- .../__tests__/ArcanistDiffUtilsTestCase.php | 5 ++- src/lint/linter/ArcanistConduitLinter.php | 3 +- src/lint/linter/ArcanistCppcheckLinter.php | 6 +-- src/lint/linter/ArcanistFilenameLinter.php | 2 +- src/lint/linter/ArcanistSpellingLinter.php | 15 +++---- src/lint/linter/ArcanistXHPASTLinter.php | 3 +- .../renderer/ArcanistLintConsoleRenderer.php | 9 ++-- .../ArcanistLintLikeCompilerRenderer.php | 3 +- .../__tests__/ArcanistDiffParserTestCase.php | 42 +++++++------------ src/repository/api/ArcanistMercurialAPI.php | 3 +- .../engine/phutil/ArcanistPhutilTestCase.php | 3 +- src/workflow/ArcanistAmendWorkflow.php | 3 +- src/workflow/ArcanistBrowseWorkflow.php | 4 +- .../ArcanistCloseRevisionWorkflow.php | 3 +- src/workflow/ArcanistFlagWorkflow.php | 3 +- src/workflow/ArcanistPatchWorkflow.php | 16 +++---- src/workflow/ArcanistTasksWorkflow.php | 3 +- 17 files changed, 45 insertions(+), 81 deletions(-) diff --git a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php index 4938542f..308f89fc 100644 --- a/src/difference/__tests__/ArcanistDiffUtilsTestCase.php +++ b/src/difference/__tests__/ArcanistDiffUtilsTestCase.php @@ -92,8 +92,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase { foreach ($tests as $test) { $this->assertEqual( $test[2], - ArcanistDiffUtils::buildLevenshteinDifferenceString($test[0], $test[1]) - ); + ArcanistDiffUtils::buildLevenshteinDifferenceString( + $test[0], + $test[1])); } } } diff --git a/src/lint/linter/ArcanistConduitLinter.php b/src/lint/linter/ArcanistConduitLinter.php index 741d04fb..1545b494 100644 --- a/src/lint/linter/ArcanistConduitLinter.php +++ b/src/lint/linter/ArcanistConduitLinter.php @@ -56,8 +56,7 @@ final class ArcanistConduitLinter extends ArcanistLinter { self::CONDUIT_METHOD, array( 'file_contents' => $this->data, - ) - ); + )); } public function lintPath($path) { diff --git a/src/lint/linter/ArcanistCppcheckLinter.php b/src/lint/linter/ArcanistCppcheckLinter.php index 6b8fcf4e..767cb38a 100644 --- a/src/lint/linter/ArcanistCppcheckLinter.php +++ b/src/lint/linter/ArcanistCppcheckLinter.php @@ -23,8 +23,7 @@ final class ArcanistCppcheckLinter extends ArcanistLinter { // You will for sure want some options. The below default tends to be ok $options = $working_copy->getConfig( 'lint.cppcheck.options', - '-j2 --inconclusive --enable=performance,style,portability,information' - ); + '-j2 --inconclusive --enable=performance,style,portability,information'); return $options; } @@ -70,8 +69,7 @@ final class ArcanistCppcheckLinter extends ArcanistLinter { "%C %C --inline-suppr --xml-version=2 -q %s", $bin, $options, - $this->getEngine()->getFilePathOnDisk($path) - ); + $this->getEngine()->getFilePathOnDisk($path)); if ($rc === 1) { throw new Exception("cppcheck failed to run correctly:\n".$stderr); diff --git a/src/lint/linter/ArcanistFilenameLinter.php b/src/lint/linter/ArcanistFilenameLinter.php index b8a81d76..17cb0d91 100644 --- a/src/lint/linter/ArcanistFilenameLinter.php +++ b/src/lint/linter/ArcanistFilenameLinter.php @@ -14,7 +14,7 @@ final class ArcanistFilenameLinter extends ArcanistLinter { } public function getLinterName() { - return 'NAM'; + return 'NAME'; } public function getLintSeverityMap() { diff --git a/src/lint/linter/ArcanistSpellingLinter.php b/src/lint/linter/ArcanistSpellingLinter.php index 928bad43..6aee8ead 100644 --- a/src/lint/linter/ArcanistSpellingLinter.php +++ b/src/lint/linter/ArcanistSpellingLinter.php @@ -110,11 +110,9 @@ final class ArcanistSpellingLinter extends ArcanistLinter { sprintf( "Possible spelling error. You wrote '%s', but did you mean '%s'?", $word, - $correct_word - ), + $correct_word), $original, - $replacement - ); + $replacement); $pos = $next + 1; } } @@ -126,8 +124,7 @@ final class ArcanistSpellingLinter extends ArcanistLinter { '#\b' . preg_quote($word, '#') . '\b#i', $text, $matches, - PREG_OFFSET_CAPTURE - ); + PREG_OFFSET_CAPTURE); if (!$num_matches) { return; } @@ -140,11 +137,9 @@ final class ArcanistSpellingLinter extends ArcanistLinter { sprintf( "Possible spelling error. You wrote '%s', but did you mean '%s'?", $word, - $correct_word - ), + $correct_word), $original, - $replacement - ); + $replacement); } } diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 380a021e..d21e64f6 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -1903,8 +1903,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $decl_name, self::LINT_CLASS_FILENAME_MISMATCH, "The name of this file differs from the name of the class or interface ". - "it declares. Rename the file to '{$rename}'." - ); + "it declares. Rename the file to '{$rename}'."); } private function lintPlusOperatorOnStrings($root) { diff --git a/src/lint/renderer/ArcanistLintConsoleRenderer.php b/src/lint/renderer/ArcanistLintConsoleRenderer.php index 3f5bcd53..cea91f50 100644 --- a/src/lint/renderer/ArcanistLintConsoleRenderer.php +++ b/src/lint/renderer/ArcanistLintConsoleRenderer.php @@ -126,13 +126,11 @@ final class ArcanistLintConsoleRenderer implements ArcanistLintRenderer { $text = substr( $text, $same_at_front, - $text_strlen - $same_at_end - $same_at_front - ); + $text_strlen - $same_at_end - $same_at_front); $patch = substr( $patch, $same_at_front, - $patch_strlen - $same_at_end - $same_at_front - ); + $patch_strlen - $same_at_end - $same_at_front); } // Print out the impacted region itself. $diff = $message->isPatchable() ? '-' : null; @@ -191,8 +189,7 @@ final class ArcanistLintConsoleRenderer implements ArcanistLintRenderer { foreach (array_slice($patch_lines, 1) as $patch_line) { $out[] = $this->renderLine( null, - phutil_console_format('##%s##', $patch_line), false, '+' - ); + phutil_console_format('##%s##', $patch_line), false, '+'); } } diff --git a/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php index 5f4d64a0..1b0f4323 100644 --- a/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php +++ b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php @@ -23,8 +23,7 @@ final class ArcanistLintLikeCompilerRenderer implements ArcanistLintRenderer { $line, $severity, $code, - $description - ); + $description); } return implode('', $lines); diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php index 7995536c..1ef73820 100644 --- a/src/parser/__tests__/ArcanistDiffParserTestCase.php +++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php @@ -108,8 +108,7 @@ EOCORPUS; array( 'duck' => 'quack', ), - $change->getNewProperties() - ); + $change->getNewProperties()); break; case 'svn-property-modify.svndiff': $this->assertEqual(2, count($changes)); @@ -120,14 +119,12 @@ EOCORPUS; array( 'svn:ignore' => '*.phpz', ), - $change->getOldProperties() - ); + $change->getOldProperties()); $this->assertEqual( array( 'svn:ignore' => '*.php', ), - $change->getNewProperties() - ); + $change->getNewProperties()); $change = array_shift($changes); $this->assertEqual(0, count($change->getHunks())); @@ -135,14 +132,12 @@ EOCORPUS; array( 'svn:special' => '*', ), - $change->getOldProperties() - ); + $change->getOldProperties()); $this->assertEqual( array( 'svn:special' => 'moo', ), - $change->getNewProperties() - ); + $change->getNewProperties()); break; case 'svn-property-delete.svndiff': $this->assertEqual(1, count($changes)); @@ -219,8 +214,7 @@ EOTEXT array( 'svn:mime-type' => 'application/octet-stream', ), - $change->getNewProperties() - ); + $change->getNewProperties()); break; case 'svn-binary-diff.svndiff': $this->assertEqual(1, count($changes)); @@ -257,14 +251,12 @@ EOTEXT array( 'unix:filemode' => '100644', ), - $change->getOldProperties() - ); + $change->getOldProperties()); $this->assertEqual( array( 'unix:filemode' => '100755', ), - $change->getNewProperties() - ); + $change->getNewProperties()); break; case 'git-filemode-change-only.gitdiff': $this->assertEqual(count($changes), 2); @@ -274,14 +266,12 @@ EOTEXT array( 'unix:filemode' => '100644', ), - $change->getOldProperties() - ); + $change->getOldProperties()); $this->assertEqual( array( 'unix:filemode' => '100755', ), - $change->getNewProperties() - ); + $change->getNewProperties()); break; case 'svn-empty-file.svndiff': $this->assertEqual(2, count($changes)); @@ -331,8 +321,7 @@ EOTEXT $this->assertEqual(0, count($change->getHunks())); $this->assertEqual( ArcanistDiffChangeType::TYPE_MOVE_AWAY, - $change->getType() - ); + $change->getType()); $this->assertEqual( $change->getCurrentPath(), @@ -410,14 +399,12 @@ EOTEXT array( 'svn:ignore' => 'tags', ), - $change->getOldProperties() - ); + $change->getOldProperties()); $this->assertEqual( array( 'svn:ignore' => "tags\nasdf\nlol\nwhat", ), - $change->getNewProperties() - ); + $change->getNewProperties()); break; case 'git-empty-files.gitdiff': $this->assertEqual(2, count($changes)); @@ -472,8 +459,7 @@ DiffCamp Revision: 94064 git-svn-id: svn+ssh://tubbs/svnroot/tfb/trunk/www@223593 2c7ba8d8 EOTEXT - , $change->getMetadata('message') - ); + , $change->getMetadata('message')); break; case 'git-binary.gitdiff': $this->assertEqual(1, count($changes)); diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php index c65d48f1..bd9adbf2 100644 --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -733,8 +733,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { case 'outgoing': list($err, $outgoing_base) = $this->execManualLocal( 'log --template={node} --rev %s', - 'limit(reverse(ancestors(.) - outgoing()), 1)' - ); + 'limit(reverse(ancestors(.) - outgoing()), 1)'); if (!$err) { $this->setBaseCommitExplanation( "it is the first ancestor of the working copy that is not ". diff --git a/src/unit/engine/phutil/ArcanistPhutilTestCase.php b/src/unit/engine/phutil/ArcanistPhutilTestCase.php index 57314bef..2c9126a5 100644 --- a/src/unit/engine/phutil/ArcanistPhutilTestCase.php +++ b/src/unit/engine/phutil/ArcanistPhutilTestCase.php @@ -127,8 +127,7 @@ abstract class ArcanistPhutilTestCase { array('assertException' => array()), array(false), $callable, - $expected_exception_class - ); + $expected_exception_class); } /** diff --git a/src/workflow/ArcanistAmendWorkflow.php b/src/workflow/ArcanistAmendWorkflow.php index ceb504d6..1866f100 100644 --- a/src/workflow/ArcanistAmendWorkflow.php +++ b/src/workflow/ArcanistAmendWorkflow.php @@ -123,8 +123,7 @@ EOTEXT array( 'revision_id' => $revision_id, 'edit' => false, - ) - ); + )); } catch (ConduitClientException $ex) { if (strpos($ex->getMessage(), 'ERR_NOT_FOUND') === false) { throw $ex; diff --git a/src/workflow/ArcanistBrowseWorkflow.php b/src/workflow/ArcanistBrowseWorkflow.php index 584d53fa..df247be4 100644 --- a/src/workflow/ArcanistBrowseWorkflow.php +++ b/src/workflow/ArcanistBrowseWorkflow.php @@ -94,7 +94,7 @@ EOTEXT $browser = $this->getBrowserCommand(); foreach ($paths as $path) { - $ret_code = phutil_passthru("%s %s", $browser, $base_uri . $path ); + $ret_code = phutil_passthru("%s %s", $browser, $base_uri . $path); if ($ret_code) { throw new ArcanistUsageException( "It seems we failed to open the browser; Perhaps you should try to ". @@ -124,7 +124,7 @@ EOTEXT $branch = $this->getArgument('branch', 'master'); - return $repo_info[$repo_phid]['uri'] . 'browse/' . $branch .'/'; + return $repo_info[$repo_phid]['uri'].'browse/'.$branch.'/'; } private function getBrowserCommand() { diff --git a/src/workflow/ArcanistCloseRevisionWorkflow.php b/src/workflow/ArcanistCloseRevisionWorkflow.php index 0c832a18..e249b54d 100644 --- a/src/workflow/ArcanistCloseRevisionWorkflow.php +++ b/src/workflow/ArcanistCloseRevisionWorkflow.php @@ -85,8 +85,7 @@ EOTEXT 'differential.getrevision', array( 'revision_id' => $revision_id, - ) - ); + )); } catch (Exception $ex) { if (!$is_finalize) { throw new ArcanistUsageException( diff --git a/src/workflow/ArcanistFlagWorkflow.php b/src/workflow/ArcanistFlagWorkflow.php index a76d7ceb..e7f25c61 100644 --- a/src/workflow/ArcanistFlagWorkflow.php +++ b/src/workflow/ArcanistFlagWorkflow.php @@ -168,8 +168,7 @@ EOTEXT } $flag = $conduit->callMethodSynchronous( 'flag.edit', - $flag_params - ); + $flag_params); self::flagWasEdited($flag, $flag['new'] ? 'created' : 'edited'); } else { // Okay, list mode. Let's find the flags, which we didn't need to do diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php index a8eab2b6..53aada79 100644 --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -260,8 +260,7 @@ EOTEXT // no error means git rev-parse found a branch if (!$err) { echo phutil_console_format( - "Branch name {$proposed_name} already exists; trying a new name.\n" - ); + "Branch name {$proposed_name} already exists; trying a new name.\n"); continue; } else { $branch_name = $proposed_name; @@ -299,8 +298,8 @@ EOTEXT // no error means hg log found a bookmark if (!$err) { echo phutil_console_format( - "Bookmark name {$proposed_name} already exists; trying a new name.\n" - ); + "Bookmark name %s already exists; trying a new name.\n", + $proposed_name); continue; } else { $bookmark_name = $proposed_name; @@ -870,8 +869,7 @@ EOTEXT } $ok = phutil_console_confirm( "{$issue} Still try to apply the patch?", - $default_no = false - ); + $default_no = false); if (!$ok) { throw new ArcanistUserAbortException(); } @@ -931,8 +929,7 @@ EOTEXT "This diff is against commit {$bundle_base_rev_str}, but the ". "commit is nowhere in the working copy. Try to apply it against ". "the current working copy state? ({$source_base_rev_str})", - $default_no = false - ); + $default_no = false); if (!$ok) { throw new ArcanistUserAbortException(); } @@ -979,8 +976,7 @@ EOTEXT 'differential.query', array( 'commitHashes' => array($hash), - ) - ); + )); // grab the latest closed revision only diff --git a/src/workflow/ArcanistTasksWorkflow.php b/src/workflow/ArcanistTasksWorkflow.php index be6dced3..c5a9de57 100644 --- a/src/workflow/ArcanistTasksWorkflow.php +++ b/src/workflow/ArcanistTasksWorkflow.php @@ -234,8 +234,7 @@ EOTEXT $tasks = $conduit->callMethodSynchronous( 'maniphest.find', - $find_params - ); + $find_params); return $tasks; }