]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Improve the "inline HTML" linter rule
authorJoshua Spence <josh@joshuaspence.com>
Wed, 19 Aug 2015 05:34:43 +0000 (15:34 +1000)
committerJoshua Spence <josh@freelancer.com>
Wed, 19 Aug 2015 05:34:43 +0000 (15:34 +1000)
Summary: Improve `ArcanistInlineHTMLXHPASTLinterRule` such that it doesn't raise duplicate warnings. Also be a bit more lax with whitespace.

Test Plan: Unit tests now pass.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13896

src/lint/linter/ArcanistInlineHTMLXHPASTLinterRule.php
src/lint/linter/__tests__/xhpast/embedded-tags.lint-test
src/lint/linter/__tests__/xhpast/php-tags-bad.lint-test

index 3cb758ad2e65b2bfec3039554094e8c0542b1c07..701b7261af33d606c654ce208a147a3f5c53f079 100644 (file)
@@ -22,9 +22,14 @@ final class ArcanistInlineHTMLXHPASTLinterRule
         continue;
       }
 
+      if (preg_match('/^\s*$/', $html->getValue())) {
+        continue;
+      }
+
       $this->raiseLintAtToken(
         $html,
         pht('PHP files must only contain PHP code.'));
+      break;
     }
   }
 
index d15cefb5a38653acd2867c0a5ba3f0ea33a7b63f..67018229ef6800036b16974df7718bb4b1efae92 100644 (file)
@@ -2,3 +2,4 @@
 
 This shouldn't fatal the parser.
 ~~~~~~~~~~
+disabled:2:1
index 7fb52e73c6d4fcfc8c6507b56c3a20603699900f..dbe6aa1454e4074d600b556a634c21b2fb7773f7 100644 (file)
@@ -3,6 +3,7 @@ garbage garbage
 
 ?>
 ~~~~~~~~~~
+disabled:1:1
 error:1:1
 ~~~~~~~~~~
 garbage garbage