Page MenuHomePhabricator

D14497.diff
No OneTemporary

D14497.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
@@ -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

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)

Event Timeline