1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-10-23 17:18:50 +02:00

Improve the "inline HTML" linter rule

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
This commit is contained in:
Joshua Spence 2015-08-19 15:34:43 +10:00 committed by Joshua Spence
parent fe8ed2a6f8
commit 4404e66735
3 changed files with 7 additions and 0 deletions

View file

@ -22,9 +22,14 @@ final class ArcanistInlineHTMLXHPASTLinterRule
continue; continue;
} }
if (preg_match('/^\s*$/', $html->getValue())) {
continue;
}
$this->raiseLintAtToken( $this->raiseLintAtToken(
$html, $html,
pht('PHP files must only contain PHP code.')); pht('PHP files must only contain PHP code.'));
break;
} }
} }

View file

@ -2,3 +2,4 @@
This shouldn't fatal the parser. This shouldn't fatal the parser.
~~~~~~~~~~ ~~~~~~~~~~
disabled:2:1

View file

@ -3,6 +3,7 @@ garbage garbage
?> ?>
~~~~~~~~~~ ~~~~~~~~~~
disabled:1:1
error:1:1 error:1:1
~~~~~~~~~~ ~~~~~~~~~~
garbage garbage garbage garbage