From: adonohue Date: Thu, 15 Dec 2011 18:02:29 +0000 (-0800) Subject: Don't output "OKAY" for arc lint --output json. X-Git-Tag: conduit-4~214 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=72ee0ced4f0cfd343d40f1d17f7dc170a6e0ce4c;p=arcanist.git Don't output "OKAY" for arc lint --output json. Summary: --output json will be used for scripts, so support script writers a little better. Test Plan: arc lint [--output {json, summary}] arc lint --output json {--apply-patches, --never-apply-patches} Reviewers: epriestley Reviewed By: epriestley CC: jack, aran, epriestley Maniphest Tasks: T675 Differential Revision: 1220 --- diff --git a/src/lint/renderer/ArcanistLintJSONRenderer.php b/src/lint/renderer/ArcanistLintJSONRenderer.php index 580bbd81..d5bed9a6 100644 --- a/src/lint/renderer/ArcanistLintJSONRenderer.php +++ b/src/lint/renderer/ArcanistLintJSONRenderer.php @@ -50,4 +50,8 @@ class ArcanistLintJSONRenderer { return json_encode($output)."\n"; } + + public function renderOkayResult() { + return "\n"; + } } diff --git a/src/lint/renderer/ArcanistLintRenderer.php b/src/lint/renderer/ArcanistLintRenderer.php index df2518e8..235e1612 100644 --- a/src/lint/renderer/ArcanistLintRenderer.php +++ b/src/lint/renderer/ArcanistLintRenderer.php @@ -197,4 +197,9 @@ class ArcanistLintRenderer { $line, $data); } + + public function renderOkayResult() { + return + phutil_console_format("** OKAY ** No lint warnings.\n"); + } } diff --git a/src/lint/renderer/ArcanistLintSummaryRenderer.php b/src/lint/renderer/ArcanistLintSummaryRenderer.php index b580e38d..b5b22477 100644 --- a/src/lint/renderer/ArcanistLintSummaryRenderer.php +++ b/src/lint/renderer/ArcanistLintSummaryRenderer.php @@ -40,4 +40,9 @@ class ArcanistLintSummaryRenderer { return implode("\n", $text); } + + public function renderOkayResult() { + return + phutil_console_format("** OKAY ** No lint warnings.\n"); + } } diff --git a/src/workflow/lint/ArcanistLintWorkflow.php b/src/workflow/lint/ArcanistLintWorkflow.php index a4831304..df923d1b 100644 --- a/src/workflow/lint/ArcanistLintWorkflow.php +++ b/src/workflow/lint/ArcanistLintWorkflow.php @@ -202,6 +202,15 @@ EOTEXT switch ($this->getArgument('output')) { case 'json': $renderer = new ArcanistLintJSONRenderer(); + $prompt_patches = false; + $apply_patches = false; + if ($this->getArgument('never-apply-patches') || + $this->getArgument('apply-patches')) { + throw new ArcanistUsageException( + "Automatic patch suggestion is disabled when using JSON output. ". + "Remove --never-apply-patches or --apply-patches." + ); + } break; case 'summary': $renderer = new ArcanistLintSummaryRenderer(); @@ -293,8 +302,7 @@ EOTEXT if (!$this->getParentWorkflow()) { if ($result_code == self::RESULT_OKAY) { - echo phutil_console_format( - "** OKAY ** No lint warnings.\n"); + echo $renderer->renderOkayResult(); } }