Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14077659
D11311.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11311.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11311: Improve parsing of `csslint` output
Attached
Detach File
Event Timeline
Log In to Comment