mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Support arc lint --output none
Summary: I want to run lint on background and I'm interested only in side effect of caching (and maybe exit status). This is better than discarding stdout later because we don't do unnecessary work and error conditions are still printed. Test Plan: $ arc lint --output none # with error $ echo $? $ arc lint --output none # with no lintable paths $ arc lint --output none # witout errors Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5106
This commit is contained in:
parent
0b120bd04b
commit
9d92253903
4 changed files with 35 additions and 1 deletions
|
@ -84,6 +84,7 @@ phutil_register_library_map(array(
|
|||
'ArcanistLintJSONRenderer' => 'lint/renderer/ArcanistLintJSONRenderer.php',
|
||||
'ArcanistLintLikeCompilerRenderer' => 'lint/renderer/ArcanistLintLikeCompilerRenderer.php',
|
||||
'ArcanistLintMessage' => 'lint/ArcanistLintMessage.php',
|
||||
'ArcanistLintNoneRenderer' => 'lint/renderer/ArcanistLintNoneRenderer.php',
|
||||
'ArcanistLintPatcher' => 'lint/ArcanistLintPatcher.php',
|
||||
'ArcanistLintRenderer' => 'lint/renderer/ArcanistLintRenderer.php',
|
||||
'ArcanistLintResult' => 'lint/ArcanistLintResult.php',
|
||||
|
@ -225,6 +226,7 @@ phutil_register_library_map(array(
|
|||
'ArcanistLintConsoleRenderer' => 'ArcanistLintRenderer',
|
||||
'ArcanistLintJSONRenderer' => 'ArcanistLintRenderer',
|
||||
'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
|
||||
'ArcanistLintNoneRenderer' => 'ArcanistLintRenderer',
|
||||
'ArcanistLintSummaryRenderer' => 'ArcanistLintRenderer',
|
||||
'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
|
||||
'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
|
||||
|
|
|
@ -65,7 +65,12 @@ final class ArcanistPhutilXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
|||
}
|
||||
|
||||
public function getCacheVersion() {
|
||||
return 2;
|
||||
$version = '2';
|
||||
$path = xhpast_get_binary_path();
|
||||
if (Filesystem::pathExists($path)) {
|
||||
$version .= '-'.md5_file($path);
|
||||
}
|
||||
return $version;
|
||||
}
|
||||
|
||||
protected function buildFutures(array $paths) {
|
||||
|
|
16
src/lint/renderer/ArcanistLintNoneRenderer.php
Normal file
16
src/lint/renderer/ArcanistLintNoneRenderer.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintNoneRenderer extends ArcanistLintRenderer {
|
||||
|
||||
public function renderLintResult(ArcanistLintResult $result) {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function renderOkayResult() {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
|
@ -81,6 +81,7 @@ EOTEXT
|
|||
'help' =>
|
||||
"With 'summary', show lint warnings in a more compact format. ".
|
||||
"With 'json', show lint warnings in machine-readable JSON format. ".
|
||||
"With 'none', show no lint warnings. ".
|
||||
"With 'compiler', show lint warnings in suitable for your editor."
|
||||
),
|
||||
'only-new' => array(
|
||||
|
@ -384,6 +385,11 @@ EOTEXT
|
|||
case 'summary':
|
||||
$renderer = new ArcanistLintSummaryRenderer();
|
||||
break;
|
||||
case 'none':
|
||||
$prompt_patches = false;
|
||||
$apply_patches = $this->getArgument('apply-patches');
|
||||
$renderer = new ArcanistLintNoneRenderer();
|
||||
break;
|
||||
case 'compiler':
|
||||
$renderer = new ArcanistLintLikeCompilerRenderer();
|
||||
$prompt_patches = false;
|
||||
|
@ -480,6 +486,11 @@ EOTEXT
|
|||
}
|
||||
|
||||
if ($failed) {
|
||||
if ($failed instanceof ArcanistNoEffectException) {
|
||||
if ($renderer instanceof ArcanistLintNoneRenderer) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
throw $failed;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue