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:
parent
b56634ad27
commit
12f2175da1
1 changed files with 32 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
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')) {
|
||||
|
|
Loading…
Reference in a new issue