mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
JS: Add: Use of returnless function support for findLast and findLastIndex
This commit is contained in:
@@ -114,7 +114,7 @@ predicate hasNonVoidCallbackMethod(string name) {
|
||||
name =
|
||||
[
|
||||
"every", "filter", "find", "findIndex", "flatMap", "map", "reduce", "reduceRight", "some",
|
||||
"sort"
|
||||
"sort", "findLastIndex", "findLast"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -7,3 +7,5 @@
|
||||
| tst.js:53:10:53:34 | bothOnl ... fects() | the $@ does not return anything, yet the return value is used. | tst.js:48:2:50:5 | functio ... )\\n } | function onlySideEffects2 |
|
||||
| tst.js:76:12:76:46 | [1,2,3] ... n, 3)}) | the $@ does not return anything, yet the return value from the call to filter is used. | tst.js:76:27:76:45 | n => {equals(n, 3)} | callback function |
|
||||
| tst.js:80:12:80:50 | filter( ... 3) } ) | the $@ does not return anything, yet the return value from the call to filter is used. | tst.js:80:28:80:48 | x => { ... x, 3) } | callback function |
|
||||
| tst.js:114:12:114:56 | [1,2,3] ... 3); }) | the $@ does not return anything, yet the return value from the call to findLastIndex is used. | tst.js:114:34:114:55 | n => { ... , 3); } | callback function |
|
||||
| tst.js:117:12:117:51 | [1,2,3] ... 3); }) | the $@ does not return anything, yet the return value from the call to findLast is used. | tst.js:117:29:117:50 | n => { ... , 3); } | callback function |
|
||||
|
||||
@@ -111,9 +111,9 @@ class Bar extends Foo {
|
||||
() => {
|
||||
let equals = (x, y) => { return x === y; };
|
||||
|
||||
var foo = [1,2,3].findLastIndex(n => { equals(n, 3); }) // NOT OK -- Currently not flagged, but should be.
|
||||
var foo = [1,2,3].findLastIndex(n => { equals(n, 3); }) // NOT OK
|
||||
console.log(foo);
|
||||
|
||||
var foo = [1,2,3].findLast(n => { equals(n, 3); }) // NOT OK -- Currently not flagged, but should be.
|
||||
var foo = [1,2,3].findLast(n => { equals(n, 3); }) // NOT OK
|
||||
console.log(foo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user