Page MenuHomePhabricator

D7606.diff
No OneTemporary

D7606.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -205,7 +205,7 @@
'ArcanistBundleTestCase' => 'ArcanistTestCase',
'ArcanistCSSLintLinter' => 'ArcanistExternalLinter',
'ArcanistCSSLintLinterTestCase' => 'ArcanistArcanistLinterTestCase',
- 'ArcanistCSharpLinter' => 'ArcanistFutureLinter',
+ 'ArcanistCSharpLinter' => 'ArcanistLinter',
'ArcanistCallConduitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistCapabilityNotSupportedException' => 'Exception',
'ArcanistChooseInvalidRevisionException' => 'Exception',
Index: src/configuration/ArcanistSettings.php
===================================================================
--- src/configuration/ArcanistSettings.php
+++ src/configuration/ArcanistSettings.php
@@ -40,6 +40,13 @@
'specified by the current project.',
'example' => '"ExampleLintEngine"',
),
+ 'lint.limit' => array(
+ 'type' => 'int',
+ 'help' =>
+ 'The number of operations to run in parallel when performing '.
+ 'lint on a code base. Adjust this to suite your platform '.
+ 'and CPU capacity.'
+ ),
'unit.engine' => array(
'type' => 'string',
'legacy' => 'unit_engine',
Index: src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
===================================================================
--- src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
+++ src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
@@ -47,6 +47,9 @@
$linter = clone $linters[$type];
$linter->setEngine($this);
+ $linter->setParallelisationLimit(
+ $this->getConfigurationManager()
+ ->getConfigFromAnySource('lint.limit', 8));
$more = $linter->getLinterConfigurationOptions();
} else {
// We'll raise an error below about the invalid "type" key.
Index: src/lint/linter/ArcanistCSharpLinter.php
===================================================================
--- src/lint/linter/ArcanistCSharpLinter.php
+++ src/lint/linter/ArcanistCSharpLinter.php
@@ -13,6 +13,7 @@
private $loaded;
private $discoveryMap;
private $futures;
+ private $limit;
const SUPPORTED_VERSION = 1;
@@ -33,6 +34,10 @@
return $options;
}
+ public function setParallelisationLimit($limit) {
+ $this->limit = $limit;
+ }
+
public function setLinterConfigurationValue($key, $value) {
switch ($key) {
case 'discovery':
@@ -184,7 +189,7 @@
public function didRunLinters() {
if ($this->futures) {
- foreach (Futures($this->futures) as $future) {
+ foreach (Futures($this->futures)->limit($this->limit) as $future) {
$this->resolveFuture($future);
}
}
Index: src/lint/linter/ArcanistFutureLinter.php
===================================================================
--- src/lint/linter/ArcanistFutureLinter.php
+++ src/lint/linter/ArcanistFutureLinter.php
@@ -3,12 +3,17 @@
abstract class ArcanistFutureLinter extends ArcanistLinter {
private $futures;
+ private $limit;
abstract protected function buildFutures(array $paths);
abstract protected function resolveFuture($path, Future $future);
+ public function setParallelisationLimit($limit) {
+ $this->limit = $limit;
+ }
+
protected function getFuturesLimit() {
- return 8;
+ return $this->limit;
}
public function willLintPaths(array $paths) {
Index: src/lint/linter/ArcanistLinter.php
===================================================================
--- src/lint/linter/ArcanistLinter.php
+++ src/lint/linter/ArcanistLinter.php
@@ -308,6 +308,9 @@
);
}
+ public function setParallelisationLimit($limit) {
+ }
+
public function setLinterConfigurationValue($key, $value) {
$sev_map = array(
'error' => ArcanistLintSeverity::SEVERITY_ERROR,

File Metadata

Mime Type
text/plain
Expires
Sun, Jun 9, 5:03 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6295121
Default Alt Text
D7606.diff (3 KB)

Event Timeline