mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
JS: sharpen the js/trivial-conditional whitelist
This commit is contained in:
@@ -109,4 +109,35 @@ async function awaitFlow(){
|
||||
if ((x && {}) || y) {} // NOT OK
|
||||
});
|
||||
|
||||
(function(){
|
||||
function constantFalse1() {
|
||||
return false;
|
||||
}
|
||||
if (constantFalse1()) // OK
|
||||
return;
|
||||
|
||||
function constantFalse2() {
|
||||
return false;
|
||||
}
|
||||
let constantFalse = unknown? constantFalse1 : constantFalse2;
|
||||
if (constantFalse2()) // OK
|
||||
return;
|
||||
|
||||
function constantUndefined() {
|
||||
return undefined;
|
||||
}
|
||||
if (constantUndefined()) // NOT OK
|
||||
return;
|
||||
|
||||
function constantFalseOrUndefined1() {
|
||||
return unknown? false: undefined;
|
||||
}
|
||||
if (constantFalseOrUndefined1()) // NOT OK
|
||||
return;
|
||||
|
||||
let constantFalseOrUndefined2 = unknown? constantFalse1 : constantUndefined;
|
||||
if (constantFalseOrUndefined2()) // NOT OK
|
||||
return;
|
||||
|
||||
});
|
||||
// semmle-extractor-options: --experimental
|
||||
|
||||
Reference in New Issue
Block a user