Changeset View
Changeset View
Standalone View
Standalone View
src/lint/renderer/ArcanistConsoleLintRenderer.php
Context not available. | |||||
if ($start > ($max_old + 1)) { | if ($start > ($max_old + 1)) { | ||||
$invalid_position = true; | $invalid_position = true; | ||||
} else if ($start > $max_old) { | } else if ($start > $max_old) { | ||||
if (strlen($original)) { | if (@strlen($original)) { | ||||
$invalid_position = true; | $invalid_position = true; | ||||
} else if ($char !== null && $char !== 1) { | } else if ($char !== null && $char !== 1) { | ||||
$invalid_position = true; | $invalid_position = true; | ||||
Context not available. | |||||
$old, | $old, | ||||
$replacement, | $replacement, | ||||
$patch_offset, | $patch_offset, | ||||
strlen($original)); | @strlen($original)); | ||||
$new_lines = phutil_split_lines($new); | $new_lines = phutil_split_lines($new); | ||||
// Figure out how many "-" and "+" lines we have by counting the newlines | // Figure out how many "-" and "+" lines we have by counting the newlines | ||||
Context not available. | |||||
$old_lines[$start - 1], | $old_lines[$start - 1], | ||||
$this->highlightText($original), | $this->highlightText($original), | ||||
$char - 1, | $char - 1, | ||||
strlen($original)); | @strlen($original)); | ||||
// See T13543. The message may have completely removed this line: for | // See T13543. The message may have completely removed this line: for | ||||
// example, if it trimmed trailing spaces from the end of a file. If | // example, if it trimmed trailing spaces from the end of a file. If | ||||
Context not available. | |||||
$new_lines[$start - 1], | $new_lines[$start - 1], | ||||
$this->highlightText($replacement), | $this->highlightText($replacement), | ||||
$char - 1, | $char - 1, | ||||
strlen($replacement)); | @strlen($replacement)); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
// If we have "original" text and it is contained on a single line, | // If we have "original" text and it is contained on a single line, | ||||
// highlight the affected area. If we don't have any text, we'll mark | // highlight the affected area. If we don't have any text, we'll mark | ||||
// the character with a caret (below, in rendering) instead. | // the character with a caret (below, in rendering) instead. | ||||
if ($old_impact == 1 && strlen($original)) { | if ($old_impact == 1 && @strlen($original)) { | ||||
$old_lines[$start - 1] = substr_replace( | $old_lines[$start - 1] = substr_replace( | ||||
$old_lines[$start - 1], | $old_lines[$start - 1], | ||||
$this->highlightText($original), | $this->highlightText($original), | ||||
$char - 1, | $char - 1, | ||||
strlen($original)); | @strlen($original)); | ||||
} | } | ||||
$old_impact = 0; | $old_impact = 0; | ||||
Context not available. | |||||
// doesn't mess up. This can happen when the last line of the old file | // doesn't mess up. This can happen when the last line of the old file | ||||
// didn't have a newline at the end. | // didn't have a newline at the end. | ||||
$text = $spec['text']; | $text = $spec['text']; | ||||
if (!preg_match('/\n\z/', $spec['text'])) { | if (!@preg_match('/\n\z/', $spec['text'])) { | ||||
$text .= "\n"; | $text .= "\n"; | ||||
} | } | ||||
Context not available. | |||||
// If this is just a message and does not have a patch, put a little | // If this is just a message and does not have a patch, put a little | ||||
// caret underneath the line to point out where the issue is. | // caret underneath the line to point out where the issue is. | ||||
if ($chevron) { | if ($chevron) { | ||||
if (!$message->isPatchable() && !strlen($original)) { | if (!$message->isPatchable() && !@strlen($original)) { | ||||
$result[] = $this->renderCaret($char)."\n"; | $result[] = $this->renderCaret($char)."\n"; | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
$line_map[$number] = $offset; | $line_map[$number] = $offset; | ||||
$number++; | $number++; | ||||
$offset += strlen($line); | $offset += @strlen($line); | ||||
} | } | ||||
// If the last line ends in a newline, add a virtual offset for the final | // If the last line ends in a newline, add a virtual offset for the final | ||||
// line with no characters on it. This allows lint messages to target the | // line with no characters on it. This allows lint messages to target the | ||||
// last line of the file at character 1. | // last line of the file at character 1. | ||||
if ($lines) { | if ($lines) { | ||||
if (preg_match('/\n\z/', $line)) { | if (@preg_match('/\n\z/', $line)) { | ||||
$line_map[$number] = $offset; | $line_map[$number] = $offset; | ||||
} | } | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0