Changeset View
Changeset View
Standalone View
Standalone View
src/lint/renderer/ArcanistLintConsoleRenderer.php
| Show All 37 Lines | foreach ($messages as $message) { | ||||
| $name = $message->getName(); | $name = $message->getName(); | ||||
| $description = $message->getDescription(); | $description = $message->getDescription(); | ||||
| if ($message->getOtherLocations()) { | if ($message->getOtherLocations()) { | ||||
| $locations = array(); | $locations = array(); | ||||
| foreach ($message->getOtherLocations() as $location) { | foreach ($message->getOtherLocations() as $location) { | ||||
| $locations[] = | $locations[] = | ||||
| idx($location, 'path', $path). | idx($location, 'path', $path). | ||||
| (!empty($location['line']) ? ":{$location['line']}" : ""); | (!empty($location['line']) ? ":{$location['line']}" : ''); | ||||
| } | } | ||||
| $description .= "\nOther locations: ".implode(', ', $locations); | $description .= "\nOther locations: ".implode(', ', $locations); | ||||
| } | } | ||||
| $text[] = phutil_console_format( | $text[] = phutil_console_format( | ||||
| " **<bg:{$color}> %s </bg>** (%s) __%s__\n%s\n", | " **<bg:{$color}> %s </bg>** (%s) __%s__\n%s\n", | ||||
| $severity, | $severity, | ||||
| $code, | $code, | ||||
| ▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer { | ||||
| private function renderCaret($pos) { | private function renderCaret($pos) { | ||||
| return str_repeat(' ', 16 + $pos).'^'; | return str_repeat(' ', 16 + $pos).'^'; | ||||
| } | } | ||||
| protected function renderLine($line, $data, $chevron = false, $diff = null) { | protected function renderLine($line, $data, $chevron = false, $diff = null) { | ||||
| $chevron = $chevron ? '>>>' : ''; | $chevron = $chevron ? '>>>' : ''; | ||||
| return sprintf( | return sprintf( | ||||
| " %3s %1s %6s %s", | ' %3s %1s %6s %s', | ||||
| $chevron, | $chevron, | ||||
| $diff, | $diff, | ||||
| $line, | $line, | ||||
| $data); | $data); | ||||
| } | } | ||||
| public function renderOkayResult() { | public function renderOkayResult() { | ||||
| return | return | ||||
| phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n"); | phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n"); | ||||
| } | } | ||||
| } | } | ||||