Permalink
Browse files

Make caching lint default

Summary: I use it couple of weeks without troubles.

Test Plan:
Added debug output and:

  $ arc lint
  $ arc lint --cache 0

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2036

Differential Revision: https://secure.phabricator.com/D4242
  • Loading branch information...
1 parent ffdf44e commit 2d63d080dfca84bc26d37dc21c280e5ae8a403c1 vrana committed Dec 20, 2012
Showing with 6 additions and 5 deletions.
  1. +1 −1 src/workflow/ArcanistDiffWorkflow.php
  2. +5 −4 src/workflow/ArcanistLintWorkflow.php
@@ -372,7 +372,7 @@ public function getArguments() {
),
'cache' => array(
'param' => 'bool',
- 'help' => "0 to disable lint cache (default), 1 to enable.",
+ 'help' => "0 to disable lint cache, 1 to enable (default).",
'passthru' => array(
'lint' => true,
),
@@ -128,7 +128,7 @@ public function getArguments() {
),
'cache' => array(
'param' => 'bool',
- 'help' => "0 to disable cache (default), 1 to enable.",
+ 'help' => "0 to disable cache, 1 to enable (default).",
),
'*' => 'paths',
);
@@ -169,6 +169,7 @@ public function run() {
$rev = $this->getArgument('rev');
$paths = $this->getArgument('paths');
+ $use_cache = $this->getArgument('cache', true);
if ($rev && $paths) {
throw new ArcanistUsageException("Specify either --rev or paths.");
@@ -198,7 +199,7 @@ public function run() {
$engine->setMinimumSeverity(
$this->getArgument('severity', self::DEFAULT_SEVERITY));
- if ($this->getArgument('cache')) {
+ if ($use_cache) {
$cache = $this->readScratchJSONFile('lint-cache.json');
$cache = idx($cache, $this->getCacheKey(), array());
$cache = array_intersect_key($cache, array_flip($paths));
@@ -502,10 +503,10 @@ public function run() {
$cache = $this->readScratchJSONFile('lint-cache.json');
$cached = idx($cache, $this->getCacheKey(), array());
- if ($cached || $this->getArgument('cache')) {
+ if ($cached || $use_cache) {
foreach ($results as $result) {
$path = $result->getPath();
- if (!$this->getArgument('cache')) {
+ if (!$use_cache) {
unset($cached[$path]);
continue;
}

0 comments on commit 2d63d08

Please sign in to comment.