Changeset View
Changeset View
Standalone View
Standalone View
src/lint/renderer/ArcanistLintRenderer.php
| <?php | <?php | ||||
| abstract class ArcanistLintRenderer extends Phobject { | |||||
| private $output; | |||||
| final public function getRendererKey() { | |||||
| return $this->getPhobjectClassConstant('RENDERERKEY'); | |||||
| } | |||||
| final public static function getAllRenderers() { | |||||
| return id(new PhutilClassMapQuery()) | |||||
| ->setAncestorClass(__CLASS__) | |||||
| ->setUniqueMethod('getRendererKey') | |||||
| ->execute(); | |||||
| } | |||||
| final public function setOutputPath($path) { | |||||
| $this->output = $path; | |||||
| return $this; | |||||
| } | |||||
| /** | /** | ||||
| * Shows lint messages to the user. | * Does this renderer support applying lint patches? | ||||
| * | |||||
| * @return bool True if patches should be applied when using this renderer. | |||||
| */ | */ | ||||
| abstract class ArcanistLintRenderer extends Phobject { | public function supportsPatching() { | ||||
| return false; | |||||
| } | |||||
| public function willRenderResults() { | |||||
| return null; | |||||
| } | |||||
| public function didRenderResults() { | |||||
| return null; | |||||
| } | |||||
| public function renderResultCode($result_code) { | |||||
| return null; | |||||
| } | |||||
| public function renderPreamble() { | public function handleException(Exception $ex) { | ||||
| return ''; | throw $ex; | ||||
| } | } | ||||
| abstract public function renderLintResult(ArcanistLintResult $result); | abstract public function renderLintResult(ArcanistLintResult $result); | ||||
| abstract public function renderOkayResult(); | |||||
| public function renderPostamble() { | protected function writeOut($message) { | ||||
| return ''; | if ($this->output) { | ||||
| Filesystem::appendFile($this->output, $message); | |||||
| } else { | |||||
| echo $message; | |||||
| } | |||||
| return $this; | |||||
| } | } | ||||
| } | } | ||||