$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,
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;
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) {
}
$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;
}
} 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);
$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;
}
$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;
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;
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) {
$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;
}