}
public function run() {
- $stopped = array();
$linters = $this->buildLinters();
if (!$linters) {
}
$this->cacheVersion = crc32(implode("\n", $versions));
- $exceptions = array();
+ $linters_paths = array();
foreach ($linters as $linter_name => $linter) {
- try {
- $linter->setEngine($this);
- if (!$linter->canRun()) {
- continue;
- }
- $paths = $linter->getPaths();
+ $linter->setEngine($this);
+ if (!$linter->canRun()) {
+ continue;
+ }
+ $paths = $linter->getPaths();
- $cache_granularity = $linter->getCacheGranularity();
+ $cache_granularity = $linter->getCacheGranularity();
- foreach ($paths as $key => $path) {
- // Make sure each path has a result generated, even if it is empty
- // (i.e., the file has no lint messages).
- $result = $this->getResultForPath($path);
- if (isset($stopped[$path])) {
+ foreach ($paths as $key => $path) {
+ // Make sure each path has a result generated, even if it is empty
+ // (i.e., the file has no lint messages).
+ $result = $this->getResultForPath($path);
+ if (isset($this->cachedResults[$path][$this->cacheVersion])) {
+ if ($cache_granularity == ArcanistLinter::GRANULARITY_FILE) {
unset($paths[$key]);
}
- if (isset($this->cachedResults[$path][$this->cacheVersion])) {
- if ($cache_granularity == ArcanistLinter::GRANULARITY_FILE) {
- unset($paths[$key]);
- }
- }
}
- $paths = array_values($paths);
-
- if ($paths) {
- $linter->willLintPaths($paths);
- foreach ($paths as $path) {
- $linter->willLintPath($path);
- $linter->lintPath($path);
- if ($linter->didStopAllLinters()) {
- $stopped[$path] = true;
- }
+ }
+ $paths = array_values($paths);
+ $linters_paths[$linter_name] = $paths;
+
+ if ($paths) {
+ $linter->willLintPaths($paths);
+ }
+ }
+
+ $stopped = array();
+ $exceptions = array();
+ foreach ($linters as $linter_name => $linter) {
+ try {
+ foreach ($linters_paths[$linter_name] as $path) {
+ if (isset($stopped[$path])) {
+ continue;
+ }
+ $linter->willLintPath($path);
+ $linter->lintPath($path);
+ if ($linter->didStopAllLinters()) {
+ $stopped[$path] = true;
}
}