mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 08:42:40 +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:
parent
eb8b414cc7
commit
cd50b0884e
4 changed files with 36 additions and 4 deletions
|
@ -118,6 +118,10 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willLintPaths(array $paths) {
|
public function willLintPaths(array $paths) {
|
||||||
|
if (!$this->isCodeEnabled(self::JSHINT_ERROR)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$jshint_bin = $this->getJSHintPath();
|
$jshint_bin = $this->getJSHintPath();
|
||||||
$jshint_options = $this->getJSHintOptions();
|
$jshint_options = $this->getJSHintOptions();
|
||||||
$futures = array();
|
$futures = array();
|
||||||
|
@ -137,6 +141,10 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lintPath($path) {
|
public function lintPath($path) {
|
||||||
|
if (!$this->isCodeEnabled(self::JSHINT_ERROR)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
list($rc, $stdout, $stderr) = $this->results[$path];
|
list($rc, $stdout, $stderr) = $this->results[$path];
|
||||||
|
|
||||||
if ($rc === 0) {
|
if ($rc === 0) {
|
||||||
|
|
|
@ -82,6 +82,12 @@ final class ArcanistPEP8Linter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lintPath($path) {
|
public function lintPath($path) {
|
||||||
|
$severity = ArcanistLintSeverity::SEVERITY_WARNING;
|
||||||
|
|
||||||
|
if (!$this->getEngine()->isSeverityEnabled($severity)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$pep8_bin = $this->getPEP8Path();
|
$pep8_bin = $this->getPEP8Path();
|
||||||
$options = $this->getPEP8Options();
|
$options = $this->getPEP8Options();
|
||||||
|
|
||||||
|
@ -111,7 +117,7 @@ final class ArcanistPEP8Linter extends ArcanistLinter {
|
||||||
$message->setCode($matches[4]);
|
$message->setCode($matches[4]);
|
||||||
$message->setName('PEP8 '.$matches[4]);
|
$message->setName('PEP8 '.$matches[4]);
|
||||||
$message->setDescription($matches[5]);
|
$message->setDescription($matches[5]);
|
||||||
$message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
|
$message->setSeverity($severity);
|
||||||
$this->addLintMessage($message);
|
$this->addLintMessage($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,20 @@ final class ArcanistPhutilXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
||||||
|
|
||||||
$root = $tree->getRootNode();
|
$root = $tree->getRootNode();
|
||||||
|
|
||||||
$this->lintArrayCombine($root);
|
$method_codes = array(
|
||||||
$this->lintUnsafeDynamicString($root);
|
'lintArrayCombine' => self::LINT_ARRAY_COMBINE,
|
||||||
$this->lintDeprecatedFunctions($root);
|
'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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,13 +73,20 @@ final class ArcanistSpellingLinter extends ArcanistLinter {
|
||||||
public function lintPath($path) {
|
public function lintPath($path) {
|
||||||
foreach ($this->partialWordRules as $severity => $wordlist) {
|
foreach ($this->partialWordRules as $severity => $wordlist) {
|
||||||
if ($severity >= $this->severity) {
|
if ($severity >= $this->severity) {
|
||||||
|
if (!$this->isCodeEnabled($severity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foreach ($wordlist as $misspell => $correct) {
|
foreach ($wordlist as $misspell => $correct) {
|
||||||
$this->checkPartialWord($path, $misspell, $correct, $severity);
|
$this->checkPartialWord($path, $misspell, $correct, $severity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->wholeWordRules as $severity => $wordlist) {
|
foreach ($this->wholeWordRules as $severity => $wordlist) {
|
||||||
if ($severity >= $this->severity) {
|
if ($severity >= $this->severity) {
|
||||||
|
if (!$this->isCodeEnabled($severity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foreach ($wordlist as $misspell => $correct) {
|
foreach ($wordlist as $misspell => $correct) {
|
||||||
$this->checkWholeWord($path, $misspell, $correct, $severity);
|
$this->checkWholeWord($path, $misspell, $correct, $severity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue