Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistFutureLinter.php
Show All 13 Lines | abstract class ArcanistFutureLinter extends ArcanistLinter { | ||||
final public function willLintPaths(array $paths) { | final 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; | |||||
} | |||||
final public function didLintPaths(array $paths) { | |||||
if (!$this->futures) { | |||||
return; | |||||
} | |||||
final public function didRunLinters() { | $map = array(); | ||||
if ($this->futures) { | |||||
foreach ($this->futures as $path => $future) { | foreach ($this->futures as $path => $future) { | ||||
$this->willLintPath($path); | $this->setActivePath($path); | ||||
$this->resolveFuture($path, $future); | $this->resolveFuture($path, $future); | ||||
$map[$path] = $future; | |||||
} | } | ||||
$this->futures = array(); | |||||
$this->didResolveLinterFutures($map); | |||||
} | } | ||||
/** | |||||
* Hook for cleaning up resources. | |||||
* | |||||
* This is invoked after a block of futures resolve, and allows linters to | |||||
* discard or clean up any shared resources they no longer need. | |||||
* | |||||
* @param map<string, Future> Map of paths to resolved futures. | |||||
* @return void | |||||
*/ | |||||
protected function didResolveLinterFutures(array $futures) { | |||||
return; | |||||
joshuaspence: I'm not sure I understand this change (just adding `return`). | |||||
Not Done Inline Actionspurely stylistic epriestley: purely stylistic | |||||
Not Done Inline ActionsIt probably doesn't provide much value since subclasses could override this method, but we could add assert_instances_of($futures, 'Future') here. joshuaspence: It probably doesn't provide much value since subclasses could override this method, but we… | |||||
} | } | ||||
} | } |
I'm not sure I understand this change (just adding return).