mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 08: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:
parent
fc2cd63739
commit
d3afa9cc31
3 changed files with 31 additions and 23 deletions
|
@ -242,10 +242,10 @@ final class ArcanistDiffUtils {
|
||||||
|
|
||||||
$m = array_fill(0, $ol + 1, array_fill(0, $nl + 1, array()));
|
$m = array_fill(0, $ol + 1, array_fill(0, $nl + 1, array()));
|
||||||
|
|
||||||
$T_D = 'd';
|
$t_d = 'd';
|
||||||
$T_I = 'i';
|
$t_i = 'i';
|
||||||
$T_S = 's';
|
$t_s = 's';
|
||||||
$T_X = 'x';
|
$t_x = 'x';
|
||||||
|
|
||||||
$m[0][0] = array(
|
$m[0][0] = array(
|
||||||
0,
|
0,
|
||||||
|
@ -254,13 +254,13 @@ final class ArcanistDiffUtils {
|
||||||
for ($ii = 1; $ii <= $ol; $ii++) {
|
for ($ii = 1; $ii <= $ol; $ii++) {
|
||||||
$m[$ii][0] = array(
|
$m[$ii][0] = array(
|
||||||
$ii * 1000,
|
$ii * 1000,
|
||||||
$T_D);
|
$t_d);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($jj = 1; $jj <= $nl; $jj++) {
|
for ($jj = 1; $jj <= $nl; $jj++) {
|
||||||
$m[0][$jj] = array(
|
$m[0][$jj] = array(
|
||||||
$jj * 1000,
|
$jj * 1000,
|
||||||
$T_I);
|
$t_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ii = 1;
|
$ii = 1;
|
||||||
|
@ -269,10 +269,10 @@ final class ArcanistDiffUtils {
|
||||||
do {
|
do {
|
||||||
if ($o[$ii - 1] == $n[$jj - 1]) {
|
if ($o[$ii - 1] == $n[$jj - 1]) {
|
||||||
$sub_t_cost = $m[$ii - 1][$jj - 1][0] + 0;
|
$sub_t_cost = $m[$ii - 1][$jj - 1][0] + 0;
|
||||||
$sub_t = $T_S;
|
$sub_t = $t_s;
|
||||||
} else {
|
} else {
|
||||||
$sub_t_cost = $m[$ii - 1][$jj - 1][0] + 2000;
|
$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) {
|
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;
|
$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;
|
$del_t_cost += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ins_t_cost = $m[$ii][$jj - 1][0] + 1000;
|
$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;
|
$ins_t_cost += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,11 +296,11 @@ final class ArcanistDiffUtils {
|
||||||
} else if ($ins_t_cost <= $del_t_cost) {
|
} else if ($ins_t_cost <= $del_t_cost) {
|
||||||
$m[$ii][$jj] = array(
|
$m[$ii][$jj] = array(
|
||||||
$ins_t_cost,
|
$ins_t_cost,
|
||||||
$T_I);
|
$t_i);
|
||||||
} else {
|
} else {
|
||||||
$m[$ii][$jj] = array(
|
$m[$ii][$jj] = array(
|
||||||
$del_t_cost,
|
$del_t_cost,
|
||||||
$T_D);
|
$t_d);
|
||||||
}
|
}
|
||||||
} while ($jj++ < $nl);
|
} while ($jj++ < $nl);
|
||||||
} while ($ii++ < $ol);
|
} while ($ii++ < $ol);
|
||||||
|
@ -312,15 +312,15 @@ final class ArcanistDiffUtils {
|
||||||
$r = $m[$ii][$jj][1];
|
$r = $m[$ii][$jj][1];
|
||||||
$result .= $r;
|
$result .= $r;
|
||||||
switch ($r) {
|
switch ($r) {
|
||||||
case $T_S:
|
case $t_s:
|
||||||
case $T_X:
|
case $t_x:
|
||||||
$ii--;
|
$ii--;
|
||||||
$jj--;
|
$jj--;
|
||||||
break;
|
break;
|
||||||
case $T_I:
|
case $t_i:
|
||||||
$jj--;
|
$jj--;
|
||||||
break;
|
break;
|
||||||
case $T_D:
|
case $t_d:
|
||||||
$ii--;
|
$ii--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,14 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
|
||||||
$config = $working_copy->getConfig('lint.jshint.config');
|
$config = $working_copy->getConfig('lint.jshint.config');
|
||||||
|
|
||||||
if ($config !== null) {
|
if ($config !== null) {
|
||||||
$config = Filesystem::resolvePath($config, $working_copy->getProjectRoot());
|
$config = Filesystem::resolvePath(
|
||||||
|
$config,
|
||||||
|
$working_copy->getProjectRoot());
|
||||||
|
|
||||||
if (!Filesystem::pathExists($config)) {
|
if (!Filesystem::pathExists($config)) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
"Unable to find custom options file defined by 'lint.jshint.config'. ".
|
"Unable to find custom options file defined by ".
|
||||||
"Make sure that the path is correct.");
|
"'lint.jshint.config'. Make sure that the path is correct.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$options .= ' --config '.$config;
|
$options .= ' --config '.$config;
|
||||||
|
@ -92,8 +94,8 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
"Unable to find JSHint binary in a specified directory. Make sure ".
|
"Unable to find JSHint binary in a specified directory. Make sure ".
|
||||||
"that 'lint.jshint.prefix' and 'lint.jshint.bin' keys are set ".
|
"that 'lint.jshint.prefix' and 'lint.jshint.bin' keys are set ".
|
||||||
"correctly. If you'd rather use a copy of JSHint installed globally, ".
|
"correctly. If you'd rather use a copy of JSHint installed ".
|
||||||
"you can just remove these keys from your .arcconfig");
|
"globally, you can just remove these keys from your .arcconfig");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $bin;
|
return $bin;
|
||||||
|
@ -120,7 +122,11 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
|
||||||
|
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
$filepath = $this->getEngine()->getFilePathOnDisk($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) {
|
foreach (Futures($futures)->limit(8) as $path => $future) {
|
||||||
|
|
|
@ -87,7 +87,9 @@ final class ArcanistPyFlakesLinter extends ArcanistLinter {
|
||||||
|
|
||||||
$severity = ArcanistLintSeverity::SEVERITY_WARNING;
|
$severity = ArcanistLintSeverity::SEVERITY_WARNING;
|
||||||
$description = $matches[3];
|
$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;
|
$severity = ArcanistLintSeverity::SEVERITY_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue