From 9d9225390376c47255f2bf8f1b890135840e65f3 Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 25 Feb 2013 12:33:51 -0800 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 2 ++ src/lint/linter/ArcanistPhutilXHPASTLinter.php | 7 ++++++- src/lint/renderer/ArcanistLintNoneRenderer.php | 16 ++++++++++++++++ src/workflow/ArcanistLintWorkflow.php | 11 +++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/lint/renderer/ArcanistLintNoneRenderer.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 546cdac8..9cf2a511 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/lint/linter/ArcanistPhutilXHPASTLinter.php b/src/lint/linter/ArcanistPhutilXHPASTLinter.php index 4ae868e1..842e2b35 100644 --- a/src/lint/linter/ArcanistPhutilXHPASTLinter.php +++ b/src/lint/linter/ArcanistPhutilXHPASTLinter.php @@ -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) { diff --git a/src/lint/renderer/ArcanistLintNoneRenderer.php b/src/lint/renderer/ArcanistLintNoneRenderer.php new file mode 100644 index 00000000..da44ac86 --- /dev/null +++ b/src/lint/renderer/ArcanistLintNoneRenderer.php @@ -0,0 +1,16 @@ + "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; } -- 2.43.0