mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
JS: Update OK-style comments to $-style
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// NOT OK
|
||||
while(c){
|
||||
while(c){ // $ Alert
|
||||
switch(c){
|
||||
case "/":
|
||||
break;
|
||||
@@ -8,8 +7,7 @@ while(c){
|
||||
break;
|
||||
}
|
||||
|
||||
// NOT OK
|
||||
function f() {
|
||||
function f() { // $ Alert
|
||||
for (; k < numprecincts;) {
|
||||
var packet = createPacket(resolution, k, l);
|
||||
k++;
|
||||
@@ -17,14 +15,14 @@ function f() {
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
var oHasProps = false;
|
||||
for (var p in o) {
|
||||
oHasProps = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
while(c){
|
||||
if (c === '"')
|
||||
break;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var arr = [1,2,3];
|
||||
|
||||
arr.concat([1,2,3]); // NOT OK!
|
||||
arr.concat([1,2,3]); // $ Alert
|
||||
|
||||
arr.concat(arr); // NOT OK!
|
||||
arr.concat(arr); // $ Alert
|
||||
|
||||
console.log(arr.concat([1,2,3]));
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
// NOT OK
|
||||
function f() {
|
||||
function f() { // $ Alert
|
||||
if (foo())
|
||||
return true;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function g() {
|
||||
if (foo())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function h() {
|
||||
open();
|
||||
try {
|
||||
@@ -21,7 +20,7 @@ function h() {
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function k(x) {
|
||||
switch (x) {
|
||||
case 1:
|
||||
@@ -31,20 +30,20 @@ function k(x) {
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function l() {
|
||||
return 23;
|
||||
alert("Hi");
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function m() {
|
||||
if (foo())
|
||||
return true;
|
||||
throw new Error("not foo!");
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function n() {
|
||||
if (foo())
|
||||
return true;
|
||||
@@ -60,7 +59,7 @@ function foo() {
|
||||
}
|
||||
|
||||
//
|
||||
// OK: dual-use constructor
|
||||
// OK - dual-use constructor
|
||||
function Point(x, y) {
|
||||
if (!(this instanceof Point))
|
||||
return new Point(x, y);
|
||||
@@ -68,7 +67,7 @@ function Point(x, y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// OK: infinite loops
|
||||
// OK - infinite loops
|
||||
function q(n) {
|
||||
for (var i=0;;++i)
|
||||
if (i>2*n)
|
||||
@@ -96,14 +95,12 @@ function t(n) {
|
||||
} while("true");
|
||||
}
|
||||
|
||||
// NOT OK
|
||||
var u = function() {
|
||||
var u = function() { // $ Alert
|
||||
if (foo())
|
||||
return true;
|
||||
};
|
||||
|
||||
// NOT OK
|
||||
function v(b) {
|
||||
function v(b) { // $ Alert
|
||||
if (b)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
// OK
|
||||
|
||||
for (j = i - 1; j >= 0; --j) {
|
||||
}
|
||||
|
||||
// NOT OK
|
||||
for (j = i + 1; j < strLength; --j) {
|
||||
for (j = i + 1; j < strLength; --j) { // $ Alert
|
||||
}
|
||||
|
||||
// NOT OK
|
||||
for (var i = 0, l = c.length; i > l; i ++) {
|
||||
for (var i = 0, l = c.length; i > l; i ++) { // $ Alert
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
for (i=lower-1; i>=0; --i)
|
||||
a[i] = 0;
|
||||
|
||||
// NOT OK
|
||||
for (i=upper+1; i<a.length; --i)
|
||||
for (i=upper+1; i<a.length; --i) // $ Alert
|
||||
a[i] = 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function removeX(string) {
|
||||
let parts = string.split('/');
|
||||
for (let i = 0; i < parts.length; ++i) {
|
||||
if (parts[i] === 'X') parts.splice(i, 1); // NOT OK
|
||||
if (parts[i] === 'X') parts.splice(i, 1); // $ Alert
|
||||
}
|
||||
return parts.join('/');
|
||||
}
|
||||
@@ -10,7 +10,7 @@ function removeXInnerLoop(string, n) {
|
||||
let parts = string.split('/');
|
||||
for (let j = 0; j < n; ++j) {
|
||||
for (let i = 0; i < parts.length; ++i) {
|
||||
if (parts[i] === 'X') parts.splice(i, 1); // NOT OK
|
||||
if (parts[i] === 'X') parts.splice(i, 1); // $ Alert
|
||||
}
|
||||
}
|
||||
return parts.join('/');
|
||||
@@ -21,7 +21,7 @@ function removeXOuterLoop(string, n) {
|
||||
for (let i = 0; i < parts.length; ++i) {
|
||||
for (let j = 0; j < n; ++j) {
|
||||
if (parts[i] === 'X') {
|
||||
parts.splice(i, 1); // NOT OK
|
||||
parts.splice(i, 1); // $ Alert
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ function decrementAfter(string) {
|
||||
let parts = string.split('/');
|
||||
for (let i = 0; i < parts.length; ++i) {
|
||||
if (parts[i] === 'X') {
|
||||
parts.splice(i, 1); // OK
|
||||
parts.splice(i, 1);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ function postDecrementArgument(string) {
|
||||
let parts = string.split('/');
|
||||
for (let i = 0; i < parts.length; ++i) {
|
||||
if (parts[i] === 'X') {
|
||||
parts.splice(i--, 1); // OK
|
||||
parts.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
return parts.join('/');
|
||||
@@ -79,7 +79,7 @@ function spliceAfterLoop(string) {
|
||||
if (parts[i] === 'X') break;
|
||||
}
|
||||
if (parts[i] === 'X') {
|
||||
parts.splice(i, 1); // OK - not inside loop
|
||||
parts.splice(i, 1); // OK - not inside loop
|
||||
}
|
||||
return parts.join('/');
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
for (var i=0; i<10; ++i) {
|
||||
// NOT OK
|
||||
for (var j=i; i>5; --i)
|
||||
for (var j=i; i>5; --i) // $ Alert
|
||||
f(i, j);
|
||||
|
||||
// OK
|
||||
|
||||
for (var k=0; k<i; ++k)
|
||||
f(i, k);
|
||||
}
|
||||
@@ -1,27 +1,25 @@
|
||||
// NOT OK
|
||||
function f(x) {
|
||||
function f(x) { // $ Alert
|
||||
return x = 23;
|
||||
}
|
||||
|
||||
// NOT OK
|
||||
function g() {
|
||||
function g() { // $ Alert
|
||||
var x;
|
||||
return x = 23;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function h() {
|
||||
return x = 23;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function k() {
|
||||
try {
|
||||
return x = 23;
|
||||
} catch(x) {}
|
||||
}
|
||||
|
||||
// OK: the return statement assigns to a global, not the catch variable
|
||||
// OK - the return statement assigns to a global, not the catch variable
|
||||
function l() {
|
||||
try {
|
||||
throw new Error();
|
||||
@@ -29,7 +27,7 @@ function l() {
|
||||
return x = 23;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function m() {
|
||||
var x = 23;
|
||||
return function() {
|
||||
@@ -37,7 +35,7 @@ function m() {
|
||||
};
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function n(x) {
|
||||
global_getter = function() {
|
||||
return x;
|
||||
@@ -45,7 +43,7 @@ function n(x) {
|
||||
return x = 23;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function p() {
|
||||
var x;
|
||||
return {
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
// NOT OK
|
||||
return 42;
|
||||
return 42; // $ Alert
|
||||
@@ -1,5 +1,4 @@
|
||||
// BAD
|
||||
function countOccurrences(xs, p) {
|
||||
function countOccurrences(xs, p) { // $ Alert
|
||||
var count = 0;
|
||||
for (let x of xs)
|
||||
if (p())
|
||||
@@ -7,7 +6,7 @@ function countOccurrences(xs, p) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function countOccurrences(xs, p) {
|
||||
var count = 0;
|
||||
for (let x of xs)
|
||||
@@ -16,7 +15,7 @@ function countOccurrences(xs, p) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function countOccurrences(xs, p) {
|
||||
var count = 0;
|
||||
for (let unused of xs)
|
||||
@@ -25,14 +24,14 @@ function countOccurrences(xs, p) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function isEmpty(o) {
|
||||
for (var x in o)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function getNumElt(o) {
|
||||
var count = 0;
|
||||
for (var x of o)
|
||||
@@ -40,7 +39,7 @@ function getNumElt(o) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function getNumElt(o) {
|
||||
var count = 0;
|
||||
for (var x of o) {
|
||||
@@ -49,7 +48,7 @@ function getNumElt(o) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function getNumElt(o) {
|
||||
var count = 0;
|
||||
for (var x of o)
|
||||
@@ -57,7 +56,7 @@ function getNumElt(o) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function getNumElt(o) {
|
||||
var count = 0;
|
||||
for (var x of o)
|
||||
@@ -65,7 +64,7 @@ function getNumElt(o) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function getNumElt(o) {
|
||||
var count = 0;
|
||||
for (var x of o) {
|
||||
@@ -75,7 +74,7 @@ function getNumElt(o) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function f(o) {
|
||||
for (var p in o)
|
||||
(function() {
|
||||
@@ -83,20 +82,20 @@ function f(o) {
|
||||
})();
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function lastProp(o) {
|
||||
var key;
|
||||
for (key in obj);
|
||||
return key;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function g() {
|
||||
for (var unused in {"toString": null})
|
||||
hasDontEnumBug = false;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function is_empty(obj) {
|
||||
var empty = true;
|
||||
for (var key in obj) {
|
||||
@@ -106,7 +105,7 @@ function is_empty(obj) {
|
||||
return empty;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
function f(objs) {
|
||||
var non_empties = 0;
|
||||
for (var obj in objs) {
|
||||
@@ -118,7 +117,7 @@ function f(objs) {
|
||||
return non_empties;
|
||||
}
|
||||
|
||||
// OK: dead loops are not flagged
|
||||
// OK - dead loops are not flagged
|
||||
function countOccurrencesDead(xs, p) {
|
||||
return;
|
||||
var count = 0;
|
||||
@@ -134,19 +133,17 @@ function countOccurrencesDead(xs, p) {
|
||||
}
|
||||
});
|
||||
|
||||
// NOT OK
|
||||
for (const [key, value] of array) {}
|
||||
for (const [key, value] of array) {} // $ Alert
|
||||
|
||||
// OK: for array-destructurings we only flag the last element
|
||||
// OK - for array-destructurings we only flag the last element
|
||||
for (const [key, value] of array) {
|
||||
console.log(value)
|
||||
}
|
||||
|
||||
// OK: for array-destructurings we only flag the last element
|
||||
// OK - for array-destructurings we only flag the last element
|
||||
for (const [key, key2, key3, value] of array) {
|
||||
console.log(value)
|
||||
}
|
||||
|
||||
// NOT OK
|
||||
for (const [key, key2, key3, value] of array) {}
|
||||
for (const [key, key2, key3, value] of array) {} // $ Alert
|
||||
for (let i of [1, 2]) {}
|
||||
@@ -1,5 +1,5 @@
|
||||
export function foo(x: number): number {
|
||||
let y : A = x;
|
||||
return y;
|
||||
type A = number; // OK.
|
||||
type A = number;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
<object id="container" data="editor/svg-editor.html" onload="addHandlers()"></object>
|
||||
<a href="javascript:addHandlers()">Foo</a>
|
||||
<div onclick="addHandlers()">Click me</div>
|
||||
<div onclick="console.log(addHandlers() + 3)">Click me</div> <!-- NOT OK! -->
|
||||
<div onclick="console.log(addHandlers() + 3)">Click me</div> <!-- $ Alert -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,17 +17,17 @@
|
||||
console.log(returnsValue())
|
||||
console.log(stub())
|
||||
|
||||
console.log(onlySideEffects()); // Not OK!
|
||||
console.log(onlySideEffects()); // $ Alert
|
||||
|
||||
var a = Math.random() > 0.5 ? returnsValue() : onlySideEffects(); // OK! A is never used.
|
||||
var a = Math.random() > 0.5 ? returnsValue() : onlySideEffects(); // OK - A is never used.
|
||||
|
||||
var b = onlySideEffects();
|
||||
console.log(b);
|
||||
|
||||
var c = 42 + (onlySideEffects(), 42); // OK, value is thrown away.
|
||||
var c = 42 + (onlySideEffects(), 42); // OK - value is thrown away.
|
||||
console.log(c);
|
||||
|
||||
var d = 42 + (42, onlySideEffects()); // NOT OK!
|
||||
var d = 42 + (42, onlySideEffects()); // $ Alert
|
||||
console.log(d);
|
||||
|
||||
if (onlySideEffects()) {
|
||||
@@ -42,7 +42,7 @@
|
||||
onlySideEffects: onlySideEffects
|
||||
}
|
||||
|
||||
var e = myObj.onlySideEffects.apply(this, arguments); // NOT OK!
|
||||
var e = myObj.onlySideEffects.apply(this, arguments); // $ Alert
|
||||
console.log(e);
|
||||
|
||||
function onlySideEffects2() {
|
||||
@@ -50,11 +50,11 @@
|
||||
}
|
||||
|
||||
var bothOnlyHaveSideEffects = Math.random() > 0.5 ? onlySideEffects : onlySideEffects2;
|
||||
var f = bothOnlyHaveSideEffects(); // NOT OK!
|
||||
var f = bothOnlyHaveSideEffects(); // $ Alert
|
||||
console.log(f);
|
||||
|
||||
var oneOfEach = Math.random() > 0.5 ? onlySideEffects : returnsValue;
|
||||
var g = oneOfEach(); // OK
|
||||
var g = oneOfEach();
|
||||
console.log(g);
|
||||
|
||||
function alwaysThrows() {
|
||||
@@ -66,28 +66,28 @@
|
||||
throw new Error("Important error!")
|
||||
}
|
||||
|
||||
var h = returnsValue() || alwaysThrows(); // OK!
|
||||
var h = returnsValue() || alwaysThrows();
|
||||
console.log(h);
|
||||
|
||||
function equals(x, y) {
|
||||
return x === y;
|
||||
}
|
||||
|
||||
var foo = [1,2,3].filter(n => {equals(n, 3)}) // NOT OK!
|
||||
var foo = [1,2,3].filter(n => {equals(n, 3)}) // $ Alert
|
||||
console.log(foo);
|
||||
|
||||
import { filter } from 'lodash'
|
||||
var bar = filter([1,2,4], x => { equals(x, 3) } ) // NOT OK!
|
||||
var bar = filter([1,2,4], x => { equals(x, 3) } ) // $ Alert
|
||||
console.log(bar);
|
||||
|
||||
var baz = [1,2,3].filter(n => {n === 3}) // OK
|
||||
var baz = [1,2,3].filter(n => {n === 3})
|
||||
console.log(baz);
|
||||
|
||||
class Deferred {
|
||||
|
||||
}
|
||||
|
||||
new Deferred().resolve(onlySideEffects()); // OK
|
||||
new Deferred().resolve(onlySideEffects());
|
||||
|
||||
Promise.all([onlySideEffects(), onlySideEffects()])
|
||||
})();
|
||||
@@ -104,16 +104,16 @@ class Foo {
|
||||
|
||||
class Bar extends Foo {
|
||||
constructor() {
|
||||
console.log(super()); // OK.
|
||||
console.log(super());
|
||||
}
|
||||
}
|
||||
|
||||
() => {
|
||||
let equals = (x, y) => { return x === y; };
|
||||
|
||||
var foo = [1,2,3].findLastIndex(n => { equals(n, 3); }) // NOT OK
|
||||
var foo = [1,2,3].findLastIndex(n => { equals(n, 3); }) // $ Alert
|
||||
console.log(foo);
|
||||
|
||||
var foo = [1,2,3].findLast(n => { equals(n, 3); }) // NOT OK
|
||||
var foo = [1,2,3].findLast(n => { equals(n, 3); }) // $ Alert
|
||||
console.log(foo);
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@ declare function returnsSomething(): number;
|
||||
|
||||
console.log(returnsSomething());
|
||||
|
||||
console.log(returnsVoid()); // NOT OK!
|
||||
console.log(returnsVoid()); // $ Alert
|
||||
@@ -1,4 +1,4 @@
|
||||
function f() {
|
||||
if (1 > 2) {} else {} // NOT OK - always false
|
||||
if (1 > 0) {} else {} // NOT OK - always true
|
||||
if (1 > 2) {} else {} // $ Alert - always false
|
||||
if (1 > 0) {} else {} // $ Alert - always true
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
function defaultParam(param = 0) {
|
||||
if (param > 0) {} // OK
|
||||
if (param > 0) {}
|
||||
}
|
||||
|
||||
function defaultPattern(obj, arr) {
|
||||
let { prop = 0 } = obj;
|
||||
if (prop > 0) {} // OK
|
||||
if (prop > 0) {}
|
||||
|
||||
let [ elm = 0 ] = arr;
|
||||
if (elm > 0) {} // OK
|
||||
if (elm > 0) {}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ function test() {
|
||||
let x = (function() {
|
||||
if (g) return 5;
|
||||
})();
|
||||
if (x + 1 < 5) {} // OK
|
||||
if (x + 1 < 5) {}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ function test(a, b) {
|
||||
if ((new X())){}
|
||||
|
||||
x = 0n;
|
||||
if (x) // NOT OK
|
||||
if (x) // $ Alert
|
||||
;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ async function awaitFlow(){
|
||||
if (y)
|
||||
v = await f()
|
||||
|
||||
if (v) { // OK
|
||||
if (v) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,29 +57,29 @@ async function awaitFlow(){
|
||||
var unknown = unknownF();
|
||||
if (unknown)
|
||||
return;
|
||||
if (unknown) // NOT OK
|
||||
if (unknown) // $ Alert
|
||||
return;
|
||||
});
|
||||
|
||||
(function (...x) {
|
||||
x || y // NOT OK
|
||||
x || y // $ Alert
|
||||
});
|
||||
|
||||
(function() {
|
||||
function f1(x) {
|
||||
x || y // NOT OK, but whitelisted
|
||||
x || y // $ Alert - but whitelisted
|
||||
}
|
||||
f1(true);
|
||||
|
||||
function f2(x) {
|
||||
while (true)
|
||||
x || y // NOT OK
|
||||
x || y // $ Alert
|
||||
}
|
||||
f2(true);
|
||||
|
||||
function f3(x) {
|
||||
(function(){
|
||||
x || y // NOT OK, but whitelisted
|
||||
x || y // $ Alert - but whitelisted
|
||||
});
|
||||
}
|
||||
f3(true);
|
||||
@@ -91,52 +91,52 @@ async function awaitFlow(){
|
||||
|
||||
(function (x, y) {
|
||||
if (!x) {
|
||||
while (x) { // NOT OK
|
||||
while (x) { // $ Alert
|
||||
f();
|
||||
}
|
||||
while (true) { // OK
|
||||
while (true) {
|
||||
break;
|
||||
}
|
||||
if (true && true) {} // NOT OK
|
||||
if (y && x) {} // NOT OK
|
||||
if (y && (x)) {} // NOT OK
|
||||
do { } while (x); // NOT OK
|
||||
if (true && true) {} // $ Alert
|
||||
if (y && x) {} // $ Alert
|
||||
if (y && (x)) {} // $ Alert
|
||||
do { } while (x); // $ Alert
|
||||
}
|
||||
});
|
||||
|
||||
(function(x,y) {
|
||||
let obj = (x && {}) || y; // OK
|
||||
if ((x && {}) || y) {} // NOT OK
|
||||
let obj = (x && {}) || y;
|
||||
if ((x && {}) || y) {} // $ Alert
|
||||
});
|
||||
|
||||
(function(){
|
||||
function constantFalse1() {
|
||||
return false;
|
||||
}
|
||||
if (constantFalse1()) // OK
|
||||
if (constantFalse1())
|
||||
return;
|
||||
|
||||
function constantFalse2() {
|
||||
return false;
|
||||
}
|
||||
let constantFalse = unknown? constantFalse1 : constantFalse2;
|
||||
if (constantFalse2()) // OK
|
||||
if (constantFalse2())
|
||||
return;
|
||||
|
||||
function constantUndefined() {
|
||||
return undefined;
|
||||
}
|
||||
if (constantUndefined()) // NOT OK
|
||||
if (constantUndefined()) // $ Alert
|
||||
return;
|
||||
|
||||
function constantFalseOrUndefined1() {
|
||||
return unknown? false: undefined;
|
||||
}
|
||||
if (constantFalseOrUndefined1()) // NOT OK
|
||||
if (constantFalseOrUndefined1()) // $ Alert
|
||||
return;
|
||||
|
||||
let constantFalseOrUndefined2 = unknown? constantFalse1 : constantUndefined;
|
||||
if (constantFalseOrUndefined2()) // NOT OK
|
||||
if (constantFalseOrUndefined2()) // $ Alert
|
||||
return;
|
||||
|
||||
});
|
||||
@@ -145,12 +145,12 @@ async function awaitFlow(){
|
||||
function p() {
|
||||
return {};
|
||||
}
|
||||
if (p()) { // NOT OK
|
||||
if (p()) { // $ Alert
|
||||
}
|
||||
var v = p();
|
||||
if (v) { // NOT OK
|
||||
if (v) { // $ Alert
|
||||
}
|
||||
if (v) { // NOT OK, but not detected due to SSA limitations
|
||||
if (v) { // $ Alert - but not detected due to SSA limitations
|
||||
}
|
||||
});
|
||||
|
||||
@@ -160,12 +160,12 @@ async function awaitFlow(){
|
||||
if (e) return e;
|
||||
throw new Error();
|
||||
}
|
||||
if(findOrThrow()){ // NOT OK
|
||||
if(findOrThrow()){ // $ Alert
|
||||
}
|
||||
var v = findOrThrow();
|
||||
if (v) { // NOT OK
|
||||
if (v) { // $ Alert
|
||||
}
|
||||
if (v) { // NOT OK, but not detected due to SSA limitations
|
||||
if (v) { // $ Alert - but not detected due to SSA limitations
|
||||
}
|
||||
});
|
||||
|
||||
@@ -173,14 +173,14 @@ async function awaitFlow(){
|
||||
function f(){ return { v: unkown };}
|
||||
f();
|
||||
var { v } = f();
|
||||
if (v) { // OK
|
||||
if (v) {
|
||||
}
|
||||
});
|
||||
|
||||
(function() {
|
||||
function outer(x) {
|
||||
addEventListener("click", () => {
|
||||
if (!x && something()) { // NOT OK, but whitelisted
|
||||
if (!x && something()) { // $ Alert - but whitelisted
|
||||
something();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,90 +11,90 @@ function getLastLine(input) {
|
||||
function f1() {
|
||||
return false
|
||||
}
|
||||
if(f1()){} // OK, whitelisted
|
||||
if(f1()){} // OK - whitelisted
|
||||
|
||||
function f2() {
|
||||
return false
|
||||
}
|
||||
if(!f2()){} // OK, whitelisted
|
||||
if(!f2()){} // OK - whitelisted
|
||||
|
||||
function f3() {
|
||||
return false
|
||||
}
|
||||
if(!!f3()){} // OK, whitelisted
|
||||
if(!!f3()){} // OK - whitelisted
|
||||
|
||||
function f4() {
|
||||
return false
|
||||
}
|
||||
if(f4() || o.p){} // OK, whitelisted
|
||||
if(f4() || o.p){} // OK - whitelisted
|
||||
|
||||
function f5() {
|
||||
return false
|
||||
}
|
||||
var v5 = f5();
|
||||
if(v5){} // OK, whitelisted
|
||||
if(v5){} // OK - whitelisted
|
||||
|
||||
function f6() {
|
||||
return false
|
||||
}
|
||||
var v6 = f6();
|
||||
if(!!v6){} // OK, whitelisted
|
||||
if(!!v6){} // OK - whitelisted
|
||||
})();
|
||||
|
||||
(function tooGeneralFunctions(){
|
||||
function f1(x) {
|
||||
if(x){} // OK, whitelisted
|
||||
if(x){} // OK - whitelisted
|
||||
}
|
||||
f1(undefined);
|
||||
f1({});
|
||||
|
||||
function f2(x) {
|
||||
if(x){} // OK, whitelisted
|
||||
if(x){} // OK - whitelisted
|
||||
}
|
||||
f2(undefined);
|
||||
|
||||
function f3(x1) {
|
||||
var x2 = x1;
|
||||
if(x2){} // NOT OK, not whitelisted
|
||||
if(x2){} // $ Alert - not whitelisted
|
||||
}
|
||||
f3(undefined);
|
||||
|
||||
function f4(x) {
|
||||
if(x && o.p){} // OK, whitelisted
|
||||
if(x && o.p){} // OK - whitelisted
|
||||
}
|
||||
f4(undefined);
|
||||
|
||||
function f5(x, y) {
|
||||
var xy = o.q? x: y;
|
||||
if(xy && o.p){} // NOT OK, not whitelisted
|
||||
if(xy && o.p){} // $ Alert - not whitelisted
|
||||
}
|
||||
f5(undefined, undefined);
|
||||
|
||||
function f6(x) {
|
||||
if(!x){} // OK, whitelisted
|
||||
if(!x){} // OK - whitelisted
|
||||
}
|
||||
f6(true);
|
||||
|
||||
function f7(x) {
|
||||
if(!!x){} // OK, whitelisted
|
||||
if(!!x){} // OK - whitelisted
|
||||
}
|
||||
f7(true);
|
||||
|
||||
function f8(x, y) {
|
||||
var xy = x || y;
|
||||
if(xy){} // NOT OK, not whitelisted
|
||||
if(xy){} // $ Alert - not whitelisted
|
||||
}
|
||||
f8(undefined, undefined);
|
||||
|
||||
function f9(x, y) {
|
||||
var xy = !x || y;
|
||||
if(xy){} // OK, whitelisted
|
||||
if(xy){} // OK - whitelisted
|
||||
}
|
||||
f9(undefined, undefined);
|
||||
|
||||
function f10(x, y) {
|
||||
var xy = !!x || y;
|
||||
if(xy){} // NOT OK, not whitelisted
|
||||
if(xy){} // $ Alert - not whitelisted
|
||||
}
|
||||
f10(undefined, undefined);
|
||||
|
||||
@@ -103,7 +103,7 @@ function getLastLine(input) {
|
||||
(function(){
|
||||
function g(p) {
|
||||
return function() {
|
||||
if (p) { // OK, whitelisted
|
||||
if (p) { // OK - whitelisted
|
||||
g(p);
|
||||
}
|
||||
};
|
||||
@@ -111,7 +111,7 @@ function getLastLine(input) {
|
||||
|
||||
function f(p = false) {
|
||||
return function() {
|
||||
if (p) { // OK, whitelisted
|
||||
if (p) { // OK - whitelisted
|
||||
f(p);
|
||||
}
|
||||
};
|
||||
@@ -119,7 +119,7 @@ function getLastLine(input) {
|
||||
|
||||
function h(p = false) {
|
||||
(function() {
|
||||
if (p) { // OK, whitelisted
|
||||
if (p) { // OK - whitelisted
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user