mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JavaScript: Introduce new query UnclearOperatorPrecedence.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
| tst.js:1:9:1:17 | 0x0A != 0 | The '!=' operator binds more tightly than '&', which may not be obvious in this case. |
|
||||
| tst.js:6:1:6:7 | x !== y | The '!==' operator binds more tightly than '&', which may not be obvious in this case. |
|
||||
| tst.js:10:3:10:6 | b==c | The '==' operator binds more tightly than '&', which may not be obvious in this case. |
|
||||
@@ -0,0 +1 @@
|
||||
Expressions/UnclearOperatorPrecedence.ql
|
||||
@@ -0,0 +1,10 @@
|
||||
x.f() & 0x0A != 0; // NOT OK
|
||||
x.f() & (0x0A != 0); // OK
|
||||
x.f() & 0x0A != 0; // OK
|
||||
x.f() & 0x0A!=0; // OK
|
||||
|
||||
x !== y & 1; // NOT OK
|
||||
|
||||
x > 0 & x < 10; // OK
|
||||
|
||||
a&b==c; // NOT OK
|
||||
1
javascript/ql/test/query-tests/Expressions/UnclearOperatorPrecedence/tst.min.js
vendored
Normal file
1
javascript/ql/test/query-tests/Expressions/UnclearOperatorPrecedence/tst.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
a&b==c; // OK (minified file)
|
||||
Reference in New Issue
Block a user