Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistCpplintLinter.php
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | foreach ($lines as $line) { | ||||
| foreach ($matches as $key => $match) { | foreach ($matches as $key => $match) { | ||||
| $matches[$key] = trim($match); | $matches[$key] = trim($match); | ||||
| } | } | ||||
| $severity = $this->getLintMessageSeverity($matches[3]); | $severity = $this->getLintMessageSeverity($matches[3]); | ||||
| $message = new ArcanistLintMessage(); | $message = new ArcanistLintMessage(); | ||||
| $message->setPath($path); | $message->setPath($path); | ||||
| $message->setLine($matches[1]); | |||||
| $message->setCode($matches[3]); | $message->setCode($matches[3]); | ||||
| $message->setName($matches[3]); | $message->setName($matches[3]); | ||||
| $message->setDescription($matches[2]); | $message->setDescription($matches[2]); | ||||
| $message->setSeverity($severity); | $message->setSeverity($severity); | ||||
| // NOTE: "cpplint" raises some messages which apply to the whole file, | |||||
| // like "no #ifndef guard found". It raises these messages on line 0. | |||||
| // Arcanist messages should have a "null" line, not a "0" line, if they | |||||
| // aren't bound to a particular line number. | |||||
| $line = (int)$matches[1]; | |||||
| if ($line > 0) { | |||||
| $message->setLine($line); | |||||
| } | |||||
| $messages[] = $message; | $messages[] = $message; | ||||
| } | } | ||||
| return $messages; | return $messages; | ||||
| } | } | ||||
| protected function getLintCodeFromLinterConfigurationKey($code) { | protected function getLintCodeFromLinterConfigurationKey($code) { | ||||
| if (!preg_match('@^[a-z_]+/[a-z0-9_+]+$@', $code)) { | if (!preg_match('@^[a-z_]+/[a-z0-9_+]+$@', $code)) { | ||||
| Show All 13 Lines | |||||