Skip to content

Commit 250c295

Browse files
authored
Merge pull request #297 from HaxeCheckstyle/#296
fixes #296
2 parents 71bddfc + 81a5b39 commit 250c295

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

haxelib.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"contributors": [
1717
"adireddy"
1818
],
19-
"releasenote": "enhancement to RedundantModifier check",
20-
"version": "2.1.4",
19+
"releasenote": "fix for #296, added SuppressWarnings for SimplifyBooleanExpression check",
20+
"version": "2.1.5",
2121
"url": "https://github.com/HaxeCheckstyle/haxe-checkstyle",
2222
"dependencies": {
2323

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "checkstyle",
3-
"version": "2.1.4",
3+
"version": "2.1.5",
44
"description": "Automated code analysis ideal for projects that want to enforce a coding standard.",
55
"repository": {
66
"type": "git",

src/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class SimplifyBooleanExpressionCheck extends Check {
2727
], ALL);
2828

2929
for (token in acceptableTokens) {
30+
if (isPosSuppressed(token.pos)) continue;
3031
if (token.is(Kwd(KwdTrue)) || token.is(Kwd(KwdFalse))) checkToken(token);
3132
}
3233
}

test/checks/coding/SimplifyBooleanExpressionCheckTest.hx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class SimplifyBooleanExpressionCheckTest extends CheckTestCase<SimplifyBooleanEx
1717
assertNoMsg(new SimplifyBooleanExpressionCheck(), TEST5);
1818
assertNoMsg(new SimplifyBooleanExpressionCheck(), TEST6);
1919
}
20+
21+
public function testSupressExpression() {
22+
assertNoMsg(new SimplifyBooleanExpressionCheck(), TEST7);
23+
}
2024
}
2125

2226
@:enum
@@ -68,4 +72,13 @@ abstract SimplifyBooleanExpressionCheckTests(String) to String {
6872
if (!bvar) {}
6973
}
7074
}";
75+
76+
var TEST7 = "
77+
abstractAndClass Test {
78+
@SuppressWarnings('checkstyle:SimplifyBooleanExpression')
79+
public static function main() {
80+
var value: Null<Bool> = null;
81+
trace(value == true);
82+
}
83+
}";
7184
}

0 commit comments

Comments
 (0)