22
public function renderPropertyViewLabel() {
22
public function renderPropertyViewValue(array $handles) {
26
public function shouldAppearInDiffPropertyView() {
30
public function renderDiffPropertyViewLabel(DifferentialDiff $diff) {
23
31
return $this->getFieldName();
26
public function getRequiredDiffPropertiesForRevisionView() {
34
protected function getLegacyProperty() {
38
protected function getDiffPropertyKeys() {
34
public function renderPropertyViewValue(array $handles) {
35
$diff = $this->getObject()->getActiveDiff();
37
$path_changesets = mpull($diff->loadChangesets(), 'getID', 'getFilename');
39
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
40
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
41
$ldata = $diff->getProperty('arc:lint');
53
$excuse = $diff->getProperty('arc:lint-excuse');
58
'value' => phutil_escape_html_newlines($excuse),
67
$ldata = igroup($ldata, 'path');
68
foreach ($ldata as $path => $messages) {
73
'show' => $show_limit,
76
foreach ($messages as $message) {
77
$path = idx($message, 'path');
78
$line = idx($message, 'line');
80
$code = idx($message, 'code');
81
$severity = idx($message, 'severity');
83
$name = idx($message, 'name');
84
$description = idx($message, 'description');
86
$line_link = pht('line %d', intval($line));
87
if (isset($path_changesets[$path])) {
88
$href = '#C'.$path_changesets[$path].'NL'.max(1, $line);
90
// TODO: We are always showing the active diff
91
// if ($diff->getID() != $this->getDiff()->getID()) {
92
// $href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href;
95
$line_link = phutil_tag(
108
if (empty($hidden[$severity])) {
109
$hidden[$severity] = 0;
111
$hidden[$severity]++;
115
'style' => $this->getSeverityStyle($severity),
116
'name' => ucwords($severity),
125
if (!empty($message['locations'])) {
126
$locations = array();
127
foreach ($message['locations'] as $location) {
128
$other_line = idx($location, 'line');
130
idx($location, 'path', $path).
131
($other_line ? ":{$other_line}" : '');
133
$description .= "\n".pht(
134
'Other locations: %s',
135
implode(', ', $locations));
138
if (strlen($description)) {
140
'style' => 'details',
141
'value' => phutil_escape_html_newlines($description),
144
if (empty($hidden['details'])) {
145
$hidden['details'] = 0;
147
$hidden['details']++;
153
$postponed = $diff->getProperty('arc:lint-postponed');
155
foreach ($postponed as $linter) {
157
'style' => $this->getPostponedStyle(),
158
'name' => 'Postponed',
162
if (empty($hidden['postponed'])) {
163
$hidden['postponed'] = 0;
165
$hidden['postponed']++;
169
$show_string = $this->renderShowString($hidden);
171
$view = new DifferentialResultsTableView();
172
$view->setRows($rows);
173
$view->setShowMoreString($show_string);
175
return $view->render();
178
private function getSeverityStyle($severity) {
180
ArcanistLintSeverity::SEVERITY_ERROR => 'red',
181
ArcanistLintSeverity::SEVERITY_WARNING => 'yellow',
182
ArcanistLintSeverity::SEVERITY_AUTOFIX => 'yellow',
183
ArcanistLintSeverity::SEVERITY_ADVICE => 'yellow',
185
return idx($map, $severity);
188
private function getPostponedStyle() {
192
private function renderShowString(array $hidden) {
197
// Reorder hidden things by severity.
198
$hidden = array_select_keys(
201
ArcanistLintSeverity::SEVERITY_ERROR,
202
ArcanistLintSeverity::SEVERITY_WARNING,
203
ArcanistLintSeverity::SEVERITY_AUTOFIX,
204
ArcanistLintSeverity::SEVERITY_ADVICE,
210
foreach ($hidden as $key => $value) {
212
case ArcanistLintSeverity::SEVERITY_ERROR:
213
$show[] = pht('%d Error(s)', $value);
215
case ArcanistLintSeverity::SEVERITY_WARNING:
216
$show[] = pht('%d Warning(s)', $value);
218
case ArcanistLintSeverity::SEVERITY_AUTOFIX:
219
$show[] = pht('%d Auto-Fix(es)', $value);
221
case ArcanistLintSeverity::SEVERITY_ADVICE:
222
$show[] = pht('%d Advice(s)', $value);
225
$show[] = pht('%d Detail(s)', $value);
228
$show[] = pht('%d Postponed', $value);
237
'Show Full Lint Results (%s)',
238
implode(', ', $show));
45
protected function loadHarbormasterTargetMessages(array $target_phids) {
46
return id(new HarbormasterBuildLintMessage())->loadAllWhere(
47
'buildTargetPHID IN (%Ls) LIMIT 25',
51
protected function newHarbormasterMessageView(array $messages) {
52
return id(new HarbormasterLintPropertyView())
54
->setLintMessages($messages);
57
protected function newModernMessage(array $message) {
58
return HarbormasterBuildLintMessage::newFromDictionary(
59
new HarbormasterBuildTarget(),
60
$this->getModernLintMessageDictionary($message));
241
63
public function getWarningsForDetailView() {
86
protected function renderHarbormasterStatus(
87
DifferentialDiff $diff,
91
DifferentialLintStatus::LINT_NONE => 'grey',
92
DifferentialLintStatus::LINT_OKAY => 'green',
93
DifferentialLintStatus::LINT_WARN => 'yellow',
94
DifferentialLintStatus::LINT_FAIL => 'red',
95
DifferentialLintStatus::LINT_SKIP => 'blue',
96
DifferentialLintStatus::LINT_AUTO_SKIP => 'blue',
97
DifferentialLintStatus::LINT_POSTPONED => 'blue',
99
$icon_color = idx($colors, $diff->getLintStatus(), 'grey');
101
$message = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
103
$excuse = $diff->getProperty('arc:lint-excuse');
104
if (strlen($excuse)) {
106
phutil_tag('strong', array(), pht('Excuse:')),
108
phutil_escape_html_newlines($excuse),
112
$status = id(new PHUIStatusListView())
114
id(new PHUIStatusItemView())
115
->setIcon(PHUIStatusItemView::ICON_STAR, $icon_color)
116
->setTarget($message)
122
private function getModernLintMessageDictionary(array $map) {
123
// Strip out `null` values to satisfy stricter typechecks.
124
foreach ($map as $key => $value) {
125
if ($value === null) {
130
// TODO: We might need to remap some stuff here?