Page MenuHomePhabricator

D11311.diff
No OneTemporary

D11311.diff

diff --git a/src/lint/linter/ArcanistCSSLintLinter.php b/src/lint/linter/ArcanistCSSLintLinter.php
--- a/src/lint/linter/ArcanistCSSLintLinter.php
+++ b/src/lint/linter/ArcanistCSSLintLinter.php
@@ -75,25 +75,29 @@
foreach ($files as $file) {
foreach ($file->childNodes as $child) {
- $data = $this->getData($path);
- $lines = explode("\n", $data);
- $name = $child->getAttribute('reason');
- $severity = ($child->getAttribute('severity') == 'warning')
- ? ArcanistLintSeverity::SEVERITY_WARNING
- : ArcanistLintSeverity::SEVERITY_ERROR;
-
$message = id(new ArcanistLintMessage())
->setPath($path)
->setLine($child->getAttribute('line'))
->setChar($child->getAttribute('char'))
- ->setCode('CSSLint')
- ->setSeverity($severity)
- ->setDescription($child->getAttribute('reason'));
-
- if ($child->hasAttribute('line') && $child->getAttribute('line') > 0) {
- $line = $lines[$child->getAttribute('line') - 1];
- $text = substr($line, $child->getAttribute('char') - 1);
- $message->setOriginalText($text);
+ ->setCode($this->getLinterName())
+ ->setDescription($child->getAttribute('reason'))
+ ->setOriginalText(
+ substr(
+ $child->getAttribute('evidence'),
+ $child->getAttribute('char') - 1));
+
+ switch ($child->getAttribute('severity')) {
+ case 'error':
+ $message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
+ break;
+
+ case 'warning':
+ $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
+ break;
+
+ default:
+ $message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
+ break;
}
$messages[] = $message;
diff --git a/src/lint/linter/__tests__/csslint/parse-error.lint-test b/src/lint/linter/__tests__/csslint/parse-error.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/csslint/parse-error.lint-test
@@ -0,0 +1,6 @@
+li {
+ float: left;
+ float left;
+}
+~~~~~~~~~~
+error:3:9

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 12:47 AM (8 h, 35 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6776468
Default Alt Text
D11311.diff (2 KB)

Event Timeline