]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Linter fixes
authorJoshua Spence <josh@freelancer.com>
Mon, 7 Dec 2015 10:35:34 +0000 (21:35 +1100)
committerJoshua Spence <josh@freelancer.com>
Mon, 7 Dec 2015 10:35:34 +0000 (21:35 +1100)
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

src/lint/linter/xhpast/rules/ArcanistClassFilenameMismatchXHPASTLinterRule.php
src/lint/linter/xhpast/rules/ArcanistImplicitFallthroughXHPASTLinterRule.php
src/parser/ArcanistBaseCommitParser.php
src/repository/api/ArcanistMercurialAPI.php
src/repository/api/ArcanistSubversionAPI.php
src/unit/engine/NoseTestEngine.php
src/unit/engine/PytestTestEngine.php
src/workflow/ArcanistFlagWorkflow.php

index 6c8c2f41b65f155a5742c8f7c07939d55a4cbda7..44eb9b6e3ab7e253127b1882270c381cc8671f35 100644 (file)
@@ -46,7 +46,7 @@ final class ArcanistClassFilenameMismatchXHPASTLinterRule
     $this->raiseLintAtNode(
       $decl_name,
       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`.',
         $rename));
   }
index 1fe7a2a7c57881ca7a97ac67789688f2893031a1..7a86f2a1c631217e8f5e1ae47e8741da57b3c86e 100644 (file)
@@ -193,7 +193,7 @@ final class ArcanistImplicitFallthroughXHPASTLinterRule
               'This `%s` or `%s` has a nonempty block which does not end '.
               'with `%s`, `%s`, `%s`, `%s` or `%s`. Did you forget to add '.
               'one of those? If you intend to fall through, add a `%s` '.
-              "comment to silence this warning.",
+              'comment to silence this warning.',
               'case',
               'default',
               'break',
index af2a71ffbf3c34c4bfa7e2f9409deab9204d6cf7..5ed6ce4aff7db4fb13eb479eba6059d02b1f7c89 100644 (file)
@@ -8,7 +8,6 @@ final class ArcanistBaseCommitParser extends Phobject {
 
   public function __construct(ArcanistRepositoryAPI $api) {
     $this->api = $api;
-    return $this;
   }
 
   private function tokenizeBaseCommitSpecification($raw_spec) {
index 33105c202c50cb0a60f8ce4f2bbd5bd1bd15b8e4..6fa6c48afe0543dc5af31607278da1dc7113b033 100644 (file)
@@ -360,7 +360,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
 
     $working_status = ArcanistMercurialParser::parseMercurialStatus($stdout);
     foreach ($working_status as $path => $mask) {
-      if (!($mask & ArcanistRepositoryAPI::FLAG_UNTRACKED)) {
+      if (!($mask & parent::FLAG_UNTRACKED)) {
         // Mark tracked files as uncommitted.
         $mask |= self::FLAG_UNCOMMITTED;
       }
index d8420a1b5ece49fa0b84fbc0b3841195a3be1b49..f5768b14d66cb5e8692290ca08f49392c86857b5 100644 (file)
@@ -139,7 +139,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
     $status = $this->svnStatus;
     if (!$with_externals) {
       foreach ($status as $path => $mask) {
-        if ($mask & ArcanistRepositoryAPI::FLAG_EXTERNALS) {
+        if ($mask & parent::FLAG_EXTERNALS) {
           unset($status[$path]);
         }
       }
@@ -384,7 +384,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
     $status = $status[$path];
 
     // Build meaningful diff text for "svn copy" operations.
-    if ($status & ArcanistRepositoryAPI::FLAG_ADDED) {
+    if ($status & parent::FLAG_ADDED) {
       $info = $this->getSVNInfo($path);
       if (!empty($info['Copied From URL'])) {
         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)) {
       // Check if the file is deleted first; SVN will complain if we try to
       // get properties of a deleted file.
-      if ($status & ArcanistRepositoryAPI::FLAG_DELETED) {
+      if ($status & parent::FLAG_DELETED) {
         return <<<EODIFF
 Index: {$path}
 ===================================================================
index e81bcb63ccb78ad31e27c7a014e6e13085b58638..039daf5ebd46e741caeba3acda36073d13dba552 100644 (file)
@@ -139,14 +139,14 @@ final class NoseTestEngine extends ArcanistUnitTestEngine {
       for ($ii = 0; $ii < $lines->length; $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++) {
           $coverage .= 'N';
         }
 
-        if (intval($line->getAttribute('hits')) == 0) {
+        if ((int)$line->getAttribute('hits') == 0) {
           $coverage .= 'U';
-        } else if (intval($line->getAttribute('hits')) > 0) {
+        } else if ((int)$line->getAttribute('hits') > 0) {
           $coverage .= 'C';
         }
 
index 49ef3c481c74eed4da0c359a35ad77acb7e84749..1ebf98e672d8537346b52d25a68a97ba9280310c 100644 (file)
@@ -116,14 +116,14 @@ final class PytestTestEngine extends ArcanistUnitTestEngine {
       for ($ii = 0; $ii < $lines->length; $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++) {
             $coverage .= 'N';
         }
 
-        if (intval($line->getAttribute('hits')) == 0) {
+        if ((int)$line->getAttribute('hits') == 0) {
             $coverage .= 'U';
-        } else if (intval($line->getAttribute('hits')) > 0) {
+        } else if ((int)$line->getAttribute('hits') > 0) {
             $coverage .= 'C';
         }
 
index d842072862496ffc0fe205dd195a8d7c06adff2c..9f1367b99b17e453828a77ee71fde0d90e957ecd 100644 (file)
@@ -14,14 +14,30 @@ final class ArcanistFlagWorkflow extends ArcanistWorkflow {
   );
 
   private static $colorSpec = array(
-    'red' => 0,       'r' => 0,   0 => 0,
-    'orange' => 1,    'o' => 1,   1 => 1,
-    'yellow' => 2,    '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,
+    'red' => 0,
+    'r' => 0,
+    0 => 0,
+    'orange' => 1,
+    'o' => 1,
+    1 => 1,
+    'yellow' => 2,
+    '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() {