Skip to content

Commit e88dac3

Browse files
committed
remove FP for js/redundant-operation
1 parent 3858166 commit e88dac3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

javascript/ql/src/Expressions/RedundantExpression.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ class RedundantIdemnecantOperand extends RedundantOperand {
6464
* arguments to integers. For example, `x&x` is a common idiom for converting `x` to an integer.
6565
*/
6666
class RedundantIdempotentOperand extends RedundantOperand {
67-
RedundantIdempotentOperand() { getParent() instanceof LogicalBinaryExpr }
67+
RedundantIdempotentOperand() {
68+
getParent() instanceof LogicalBinaryExpr and
69+
not exists(UpdateExpr e | e.getParentExpr+() = this)
70+
}
6871
}
6972

7073
/**

javascript/ql/test/query-tests/Expressions/RedundantExpression/tst.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ x == 23 || x == 23;
66
x & x;
77

88
// this may actually be OK, but it's not good style
9-
pop() && pop();
9+
pop() && pop();
10+
11+
foo[bar++] && foo[bar++] // OK

0 commit comments

Comments
 (0)