]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Display other locations of lint errors in console renderer
authorvrana <jakubv@fb.com>
Fri, 11 Jan 2013 23:23:47 +0000 (15:23 -0800)
committervrana <jakubv@fb.com>
Fri, 11 Jan 2013 23:25:58 +0000 (15:25 -0800)
Test Plan: Created function named `f_a`, manually set other location.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4412

src/lint/renderer/ArcanistLintConsoleRenderer.php

index 7a13deab23717d93b2bf37d8325376cc16308263..3f5bcd53f4e9d27585478facbc6dd2ecef6012a2 100644 (file)
@@ -36,14 +36,24 @@ final class ArcanistLintConsoleRenderer implements ArcanistLintRenderer {
         $message->getSeverity());
       $code = $message->getCode();
       $name = $message->getName();
-      $description = phutil_console_wrap($message->getDescription(), 4);
+      $description = $message->getDescription();
+
+      if ($message->getOtherLocations()) {
+        $locations = array();
+        foreach ($message->getOtherLocations() as $location) {
+          $locations[] =
+            idx($location, 'path', $path).
+            (!empty($location['line']) ? ":{$location['line']}" : "");
+        }
+        $description .= "\nOther locations: ".implode(', ', $locations);
+      }
 
       $text[] = phutil_console_format(
         "  **<bg:{$color}> %s </bg>** (%s) __%s__\n%s\n",
         $severity,
         $code,
         $name,
-        $description);
+        phutil_console_wrap($description, 4));
 
       if ($message->hasFileContext()) {
         $text[] = $this->renderContext($message, $lines);