]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Provide coverage for the xhpast $a->b->c parsing bug exposed by tautolinting the
authorepriestley <epriestley@phabricator.com>
Mon, 14 Feb 2011 00:43:32 +0000 (16:43 -0800)
committerepriestley <epriestley@phabricator.com>
Mon, 14 Feb 2011 00:43:32 +0000 (16:43 -0800)
codebase.

Summary:

Test Plan:

Reviewers:

CC:

src/lint/linter/license/ArcanistLicenseLinter.php
src/lint/linter/xhpast/ArcanistXHPASTLinter.php
src/lint/linter/xhpast/__tests__/data/tautological-expressions.lint-test

index 15303c55270b2759d3fbb9be44ed324f9ebc2613..35ea12cabd46398e3265e5bf37225f4c58234bdd 100644 (file)
@@ -62,7 +62,7 @@ abstract class ArcanistLicenseLinter extends ArcanistLinter {
     foreach ($patterns as $pattern) {
       if (preg_match($pattern, $data, $matches)) {
         $expect = rtrim(implode('', array_slice($matches, 1)))."\n".$license;
-        if (rtrim($matches[0]) != rtrim($expect)) {
+        if (trim($matches[0]) != trim($expect)) {
           $this->raiseLintAtOffset(
             0,
             self::LINT_NO_LICENSE_HEADER,
index e9351731df906f9667e62c1ff5f17865302d3470..fe23fffaa43e4f022d45ff1ef5cf27db94da49df 100644 (file)
@@ -153,6 +153,8 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
       '<'   => true,
       '=='  => true,
       '===' => true,
+      '!='  => true,
+      '!==' => true,
       '>='  => true,
       '>'   => true,
     );
index 74ea7bcd781c40344722d773d3599a515e6f1349..4f8c3db25a77f1ffba7c0b64dc86948b289051b7 100644 (file)
@@ -12,6 +12,9 @@ if ($y[2] - $y[2]) {
 if ($x == $y) {
 }
 
+// See xhpast 0.54 -> 0.55.
+return $a->sub->value < $b->sub->value;
+
 ~~~~~~~~~~
 error:3:5
 error:6:5