Skip to content

Commit

Permalink
Merge pull request #297 from HaxeCheckstyle/#296
Browse files Browse the repository at this point in the history
fixes #296
  • Loading branch information
adireddy authored Oct 7, 2016
2 parents 71bddfc + 81a5b39 commit 250c295
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"contributors": [
"adireddy"
],
"releasenote": "enhancement to RedundantModifier check",
"version": "2.1.4",
"releasenote": "fix for #296, added SuppressWarnings for SimplifyBooleanExpression check",
"version": "2.1.5",
"url": "https://github.com/HaxeCheckstyle/haxe-checkstyle",
"dependencies": {

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "checkstyle",
"version": "2.1.4",
"version": "2.1.5",
"description": "Automated code analysis ideal for projects that want to enforce a coding standard.",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class SimplifyBooleanExpressionCheck extends Check {
], ALL);

for (token in acceptableTokens) {
if (isPosSuppressed(token.pos)) continue;
if (token.is(Kwd(KwdTrue)) || token.is(Kwd(KwdFalse))) checkToken(token);
}
}
Expand Down
13 changes: 13 additions & 0 deletions test/checks/coding/SimplifyBooleanExpressionCheckTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class SimplifyBooleanExpressionCheckTest extends CheckTestCase<SimplifyBooleanEx
assertNoMsg(new SimplifyBooleanExpressionCheck(), TEST5);
assertNoMsg(new SimplifyBooleanExpressionCheck(), TEST6);
}

public function testSupressExpression() {
assertNoMsg(new SimplifyBooleanExpressionCheck(), TEST7);
}
}

@:enum
Expand Down Expand Up @@ -68,4 +72,13 @@ abstract SimplifyBooleanExpressionCheckTests(String) to String {
if (!bvar) {}
}
}";

var TEST7 = "
abstractAndClass Test {
@SuppressWarnings('checkstyle:SimplifyBooleanExpression')
public static function main() {
var value: Null<Bool> = null;
trace(value == true);
}
}";
}

0 comments on commit 250c295

Please sign in to comment.