1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-01-22 12:41:18 +01:00

Fix ArcanistCSSLintLinter issue for messages without line number

Summary:
csslint offers some diagnostics related to all the document without any
relevant line number.

In such case, arc lint failed, as setLine expects null or an integer,
but not an empty string.

The 'char' and 'line' attributes in XML report are now optional.

Fixes T9804.

Test Plan: test case to repro the issue added

Reviewers: chad, joshuaspence, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9804

Differential Revision: https://secure.phabricator.com/D14497
This commit is contained in:
Sébastien Santoro 2015-11-17 07:14:13 -08:00 committed by epriestley
parent 66ab1c955d
commit b25cf080bc
2 changed files with 26 additions and 6 deletions

View file

@ -67,17 +67,28 @@ final class ArcanistCSSLintLinter extends ArcanistExternalLinter {
foreach ($files as $file) {
foreach ($file->childNodes as $child) {
$line = $child->getAttribute('line');
$char = $child->getAttribute('char');
$original_text = $child->getAttribute('evidence');
if ($line === '') {
$line = null;
}
if ($char === '') {
$char = null;
} else {
$original_text = substr($original_text, $char - 1);
}
$message = id(new ArcanistLintMessage())
->setPath($path)
->setLine($child->getAttribute('line'))
->setChar($child->getAttribute('char'))
->setLine($line)
->setChar($char)
->setCode($this->getLinterName())
->setName($this->getLinterName())
->setDescription($child->getAttribute('reason'))
->setOriginalText(
substr(
$child->getAttribute('evidence'),
$child->getAttribute('char') - 1));
->setOriginalText($original_text);
switch ($child->getAttribute('severity')) {
case 'error':

View file

@ -0,0 +1,9 @@
h1 {
font-weight: bold;
}
h1 {
font-weight: bold;
}
~~~~~~~~~~
warning::
warning:4:1