Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistCSSLintLinter.php
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | if (!$ok) { | ||||
return false; | return false; | ||||
} | } | ||||
$files = $report_dom->getElementsByTagName('file'); | $files = $report_dom->getElementsByTagName('file'); | ||||
$messages = array(); | $messages = array(); | ||||
foreach ($files as $file) { | foreach ($files as $file) { | ||||
foreach ($file->childNodes as $child) { | 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()) | $message = id(new ArcanistLintMessage()) | ||||
->setPath($path) | ->setPath($path) | ||||
->setLine($child->getAttribute('line')) | ->setLine($line) | ||||
->setChar($child->getAttribute('char')) | ->setChar($char) | ||||
->setCode($this->getLinterName()) | ->setCode($this->getLinterName()) | ||||
->setName($this->getLinterName()) | ->setName($this->getLinterName()) | ||||
->setDescription($child->getAttribute('reason')) | ->setDescription($child->getAttribute('reason')) | ||||
->setOriginalText( | ->setOriginalText($original_text); | ||||
substr( | |||||
$child->getAttribute('evidence'), | |||||
$child->getAttribute('char') - 1)); | |||||
switch ($child->getAttribute('severity')) { | switch ($child->getAttribute('severity')) { | ||||
case 'error': | case 'error': | ||||
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR); | $message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR); | ||||
break; | break; | ||||
case 'warning': | case 'warning': | ||||
$message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING); | $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING); | ||||
Show All 28 Lines |