]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix context for lint errors at top of file in JSON renderer
authorvrana <jakubv@fb.com>
Sat, 2 Jun 2012 06:43:21 +0000 (23:43 -0700)
committervrana <jakubv@fb.com>
Sat, 2 Jun 2012 06:43:21 +0000 (23:43 -0700)
src/lint/renderer/ArcanistLintJSONRenderer.php

index 423845ec814c0ba8940eda5285dd5323aa9e3aa5..3ee744a4226898fa8105406bac113543e5f4ccc4 100644 (file)
@@ -41,7 +41,7 @@ final class ArcanistLintJSONRenderer implements ArcanistLintRenderer {
         'char' => $message->getChar(),
         'context' => implode("\n", array_slice(
           $data,
-          $message->getLine() - self::LINES_OF_CONTEXT,
+          max(1, $message->getLine() - self::LINES_OF_CONTEXT),
           self::LINES_OF_CONTEXT * 2 + 1
         )),
         'description' => $message->getDescription(),