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
foreach ($tests as $test) {
$this->assertEqual(
$test[2],
- ArcanistDiffUtils::buildLevenshteinDifferenceString($test[0], $test[1])
- );
+ ArcanistDiffUtils::buildLevenshteinDifferenceString(
+ $test[0],
+ $test[1]));
}
}
}
self::CONDUIT_METHOD,
array(
'file_contents' => $this->data,
- )
- );
+ ));
}
public function lintPath($path) {
// 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;
}
"%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);
}
public function getLinterName() {
- return 'NAM';
+ return 'NAME';
}
public function getLintSeverityMap() {
sprintf(
"Possible spelling error. You wrote '%s', but did you mean '%s'?",
$word,
- $correct_word
- ),
+ $correct_word),
$original,
- $replacement
- );
+ $replacement);
$pos = $next + 1;
}
}
'#\b' . preg_quote($word, '#') . '\b#i',
$text,
$matches,
- PREG_OFFSET_CAPTURE
- );
+ PREG_OFFSET_CAPTURE);
if (!$num_matches) {
return;
}
sprintf(
"Possible spelling error. You wrote '%s', but did you mean '%s'?",
$word,
- $correct_word
- ),
+ $correct_word),
$original,
- $replacement
- );
+ $replacement);
}
}
$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) {
$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;
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, '+');
}
}
$line,
$severity,
$code,
- $description
- );
+ $description);
}
return implode('', $lines);
array(
'duck' => 'quack',
),
- $change->getNewProperties()
- );
+ $change->getNewProperties());
break;
case 'svn-property-modify.svndiff':
$this->assertEqual(2, count($changes));
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()));
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));
array(
'svn:mime-type' => 'application/octet-stream',
),
- $change->getNewProperties()
- );
+ $change->getNewProperties());
break;
case 'svn-binary-diff.svndiff':
$this->assertEqual(1, count($changes));
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);
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));
$this->assertEqual(0, count($change->getHunks()));
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MOVE_AWAY,
- $change->getType()
- );
+ $change->getType());
$this->assertEqual(
$change->getCurrentPath(),
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));
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));
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 ".
array('assertException' => array()),
array(false),
$callable,
- $expected_exception_class
- );
+ $expected_exception_class);
}
/**
array(
'revision_id' => $revision_id,
'edit' => false,
- )
- );
+ ));
} catch (ConduitClientException $ex) {
if (strpos($ex->getMessage(), 'ERR_NOT_FOUND') === false) {
throw $ex;
$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 ".
$branch = $this->getArgument('branch', 'master');
- return $repo_info[$repo_phid]['uri'] . 'browse/' . $branch .'/';
+ return $repo_info[$repo_phid]['uri'].'browse/'.$branch.'/';
}
private function getBrowserCommand() {
'differential.getrevision',
array(
'revision_id' => $revision_id,
- )
- );
+ ));
} catch (Exception $ex) {
if (!$is_finalize) {
throw new ArcanistUsageException(
}
$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
// 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;
// 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;
}
$ok = phutil_console_confirm(
"{$issue} Still try to apply the patch?",
- $default_no = false
- );
+ $default_no = false);
if (!$ok) {
throw new ArcanistUserAbortException();
}
"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();
}
'differential.query',
array(
'commitHashes' => array($hash),
- )
- );
+ ));
// grab the latest closed revision only
$tasks = $conduit->callMethodSynchronous(
'maniphest.find',
- $find_params
- );
+ $find_params);
return $tasks;
}