From: Eric Stern Date: Sun, 28 Jul 2013 01:29:20 +0000 (-0700) Subject: Add --everything support to 'arc lint' X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=12f2175da18992221668933d006ecae3e9d16db0;p=arcanist.git Add --everything support to 'arc lint' Summary: When adding arcanist support to a new project or adding a new linter, it's helpful to be able to run new linters against the entire codebase. This patch adds support for this with an '--everything' option, similar to 'arc unit --everything' Test Plan: Run 'arc lint --everything' and check out the code. Optionally dump the paths to test in the current lint engine's buildLinters() function to demonstrate that it's receiving all files in the project rather than just the changed and/or specified ones Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley, Korvin Differential Revision: https://secure.phabricator.com/D6592 --- diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php index 218d89be..fb94a699 100644 --- a/src/workflow/ArcanistLintWorkflow.php +++ b/src/workflow/ArcanistLintWorkflow.php @@ -118,6 +118,13 @@ EOTEXT 'When linting git repositories, amend HEAD with autofix '. 'patches suggested by lint without prompting.', ), + 'everything' => array( + 'help' => 'Lint all files in the project.', + 'conflicts' => array( + 'cache' => '--everything lints all files', + 'rev' => '--everything lints all files' + ), + ), 'severity' => array( 'param' => 'string', 'help' => @@ -175,6 +182,12 @@ EOTEXT $rev = $this->getArgument('rev'); $paths = $this->getArgument('paths'); $use_cache = $this->getArgument('cache', null); + $everything = $this->getArgument('everything'); + if ($everything && $paths) { + throw new ArcanistUsageException( + "You can not specify paths with --everything. The --everything ". + "flag lints every file."); + } if ($use_cache === null) { $use_cache = (bool)$working_copy->getConfigFromAnySource( 'arc.lint.cache', @@ -193,7 +206,25 @@ EOTEXT $this->shouldLintAll = true; } - $paths = $this->selectPathsForWorkflow($paths, $rev); + if ($everything) { + // Recurse through project from root + switch ($this->getRepositoryApi()->getSourceControlSystemName()) { + case 'git': + $filter = '*/.git'; + break; + case 'svn': + $filter = '*/.svn'; + break; + case 'hg': + $filter = '*/.hg'; + break; + } + $paths = id(new FileFinder($working_copy->getProjectRoot())) + ->excludePath($filter) + ->find(); + } else { + $paths = $this->selectPathsForWorkflow($paths, $rev); + } if (!class_exists($engine) || !is_subclass_of($engine, 'ArcanistLintEngine')) {