1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 18:22:41 +01:00

Don't run disabled lint rules in other linters.

Summary: D4963 for other linters.

Test Plan: Saw time 0.001 instead of 0.113 in spellcheck linter.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4965
This commit is contained in:
vrana 2013-02-14 15:49:22 -08:00
parent eb8b414cc7
commit cd50b0884e
4 changed files with 36 additions and 4 deletions

View file

@ -118,6 +118,10 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
}
public function willLintPaths(array $paths) {
if (!$this->isCodeEnabled(self::JSHINT_ERROR)) {
return;
}
$jshint_bin = $this->getJSHintPath();
$jshint_options = $this->getJSHintOptions();
$futures = array();
@ -137,6 +141,10 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
}
public function lintPath($path) {
if (!$this->isCodeEnabled(self::JSHINT_ERROR)) {
return;
}
list($rc, $stdout, $stderr) = $this->results[$path];
if ($rc === 0) {

View file

@ -82,6 +82,12 @@ final class ArcanistPEP8Linter extends ArcanistLinter {
}
public function lintPath($path) {
$severity = ArcanistLintSeverity::SEVERITY_WARNING;
if (!$this->getEngine()->isSeverityEnabled($severity)) {
return;
}
$pep8_bin = $this->getPEP8Path();
$options = $this->getPEP8Options();
@ -111,7 +117,7 @@ final class ArcanistPEP8Linter extends ArcanistLinter {
$message->setCode($matches[4]);
$message->setName('PEP8 '.$matches[4]);
$message->setDescription($matches[5]);
$message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
$message->setSeverity($severity);
$this->addLintMessage($message);
}
}

View file

@ -80,9 +80,20 @@ final class ArcanistPhutilXHPASTLinter extends ArcanistBaseXHPASTLinter {
$root = $tree->getRootNode();
$this->lintArrayCombine($root);
$this->lintUnsafeDynamicString($root);
$this->lintDeprecatedFunctions($root);
$method_codes = array(
'lintArrayCombine' => self::LINT_ARRAY_COMBINE,
'lintUnsafeDynamicString' => self::LINT_UNSAFE_DYNAMIC_STRING,
'lintDeprecatedFunctions' => self::LINT_DEPRECATED_FUNCTION,
);
foreach ($method_codes as $method => $codes) {
foreach ((array)$codes as $code) {
if ($this->isCodeEnabled($code)) {
call_user_func(array($this, $method), $root);
break;
}
}
}
}

View file

@ -73,13 +73,20 @@ final class ArcanistSpellingLinter extends ArcanistLinter {
public function lintPath($path) {
foreach ($this->partialWordRules as $severity => $wordlist) {
if ($severity >= $this->severity) {
if (!$this->isCodeEnabled($severity)) {
continue;
}
foreach ($wordlist as $misspell => $correct) {
$this->checkPartialWord($path, $misspell, $correct, $severity);
}
}
}
foreach ($this->wholeWordRules as $severity => $wordlist) {
if ($severity >= $this->severity) {
if (!$this->isCodeEnabled($severity)) {
continue;
}
foreach ($wordlist as $misspell => $correct) {
$this->checkWholeWord($path, $misspell, $correct, $severity);
}