]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix some arcanist warnings
authorepriestley <git@epriestley.com>
Thu, 22 Nov 2012 01:16:52 +0000 (17:16 -0800)
committerepriestley <git@epriestley.com>
Thu, 22 Nov 2012 01:16:52 +0000 (17:16 -0800)
Summary:
  - Rename some very old variables.
  - Wrap some contributed lines.

Test Plan: `arc lint` / `arc unit`. Viewed a diff in an uncacheable mode to verify intraline behavior.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4018

src/difference/ArcanistDiffUtils.php
src/lint/linter/ArcanistJSHintLinter.php
src/lint/linter/ArcanistPyFlakesLinter.php

index 38207ff512a78455384dd21c6e6851a25c757743..4006235eceb92eb53f306d98d5ae6943562c7def 100644 (file)
@@ -242,10 +242,10 @@ final class ArcanistDiffUtils {
 
     $m = array_fill(0, $ol + 1, array_fill(0, $nl + 1, array()));
 
-    $T_D = 'd';
-    $T_I = 'i';
-    $T_S = 's';
-    $T_X = 'x';
+    $t_d = 'd';
+    $t_i = 'i';
+    $t_s = 's';
+    $t_x = 'x';
 
     $m[0][0] = array(
       0,
@@ -254,13 +254,13 @@ final class ArcanistDiffUtils {
     for ($ii = 1; $ii <= $ol; $ii++) {
       $m[$ii][0] = array(
         $ii * 1000,
-        $T_D);
+        $t_d);
     }
 
     for ($jj = 1; $jj <= $nl; $jj++) {
       $m[0][$jj] = array(
         $jj * 1000,
-        $T_I);
+        $t_i);
     }
 
     $ii = 1;
@@ -269,10 +269,10 @@ final class ArcanistDiffUtils {
       do {
         if ($o[$ii - 1] == $n[$jj - 1]) {
           $sub_t_cost = $m[$ii - 1][$jj - 1][0] + 0;
-          $sub_t      = $T_S;
+          $sub_t      = $t_s;
         } else {
           $sub_t_cost = $m[$ii - 1][$jj - 1][0] + 2000;
-          $sub_t      = $T_X;
+          $sub_t      = $t_x;
         }
 
         if ($m[$ii - 1][$jj - 1][1] != $sub_t) {
@@ -280,12 +280,12 @@ final class ArcanistDiffUtils {
         }
 
         $del_t_cost = $m[$ii - 1][$jj][0] + 1000;
-        if ($m[$ii - 1][$jj][1] != $T_D) {
+        if ($m[$ii - 1][$jj][1] != $t_d) {
           $del_t_cost += 1;
         }
 
         $ins_t_cost = $m[$ii][$jj - 1][0] + 1000;
-        if ($m[$ii][$jj - 1][1] != $T_I) {
+        if ($m[$ii][$jj - 1][1] != $t_i) {
           $ins_t_cost += 1;
         }
 
@@ -296,11 +296,11 @@ final class ArcanistDiffUtils {
         } else if ($ins_t_cost <= $del_t_cost) {
           $m[$ii][$jj] = array(
             $ins_t_cost,
-            $T_I);
+            $t_i);
         } else {
           $m[$ii][$jj] = array(
             $del_t_cost,
-            $T_D);
+            $t_d);
         }
       } while ($jj++ < $nl);
     } while ($ii++ < $ol);
@@ -312,15 +312,15 @@ final class ArcanistDiffUtils {
       $r = $m[$ii][$jj][1];
       $result .= $r;
       switch ($r) {
-        case $T_S:
-        case $T_X:
+        case $t_s:
+        case $t_x:
           $ii--;
           $jj--;
           break;
-        case $T_I:
+        case $t_i:
           $jj--;
           break;
-        case $T_D:
+        case $t_d:
           $ii--;
           break;
       }
index e01e43cd78fa6d2555c15070f4ca117bea8f9fce..7aa9c5617e08dbd0a83908325a5d97b27129a9e7 100644 (file)
@@ -62,12 +62,14 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
     $config = $working_copy->getConfig('lint.jshint.config');
 
     if ($config !== null) {
-      $config = Filesystem::resolvePath($config, $working_copy->getProjectRoot());
+      $config = Filesystem::resolvePath(
+        $config,
+        $working_copy->getProjectRoot());
 
       if (!Filesystem::pathExists($config)) {
         throw new ArcanistUsageException(
-          "Unable to find custom options file defined by 'lint.jshint.config'. ".
-          "Make sure that the path is correct.");
+          "Unable to find custom options file defined by ".
+          "'lint.jshint.config'. Make sure that the path is correct.");
       }
 
       $options .= ' --config '.$config;
@@ -92,8 +94,8 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
         throw new ArcanistUsageException(
           "Unable to find JSHint binary in a specified directory. Make sure ".
           "that 'lint.jshint.prefix' and 'lint.jshint.bin' keys are set ".
-          "correctly. If you'd rather use a copy of JSHint installed globally, ".
-          "you can just remove these keys from your .arcconfig");
+          "correctly. If you'd rather use a copy of JSHint installed ".
+          "globally, you can just remove these keys from your .arcconfig");
       }
 
       return $bin;
@@ -120,7 +122,11 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
 
     foreach ($paths as $path) {
       $filepath = $this->getEngine()->getFilePathOnDisk($path);
-      $futures[$path] = new ExecFuture("{$jshint_bin} {$filepath} ${jshint_options}");
+      $futures[$path] = new ExecFuture(
+        "%s %s %C",
+        $jshint_bin,
+        $filepath,
+        $jshint_options);
     }
 
     foreach (Futures($futures)->limit(8) as $path => $future) {
index 870543308faae898bacadc78c00a0a5c7af63b0a..7f9bb842b4dbcc923db29c615fa2b5675f693970 100644 (file)
@@ -87,7 +87,9 @@ final class ArcanistPyFlakesLinter extends ArcanistLinter {
 
       $severity = ArcanistLintSeverity::SEVERITY_WARNING;
       $description = $matches[3];
-      if (preg_match('/(^undefined|^duplicate|before assignment$)/', $description)) {
+
+      $error_regexp = '/(^undefined|^duplicate|before assignment$)/';
+      if (preg_match($error_regexp, $description)) {
         $severity = ArcanistLintSeverity::SEVERITY_ERROR;
       }