mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
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
This commit is contained in:
parent
157184e01d
commit
7a67173b97
17 changed files with 45 additions and 81 deletions
|
@ -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]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,7 @@ final class ArcanistConduitLinter extends ArcanistLinter {
|
|||
self::CONDUIT_METHOD,
|
||||
array(
|
||||
'file_contents' => $this->data,
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
public function lintPath($path) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -14,7 +14,7 @@ final class ArcanistFilenameLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
public function getLinterName() {
|
||||
return 'NAM';
|
||||
return 'NAME';
|
||||
}
|
||||
|
||||
public function getLintSeverityMap() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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, '+');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ final class ArcanistLintLikeCompilerRenderer implements ArcanistLintRenderer {
|
|||
$line,
|
||||
$severity,
|
||||
$code,
|
||||
$description
|
||||
);
|
||||
$description);
|
||||
}
|
||||
|
||||
return implode('', $lines);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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 ".
|
||||
|
|
|
@ -127,8 +127,7 @@ abstract class ArcanistPhutilTestCase {
|
|||
array('assertException' => array()),
|
||||
array(false),
|
||||
$callable,
|
||||
$expected_exception_class
|
||||
);
|
||||
$expected_exception_class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -85,8 +85,7 @@ EOTEXT
|
|||
'differential.getrevision',
|
||||
array(
|
||||
'revision_id' => $revision_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
} catch (Exception $ex) {
|
||||
if (!$is_finalize) {
|
||||
throw new ArcanistUsageException(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -234,8 +234,7 @@ EOTEXT
|
|||
|
||||
$tasks = $conduit->callMethodSynchronous(
|
||||
'maniphest.find',
|
||||
$find_params
|
||||
);
|
||||
$find_params);
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue