1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 23:02:41 +01:00

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
This commit is contained in:
Eric Stern 2013-07-27 18:29:20 -07:00 committed by epriestley
parent b56634ad27
commit 12f2175da1

View file

@ -118,6 +118,13 @@ EOTEXT
'When linting git repositories, amend HEAD with autofix '. 'When linting git repositories, amend HEAD with autofix '.
'patches suggested by lint without prompting.', '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( 'severity' => array(
'param' => 'string', 'param' => 'string',
'help' => 'help' =>
@ -175,6 +182,12 @@ EOTEXT
$rev = $this->getArgument('rev'); $rev = $this->getArgument('rev');
$paths = $this->getArgument('paths'); $paths = $this->getArgument('paths');
$use_cache = $this->getArgument('cache', null); $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) { if ($use_cache === null) {
$use_cache = (bool)$working_copy->getConfigFromAnySource( $use_cache = (bool)$working_copy->getConfigFromAnySource(
'arc.lint.cache', 'arc.lint.cache',
@ -193,7 +206,25 @@ EOTEXT
$this->shouldLintAll = true; $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) || if (!class_exists($engine) ||
!is_subclass_of($engine, 'ArcanistLintEngine')) { !is_subclass_of($engine, 'ArcanistLintEngine')) {