Skip to content

Commit ac85d2e

Browse files
committed
Exclude .kt files from java/complex-boolean-expression
1 parent de833d6 commit ac85d2e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

java/ql/src/Violations of Best Practice/Boolean Logic/SimplifyBoolExpr.ql

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,16 @@ class ComparisonOrEquality extends BinaryExpr {
9292

9393
from Expr e, string pattern, string rewrite
9494
where
95-
e.(BoolCompare).simplify(pattern, rewrite)
96-
or
97-
conditionalWithBool(e, pattern, rewrite)
98-
or
99-
e.(LogNotExpr).getExpr().(ComparisonOrEquality).negate(pattern, rewrite)
100-
or
101-
e.(LogNotExpr).getExpr() instanceof LogNotExpr and
102-
pattern = "!!A" and
103-
rewrite = "A"
95+
e.getFile().isJavaSourceFile() and
96+
(
97+
e.(BoolCompare).simplify(pattern, rewrite)
98+
or
99+
conditionalWithBool(e, pattern, rewrite)
100+
or
101+
e.(LogNotExpr).getExpr().(ComparisonOrEquality).negate(pattern, rewrite)
102+
or
103+
e.(LogNotExpr).getExpr() instanceof LogNotExpr and
104+
pattern = "!!A" and
105+
rewrite = "A"
106+
)
104107
select e, "Expressions of the form \"" + pattern + "\" can be simplified to \"" + rewrite + "\"."
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
| SimplifyBoolExpr.kt:8:8:8:16 | ... (value equals) ... | Expressions of the form "A == true" can be simplified to "A". |

0 commit comments

Comments
 (0)