mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-12 18:02:39 +01:00
(stable) In the "cpplint" binding, raise messages on "line 0" without a line
Summary: Ref T13543. The "cpplint.py" script may emit messages on line 0, but Arcanist doesn't accept these messages. This is a small piece of a whole set of broader issues, but stop the bleeding for now. Test Plan: - Ran `arc lint example.h` on a file with no `#ifndef` guard, and `cpplint` configured. - Cpplint raised a message at line "0". - Before change: arc choked when trying to render this. - After change: arc survives rendering. Maniphest Tasks: T13543 Differential Revision: https://secure.phabricator.com/D21289
This commit is contained in:
parent
a5bfb968cd
commit
609c8c9fdc
1 changed files with 11 additions and 1 deletions
|
@ -48,12 +48,22 @@ final class ArcanistCpplintLinter extends ArcanistExternalLinter {
|
|||
|
||||
$message = new ArcanistLintMessage();
|
||||
$message->setPath($path);
|
||||
$message->setLine($matches[1]);
|
||||
$message->setCode($matches[3]);
|
||||
$message->setName($matches[3]);
|
||||
$message->setDescription($matches[2]);
|
||||
$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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue