Skip to content

Commit ae9e9e0

Browse files
committed
JS: Accept some trivial alerts in old queries
1 parent 22991b3 commit ae9e9e0

File tree

11 files changed

+18
-18
lines changed

11 files changed

+18
-18
lines changed

javascript/ql/test/query-tests/Statements/DanglingElse/tst.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function bad1() {
22
if (cond1())
33
if (cond2())
44
return 23;
5-
else
5+
else // $ Alert
66
return 42;
77
}
88

@@ -18,7 +18,7 @@ function bad2() {
1818
if (cond1()) {
1919
if (cond2()) {
2020
return 23;
21-
} else {
21+
} else { // $ Alert
2222
return 42;
2323
}}
2424
}
@@ -37,7 +37,7 @@ function bad3() {
3737
else if (cond2())
3838
if (cond2())
3939
return 42;
40-
else
40+
else // $ Alert
4141
return 42;
4242
}
4343

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function f() {
22
if (someCond())
3-
return;
3+
return; // $ Alert
44
return 42;
55
}

javascript/ql/test/query-tests/Statements/LabelInCase/nonCaseLabelInSwitch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
switch (a) {
22
case 0:
33
case 1:
4-
case2:
4+
case2: // $ Alert
55
f();
66
break;
77
default:

javascript/ql/test/query-tests/Statements/MisleadingIndentationAfterControlStmt/tst.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<script>
55
if (x > 0)
66
x--;
7-
x--;
7+
x--; // $ Alert
88
</script>
99
</head>
1010
<body>

javascript/ql/test/query-tests/Statements/MisleadingIndentationAfterControlStmt/tst.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function bad1() {
22
if (cond())
33
f();
4-
g();
4+
g(); // $ Alert
55
}
66

77
function good1() {
@@ -22,7 +22,7 @@ function bad2() {
2222
f();
2323
else
2424
g();
25-
h();
25+
h(); // $ Alert
2626
}
2727

2828
function good3() {
@@ -34,7 +34,7 @@ function good3() {
3434
function wbad1() {
3535
while (cond())
3636
f();
37-
g();
37+
g(); // $ Alert
3838
}
3939

4040
function wgood1() {

javascript/ql/test/query-tests/Statements/ReturnOutsideFunction/tst.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</script>
77
</head>
88
<body>
9-
<form name="f" onSubmit="validateForm(this);" action="javascript:return false;" method="post" enctype="multipart/form-data">
9+
<form name="f" onSubmit="validateForm(this);" action="javascript:return false;" method="post" enctype="multipart/form-data"> <!-- $ Alert -->
1010
</form>
1111
<form name="g" onsubmit="return validateForm(this);" method="post">
1212
</form>

javascript/ql/test/query-tests/Statements/SuspiciousUnusedLoopIterationVariable/tst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,4 @@ for (const [key, key2, key3, value] of array) {
146146
}
147147

148148
for (const [key, key2, key3, value] of array) {} // $ Alert
149-
for (let i of [1, 2]) {}
149+
for (let i of [1, 2]) {} // $ Alert

javascript/ql/test/query-tests/Statements/UnreachableStatement/tst.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function f() {
44
return 23;
5-
var a = 42;
5+
var a = 42; // $ Alert
66
}
77

88
function g(x) {
@@ -35,7 +35,7 @@ function k() {
3535
}
3636

3737
throw new Error();
38-
f();
38+
f(); // $ Alert
3939

4040
function l(x) {
4141
switch(x) {
@@ -60,7 +60,7 @@ function m(x) {
6060
if (true)
6161
x;
6262
else
63-
y;
63+
y; // $ Alert
6464

6565
function f(){
6666
if (x) {

javascript/ql/test/query-tests/Statements/UselessComparisonTest/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function findValue(values, x, start, end) {
55
return i;
66
}
77
}
8-
if (i < end) {
8+
if (i < end) { // $ Alert
99
return i;
1010
}
1111
return -1;

javascript/ql/test/query-tests/Statements/UselessComparisonTest/tst.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
});
66

77
(function(){
8-
(function (i) { if (i == 100000) return; })(1);
9-
(function f(i) { if (i == 100000) return; f(i+1); })(1);
8+
(function (i) { if (i == 100000) return; })(1); // $ Alert
9+
(function f(i) { if (i == 100000) return; f(i+1); })(1); // $ Alert
1010
});

0 commit comments

Comments
 (0)