Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Default HHAST lints
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Feb 14, 2019
1 parent bbdd364 commit 73e84ad
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ composer install
hh_client

vendor/bin/hacktest tests/
if !(hhvm --version | grep -q -- -dev); then
hhvm vendor/bin/hhast-lint
fi
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"facebook/difflib": "^1.0.0"
},
"require-dev": {
"hhvm/hhvm-autoload": "^2.0"
"hhvm/hhvm-autoload": "^2.0",
"hhvm/hhast": "^4.0"
}
}
49 changes: 47 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions hhast-lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"roots": [ "src/", "tests/" ]
}
6 changes: 4 additions & 2 deletions src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function assertNotSame(
}

public function assertEquals($expected, $actual, string $message = ''): void {
/* HHAST_IGNORE_ERROR[NoPHPEquality] */
if ($actual == $expected) {
return;
}
Expand Down Expand Up @@ -98,6 +99,7 @@ public function assertNotEquals(
$actual,
string $message = '',
): void {
/* HHAST_IGNORE_ERROR[NoPHPEquality] */
if ($actual != $expected) {
return;
}
Expand Down Expand Up @@ -164,7 +166,7 @@ public function assertNotNull($actual, string $message = '') {
}

public function assertEmpty($actual, string $message = '') {
if (empty($actual) == true) {
if (empty($actual)) {
return;
}
throw new ExpectationFailedException(
Expand All @@ -177,7 +179,7 @@ public function assertEmpty($actual, string $message = '') {
}

public function assertNotEmpty($actual, string $message = '') {
if (empty($actual) != true) {
if (empty($actual)) {
return;
}
throw new ExpectationFailedException(
Expand Down
1 change: 1 addition & 0 deletions src/Constraint/TraversableContains.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function matches($other): bool {
return false;
}
foreach ($other as $element) {
/* HHAST_IGNORE_ERROR[NoPHPEquality] */
if ($element == $this->value) {
return true;
}
Expand Down

0 comments on commit 73e84ad

Please sign in to comment.