Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistXMLLinter.php
Show All 38 Lines | public function lintPath($path) { | ||||
libxml_clear_errors(); | libxml_clear_errors(); | ||||
if (simplexml_load_string($this->getData($path))) { | if (simplexml_load_string($this->getData($path))) { | ||||
// XML appears to be valid. | // XML appears to be valid. | ||||
return; | return; | ||||
} | } | ||||
foreach (libxml_get_errors() as $error) { | foreach (libxml_get_errors() as $error) { | ||||
$message = id(new ArcanistLintMessage()) | $message = (new ArcanistLintMessage()) | ||||
->setPath($path) | ->setPath($path) | ||||
->setLine($error->line) | ->setLine($error->line) | ||||
->setChar($error->column ? $error->column : null) | ->setChar($error->column ?: null) | ||||
->setCode($this->getLintMessageFullCode($error->code)) | ->setCode($this->getLintMessageFullCode($error->code)) | ||||
->setName(pht('LibXML Error')) | ->setName(pht('LibXML Error')) | ||||
->setDescription(trim($error->message)); | ->setDescription(trim($error->message)); | ||||
switch ($error->level) { | switch ($error->level) { | ||||
case LIBXML_ERR_NONE: | case LIBXML_ERR_NONE: | ||||
$message->setSeverity(ArcanistLintSeverity::SEVERITY_DISABLED); | $message->setSeverity(ArcanistLintSeverity::SEVERITY_DISABLED); | ||||
break; | break; | ||||
Show All 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0