mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 22:10:54 +01: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:
parent
f75cf71c9e
commit
72ee0ced4f
4 changed files with 24 additions and 2 deletions
|
@ -50,4 +50,8 @@ class ArcanistLintJSONRenderer {
|
|||
|
||||
return json_encode($output)."\n";
|
||||
}
|
||||
|
||||
public function renderOkayResult() {
|
||||
return "\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,4 +197,9 @@ class ArcanistLintRenderer {
|
|||
$line,
|
||||
$data);
|
||||
}
|
||||
|
||||
public function renderOkayResult() {
|
||||
return
|
||||
phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,4 +40,9 @@ class ArcanistLintSummaryRenderer {
|
|||
|
||||
return implode("\n", $text);
|
||||
}
|
||||
|
||||
public function renderOkayResult() {
|
||||
return
|
||||
phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
"<bg:green>** OKAY **</bg> No lint warnings.\n");
|
||||
echo $renderer->renderOkayResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue