Changeset View
Changeset View
Standalone View
Standalone View
src/lint/renderer/ArcanistConsoleLintRenderer.php
| Show All 38 Lines | foreach ($messages as $message) { | ||||
| 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 .= "\n".pht( | ||||
| 'Other locations: %s', | |||||
| 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, | ||||
| $name, | $name, | ||||
| phutil_console_wrap($description, 4)); | phutil_console_wrap($description, 4)); | ||||
| if ($message->hasFileContext()) { | if ($message->hasFileContext()) { | ||||
| $text[] = $this->renderContext($message, $lines); | $text[] = $this->renderContext($message, $lines); | ||||
| } | } | ||||
| } | } | ||||
| if ($text) { | if ($text) { | ||||
| $prefix = phutil_console_format("**>>>** Lint for __%s__:\n\n\n", $path); | $prefix = phutil_console_format( | ||||
| "**>>>** %s\n\n\n", | |||||
| pht( | |||||
| 'Lint for %s:', | |||||
| phutil_console_format('__%s__', $path))); | |||||
| return $prefix.implode("\n", $text); | return $prefix.implode("\n", $text); | ||||
| } else { | } else { | ||||
| return null; | return null; | ||||
| } | } | ||||
| } | } | ||||
| protected function renderContext( | protected function renderContext( | ||||
| ArcanistLintMessage $message, | ArcanistLintMessage $message, | ||||
| ▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | return sprintf( | ||||
| $chevron, | $chevron, | ||||
| $diff, | $diff, | ||||
| $line, | $line, | ||||
| $data); | $data); | ||||
| } | } | ||||
| public function renderOkayResult() { | public function renderOkayResult() { | ||||
| return phutil_console_format( | return phutil_console_format( | ||||
| "<bg:green>** OKAY **</bg> No lint warnings.\n"); | "<bg:green>** %s **</bg> %s\n", | ||||
| pht('OKAY'), | |||||
| pht('No lint warnings.')); | |||||
| } | } | ||||
| } | } | ||||