'branch. Supports \'rebase\' and \'merge\' strategies.',
'example' => '"rebase"',
),
+ 'arc.lint.cache' => array(
+ 'type' => 'bool',
+ 'help' =>
+ "Enable the lint cache by default. When enabled, 'arc lint' ".
+ "attempts to use cached results if possible. Currently, the cache ".
+ "is not always invalidated correctly and may cause 'arc lint' to ".
+ "report incorrect results, particularly while developing linters. ".
+ "This is probably worth enabling only if your linters are very slow.",
+ 'example' => 'false',
+ ),
'history.immutable' => array(
'type' => 'bool',
'legacy' => 'immutable_history',
),
'cache' => array(
'param' => 'bool',
- 'help' => "0 to disable cache, 1 to enable (default).",
+ 'help' =>
+ "0 to disable cache, 1 to enable. The default value is ".
+ "determined by 'arc.lint.cache' in configuration, which defaults ".
+ "to off. See notes in 'arc.lint.cache'.",
),
'*' => 'paths',
);
}
public function run() {
+ $console = PhutilConsole::getConsole();
$working_copy = $this->getWorkingCopy();
$engine = $this->getArgument('engine');
$rev = $this->getArgument('rev');
$paths = $this->getArgument('paths');
- $use_cache = $this->getArgument('cache', true);
+ $use_cache = $this->getArgument('cache', null);
+ if ($use_cache === null) {
+ $use_cache = (bool)$working_copy->getConfigFromAnySource(
+ 'arc.lint.cache',
+ false);
+ }
if ($rev && $paths) {
throw new ArcanistUsageException("Specify either --rev or paths.");
$cached[$path] = $messages;
}
}
+
+ if ($cached) {
+ $console->writeErr(
+ pht("Using lint cache, use '--cache 0' to disable it.")."\n");
+ }
+
$engine->setCachedResults($cached);
}
$all_autofix = true;
- $console = PhutilConsole::getConsole();
-
foreach ($results as $result) {
$result_all_autofix = $result->isAllAutofix();