Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix false negative, <= and >= in NoEmptyStatementsLinter
  • Loading branch information
lexidor committed May 24, 2023
commit d2a9dfc06b062a41499dfca191e9ad6414333182
4 changes: 1 addition & 3 deletions src/Linters/NoEmptyStatementsLinter.hack
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ final class NoEmptyStatementsLinter extends AutoFixingASTLinter {
/**
* Returns whether the given token is an assignment operator.
*
* This list is all the types returned from ExpressionStatement::getOperator
* This list is all the types returned from BinaryExpression::getOperator
* that include "Equal" and are not comparison operators (==, >=, etc.);
*/
private function isAssignmentOperator(Token $op): bool {
Expand All @@ -140,9 +140,7 @@ final class NoEmptyStatementsLinter extends AutoFixingASTLinter {
$op is CaratEqualToken ||
$op is DotEqualToken ||
$op is EqualToken ||
$op is GreaterThanEqualToken ||
$op is GreaterThanGreaterThanEqualToken ||
$op is LessThanEqualToken ||
$op is LessThanLessThanEqualToken ||
$op is MinusEqualToken ||
$op is PercentEqualToken ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@
"blame_pretty": " 3 < 4;\n",
"description": "This statement includes an expression that has no effect"
},
{
"blame": " 3 <= 4;\n",
"blame_pretty": " 3 <= 4;\n",
"description": "This statement includes an expression that has no effect"
},
{
"blame": " 3 > 4;\n",
"blame_pretty": " 3 > 4;\n",
"description": "This statement includes an expression that has no effect"
},
{
"blame": " 3 >= 4;\n",
"blame_pretty": " 3 >= 4;\n",
"description": "This statement includes an expression that has no effect"
}
]