1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-22 21:40:54 +01:00

Minor improvements to the ArcanistLintCheckstyleXMLRenderer class.

Summary: Ref T4948. Move the `startDocument` code to a `renderPreamble` function so that, at least theoretically, the renderer can be reused. Otherwise, the only way to reuse the renderer would be to construct a new instance.

Test Plan: Ran `arc lint --output xml` and verified that the output looked reasonable.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4948

Differential Revision: https://secure.phabricator.com/D9108
This commit is contained in:
Joshua Spence 2014-05-13 17:32:49 -07:00 committed by epriestley
parent b744ed9a19
commit d484b60295
3 changed files with 8 additions and 0 deletions

View file

@ -14,10 +14,13 @@ final class ArcanistLintCheckstyleXMLRenderer extends ArcanistLintRenderer {
$this->writer->openMemory();
$this->writer->setIndent(true);
$this->writer->setIndentString(' ');
}
public function renderPreamble() {
$this->writer->startDocument('1.0', 'UTF-8');
$this->writer->startElement('checkstyle');
$this->writer->writeAttribute('version', '4.3');
return $this->writer->flush();
}
public function renderLintResult(ArcanistLintResult $result) {

View file

@ -7,6 +7,10 @@
*/
abstract class ArcanistLintRenderer {
public function renderPreamble() {
return '';
}
abstract public function renderLintResult(ArcanistLintResult $result);
abstract public function renderOkayResult();

View file

@ -469,6 +469,7 @@ EOTEXT
}
$all_autofix = true;
$console->writeOut('%s', $renderer->renderPreamble());
foreach ($results as $result) {
$result_all_autofix = $result->isAllAutofix();