Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistFutureLinter.php
| <?php | <?php | ||||
| abstract class ArcanistFutureLinter extends ArcanistLinter { | abstract class ArcanistFutureLinter extends ArcanistLinter { | ||||
| private $futures; | private $futures; | ||||
| abstract protected function buildFutures(array $paths); | abstract protected function buildFutures(array $paths); | ||||
| abstract protected function resolveFuture($path, Future $future); | abstract protected function resolveFuture($path, Future $future); | ||||
| final protected function getFuturesLimit() { | final protected function getFuturesLimit() { | ||||
| return 8; | return 8; | ||||
| } | } | ||||
| final public function willLintPaths(array $paths) { | public function willLintPaths(array $paths) { | ||||
| $limit = $this->getFuturesLimit(); | $limit = $this->getFuturesLimit(); | ||||
| $this->futures = id(new FutureIterator(array()))->limit($limit); | $this->futures = id(new FutureIterator(array()))->limit($limit); | ||||
| foreach ($this->buildFutures($paths) as $path => $future) { | foreach ($this->buildFutures($paths) as $path => $future) { | ||||
| $this->futures->addFuture($future, $path); | $this->futures->addFuture($future, $path); | ||||
| } | } | ||||
| } | } | ||||
| final public function lintPath($path) { | final public function lintPath($path) { | ||||
| return; | return; | ||||
| } | } | ||||
| final public function didLintPaths(array $paths) { | public function didLintPaths(array $paths) { | ||||
| if (!$this->futures) { | if (!$this->futures) { | ||||
| return; | return; | ||||
| } | } | ||||
| $map = array(); | $map = array(); | ||||
| foreach ($this->futures as $path => $future) { | foreach ($this->futures as $path => $future) { | ||||
| $this->setActivePath($path); | $this->setActivePath($path); | ||||
| $this->resolveFuture($path, $future); | $this->resolveFuture($path, $future); | ||||
| Show All 22 Lines | |||||