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->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) {
*/
abstract class ArcanistLintRenderer {
+ public function renderPreamble() {
+ return '';
+ }
+
abstract public function renderLintResult(ArcanistLintResult $result);
abstract public function renderOkayResult();
}
$all_autofix = true;
+ $console->writeOut('%s', $renderer->renderPreamble());
foreach ($results as $result) {
$result_all_autofix = $result->isAllAutofix();