2013-02-15 01:16:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class ArcanistFutureLinter extends ArcanistLinter {
|
|
|
|
|
|
|
|
private $futures;
|
|
|
|
|
2013-02-19 22:09:34 +01:00
|
|
|
abstract protected function buildFutures(array $paths);
|
|
|
|
abstract protected function resolveFuture($path, Future $future);
|
2013-02-15 01:16:08 +01:00
|
|
|
|
2014-05-12 18:48:52 +02:00
|
|
|
final protected function getFuturesLimit() {
|
2013-02-21 10:22:25 +01:00
|
|
|
return 8;
|
|
|
|
}
|
|
|
|
|
2014-05-12 18:48:52 +02:00
|
|
|
final public function willLintPaths(array $paths) {
|
2013-02-21 10:22:25 +01:00
|
|
|
$limit = $this->getFuturesLimit();
|
|
|
|
$this->futures = Futures(array())->limit($limit);
|
|
|
|
foreach ($this->buildFutures($paths) as $path => $future) {
|
|
|
|
$this->futures->addFuture($future, $path);
|
2013-02-15 01:16:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-12 18:48:52 +02:00
|
|
|
final public function lintPath($path) {}
|
2013-02-15 01:16:08 +01:00
|
|
|
|
2014-05-12 18:48:52 +02:00
|
|
|
final public function didRunLinters() {
|
2013-02-15 01:16:08 +01:00
|
|
|
if ($this->futures) {
|
|
|
|
foreach ($this->futures as $path => $future) {
|
2013-02-21 10:22:25 +01:00
|
|
|
$this->willLintPath($path);
|
2013-02-15 01:16:08 +01:00
|
|
|
$this->resolveFuture($path, $future);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|