<?php

/**
 * Shows lint messages to the user.
 *
 * @group lint
 */
final class ArcanistLintSummaryRenderer extends ArcanistLintRenderer {
  public function renderLintResult(ArcanistLintResult $result) {
    $messages = $result->getMessages();
    $path = $result->getPath();

    $text = array();
    $text[] = $path.":";
    foreach ($messages as $message) {
      $name = $message->getName();
      $severity = ArcanistLintSeverity::getStringForSeverity(
        $message->getSeverity());
      $line = $message->getLine();

      $text[] = "    {$severity} on line {$line}: {$name}";
    }
    $text[] = null;

    return implode("\n", $text);
  }

  public function renderOkayResult() {
    return
      phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
  }
}

<?php

/**
 * Shows lint messages to the user.
 *
 * @group lint
 */
final class ArcanistLintSummaryRenderer extends ArcanistLintRenderer {
  public function renderLintResult(ArcanistLintResult $result) {
    $messages = $result->getMessages();
    $path = $result->getPath();

    $text = array();
    foreach ($messages as $message) {
      $name = $message->getName();
      $severity = ArcanistLintSeverity::getStringForSeverity(
        $message->getSeverity());
      $line = $message->getLine();

      $text[] = "{$path}:{$line}:{$severity}: {$name}\n";
    }

    return implode("", $text);
  }

  public function renderOkayResult() {
    return
      phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
  }
}

Improve `arc lint --output summary`
Improve `arc lint --output summary`

Summary:
This currently output like this:

  file_a:
  file_b:
  file_c:
    Warning on line 29: blah blah

This isn't especially useful and can't be piped to other tools. Instead, emit output like:

  file_c:29:Warning: blah blah

This is greppable / pipeable.

Test Plan: Ran `arc lint --output summary`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7788
