1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 08:58:55 +02:00

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
This commit is contained in:
adonohue 2011-12-15 10:02:29 -08:00
parent f75cf71c9e
commit 72ee0ced4f
4 changed files with 24 additions and 2 deletions

View file

@ -50,4 +50,8 @@ class ArcanistLintJSONRenderer {
return json_encode($output)."\n"; return json_encode($output)."\n";
} }
public function renderOkayResult() {
return "\n";
}
} }

View file

@ -197,4 +197,9 @@ class ArcanistLintRenderer {
$line, $line,
$data); $data);
} }
public function renderOkayResult() {
return
phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
}
} }

View file

@ -40,4 +40,9 @@ class ArcanistLintSummaryRenderer {
return implode("\n", $text); return implode("\n", $text);
} }
public function renderOkayResult() {
return
phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
}
} }

View file

@ -202,6 +202,15 @@ EOTEXT
switch ($this->getArgument('output')) { switch ($this->getArgument('output')) {
case 'json': case 'json':
$renderer = new ArcanistLintJSONRenderer(); $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; break;
case 'summary': case 'summary':
$renderer = new ArcanistLintSummaryRenderer(); $renderer = new ArcanistLintSummaryRenderer();
@ -293,8 +302,7 @@ EOTEXT
if (!$this->getParentWorkflow()) { if (!$this->getParentWorkflow()) {
if ($result_code == self::RESULT_OKAY) { if ($result_code == self::RESULT_OKAY) {
echo phutil_console_format( echo $renderer->renderOkayResult();
"<bg:green>** OKAY **</bg> No lint warnings.\n");
} }
} }