1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Display and link lint errors on line 0

Summary:
Some lint errors (e.g. Javelin) don't have a line number.
Put them on the first line.

Putting them above the first line would be even nicer but much more complicated.

Test Plan: Display diff with lint error on line 0 (D2583).

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2599
This commit is contained in:
vrana 2012-05-29 16:42:43 -07:00
parent c002b466b8
commit 6f10706852
2 changed files with 3 additions and 3 deletions

View file

@ -86,13 +86,12 @@ final class DifferentialLintFieldSpecification
$name = idx($message, 'name');
$description = idx($message, 'description');
$line_link = 'line '.phutil_escape_html($line);
$line_link = 'line '.intval($line);
if (isset($path_changesets[$path])) {
// TODO: Load very large diff before linking to line.
$line_link = phutil_render_tag(
'a',
array(
'href' => '#C'.$path_changesets[$path].'NL'.$line,
'href' => '#C'.$path_changesets[$path].'NL'.max(1, $line),
),
$line_link);
}

View file

@ -1086,6 +1086,7 @@ final class DifferentialChangesetParser {
foreach ($this->comments as $comment) {
$final = $comment->getLineNumber() +
$comment->getLineLength();
$final = max(1, $final);
if ($this->isCommentOnRightSideWhenDisplayed($comment)) {
$new_comments[$final][] = $comment;
} else {