From 2d63d080dfca84bc26d37dc21c280e5ae8a403c1 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 20 Dec 2012 11:35:50 -0800 Subject: [PATCH] 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 --- src/workflow/ArcanistDiffWorkflow.php | 2 +- src/workflow/ArcanistLintWorkflow.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index 181dd145..8278311d 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -372,7 +372,7 @@ EOTEXT ), '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, ), diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php index 78b92ddb..22b29831 100644 --- a/src/workflow/ArcanistLintWorkflow.php +++ b/src/workflow/ArcanistLintWorkflow.php @@ -128,7 +128,7 @@ EOTEXT ), '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 @@ EOTEXT $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 @@ EOTEXT $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 @@ EOTEXT $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; } -- 2.43.0