Add link from lint error to code
Test Plan: Display diff with lint errors Click on a line number in lint errors overview Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1400
This commit is contained in:
parent
5cf6d788ce
commit
c6febdfc52
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 Facebook, Inc.
|
* Copyright 2012 Facebook, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -33,6 +33,7 @@ final class DifferentialLintFieldSpecification
|
||||||
|
|
||||||
public function renderValueForRevisionView() {
|
public function renderValueForRevisionView() {
|
||||||
$diff = $this->getDiff();
|
$diff = $this->getDiff();
|
||||||
|
$path_changesets = mpull($diff->loadChangesets(), 'getId', 'getFileName');
|
||||||
|
|
||||||
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
|
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
|
||||||
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
|
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
|
||||||
|
@ -53,6 +54,13 @@ final class DifferentialLintFieldSpecification
|
||||||
$name = idx($message, 'name');
|
$name = idx($message, 'name');
|
||||||
$description = idx($message, 'description');
|
$description = idx($message, 'description');
|
||||||
|
|
||||||
|
$line_link = phutil_escape_html($line);
|
||||||
|
if (isset($path_changesets[$path])) {
|
||||||
|
$href = '#C'.$path_changesets[$path].'NL'.$line;
|
||||||
|
$line_link = '<a href="'.phutil_escape_html($href).'">'.
|
||||||
|
$line_link.
|
||||||
|
'</a>';
|
||||||
|
}
|
||||||
$message_markup[] =
|
$message_markup[] =
|
||||||
'<li>'.
|
'<li>'.
|
||||||
'<span class="lint-severity-'.phutil_escape_html($severity).'">'.
|
'<span class="lint-severity-'.phutil_escape_html($severity).'">'.
|
||||||
|
@ -61,7 +69,7 @@ final class DifferentialLintFieldSpecification
|
||||||
' '.
|
' '.
|
||||||
'('.phutil_escape_html($code).') '.
|
'('.phutil_escape_html($code).') '.
|
||||||
phutil_escape_html($name).
|
phutil_escape_html($name).
|
||||||
' at line '.phutil_escape_html($line).
|
' at line '.$line_link.
|
||||||
'<p>'.phutil_escape_html($description).'</p>'.
|
'<p>'.phutil_escape_html($description).'</p>'.
|
||||||
'</li>';
|
'</li>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue