1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 10:12:41 +01:00

Linter fixes

Summary: Minor linter fixes

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14633
This commit is contained in:
Joshua Spence 2015-12-07 21:35:34 +11:00
parent 4a680c762b
commit b52e9dc702
8 changed files with 36 additions and 21 deletions

View file

@ -46,7 +46,7 @@ final class ArcanistClassFilenameMismatchXHPASTLinterRule
$this->raiseLintAtNode( $this->raiseLintAtNode(
$decl_name, $decl_name,
pht( pht(
"The name of this file differs from the name of the ". 'The name of this file differs from the name of the '.
'class or interface it declares. Rename the file to `%s`.', 'class or interface it declares. Rename the file to `%s`.',
$rename)); $rename));
} }

View file

@ -193,7 +193,7 @@ final class ArcanistImplicitFallthroughXHPASTLinterRule
'This `%s` or `%s` has a nonempty block which does not end '. 'This `%s` or `%s` has a nonempty block which does not end '.
'with `%s`, `%s`, `%s`, `%s` or `%s`. Did you forget to add '. 'with `%s`, `%s`, `%s`, `%s` or `%s`. Did you forget to add '.
'one of those? If you intend to fall through, add a `%s` '. 'one of those? If you intend to fall through, add a `%s` '.
"comment to silence this warning.", 'comment to silence this warning.',
'case', 'case',
'default', 'default',
'break', 'break',

View file

@ -8,7 +8,6 @@ final class ArcanistBaseCommitParser extends Phobject {
public function __construct(ArcanistRepositoryAPI $api) { public function __construct(ArcanistRepositoryAPI $api) {
$this->api = $api; $this->api = $api;
return $this;
} }
private function tokenizeBaseCommitSpecification($raw_spec) { private function tokenizeBaseCommitSpecification($raw_spec) {

View file

@ -360,7 +360,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
$working_status = ArcanistMercurialParser::parseMercurialStatus($stdout); $working_status = ArcanistMercurialParser::parseMercurialStatus($stdout);
foreach ($working_status as $path => $mask) { foreach ($working_status as $path => $mask) {
if (!($mask & ArcanistRepositoryAPI::FLAG_UNTRACKED)) { if (!($mask & parent::FLAG_UNTRACKED)) {
// Mark tracked files as uncommitted. // Mark tracked files as uncommitted.
$mask |= self::FLAG_UNCOMMITTED; $mask |= self::FLAG_UNCOMMITTED;
} }

View file

@ -139,7 +139,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
$status = $this->svnStatus; $status = $this->svnStatus;
if (!$with_externals) { if (!$with_externals) {
foreach ($status as $path => $mask) { foreach ($status as $path => $mask) {
if ($mask & ArcanistRepositoryAPI::FLAG_EXTERNALS) { if ($mask & parent::FLAG_EXTERNALS) {
unset($status[$path]); unset($status[$path]);
} }
} }
@ -384,7 +384,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
$status = $status[$path]; $status = $status[$path];
// Build meaningful diff text for "svn copy" operations. // Build meaningful diff text for "svn copy" operations.
if ($status & ArcanistRepositoryAPI::FLAG_ADDED) { if ($status & parent::FLAG_ADDED) {
$info = $this->getSVNInfo($path); $info = $this->getSVNInfo($path);
if (!empty($info['Copied From URL'])) { if (!empty($info['Copied From URL'])) {
return $this->buildSyntheticAdditionDiff( return $this->buildSyntheticAdditionDiff(
@ -403,7 +403,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
if (preg_match('/\.(gif|png|jpe?g|swf|pdf|ico)$/i', $path, $matches)) { if (preg_match('/\.(gif|png|jpe?g|swf|pdf|ico)$/i', $path, $matches)) {
// Check if the file is deleted first; SVN will complain if we try to // Check if the file is deleted first; SVN will complain if we try to
// get properties of a deleted file. // get properties of a deleted file.
if ($status & ArcanistRepositoryAPI::FLAG_DELETED) { if ($status & parent::FLAG_DELETED) {
return <<<EODIFF return <<<EODIFF
Index: {$path} Index: {$path}
=================================================================== ===================================================================

View file

@ -139,14 +139,14 @@ final class NoseTestEngine extends ArcanistUnitTestEngine {
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 = (int)$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 ((int)$line->getAttribute('hits') == 0) {
$coverage .= 'U'; $coverage .= 'U';
} else if (intval($line->getAttribute('hits')) > 0) { } else if ((int)$line->getAttribute('hits') > 0) {
$coverage .= 'C'; $coverage .= 'C';
} }

View file

@ -116,14 +116,14 @@ final class PytestTestEngine extends ArcanistUnitTestEngine {
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 = (int)$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 ((int)$line->getAttribute('hits') == 0) {
$coverage .= 'U'; $coverage .= 'U';
} else if (intval($line->getAttribute('hits')) > 0) { } else if ((int)$line->getAttribute('hits') > 0) {
$coverage .= 'C'; $coverage .= 'C';
} }

View file

@ -14,14 +14,30 @@ final class ArcanistFlagWorkflow extends ArcanistWorkflow {
); );
private static $colorSpec = array( private static $colorSpec = array(
'red' => 0, 'r' => 0, 0 => 0, 'red' => 0,
'orange' => 1, 'o' => 1, 1 => 1, 'r' => 0,
'yellow' => 2, 'y' => 2, 2 => 2, 0 => 0,
'green' => 3, 'g' => 3, 3 => 3, 'orange' => 1,
'blue' => 4, 'b' => 4, 4 => 4, 'o' => 1,
'pink' => 5, 'p' => 5, 5 => 5, 1 => 1,
'purple' => 6, 'v' => 6, 6 => 6, 'yellow' => 2,
'checkered' => 7, 'c' => 7, 7 => 7, 'y' => 2,
2 => 2,
'green' => 3,
'g' => 3,
3 => 3,
'blue' => 4,
'b' => 4,
4 => 4,
'pink' => 5,
'p' => 5,
5 => 5,
'purple' => 6,
'v' => 6,
6 => 6,
'checkered' => 7,
'c' => 7,
7 => 7,
); );
public function getWorkflowName() { public function getWorkflowName() {