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

Fix some arcanist warnings

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
This commit is contained in:
epriestley 2012-11-21 17:16:52 -08:00
parent fc2cd63739
commit d3afa9cc31
3 changed files with 31 additions and 23 deletions

View 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;
}

View 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) {

View 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;
}