Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15529464
D14497.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14497.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
@@ -67,17 +67,28 @@
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':
diff --git a/src/lint/linter/__tests__/csslint/no-line-related-issue.lint-test b/src/lint/linter/__tests__/csslint/no-line-related-issue.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/csslint/no-line-related-issue.lint-test
@@ -0,0 +1,9 @@
+h1 {
+ font-weight: bold;
+}
+h1 {
+ font-weight: bold;
+}
+~~~~~~~~~~
+warning::
+warning:4:1
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 23, 8:05 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7736419
Default Alt Text
D14497.diff (1 KB)
Attached To
Mode
D14497: Fix ArcanistCSSLintLinter issue for messages without line number
Attached
Detach File
Event Timeline
Log In to Comment