mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Merge branch 'master' into js/invalid-entity-transcoding
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
| constant.js:2:7:2:11 | 1 > 2 | The condition '1 > 2' is always false. |
|
||||
| constant.js:3:7:3:11 | 1 > 0 | The condition '1 > 0' is always true. |
|
||||
| example.js:8:7:8:13 | i < end | The condition 'i < end' is always false. |
|
||||
@@ -0,0 +1 @@
|
||||
Statements/UselessComparisonTest.ql
|
||||
@@ -0,0 +1,4 @@
|
||||
function f() {
|
||||
if (1 > 2) {} else {} // NOT OK - always false
|
||||
if (1 > 0) {} else {} // NOT OK - always true
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
function findValue(values, x, start, end) {
|
||||
let i;
|
||||
for (i = start; i < end; ++i) {
|
||||
if (values[i] === x) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
if (i < end) {
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
function findValue(values, x, start, end) {
|
||||
for (let i = start; i < end; ++i) {
|
||||
if (values[i] === x) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
Reference in New Issue
Block a user