Skip to content

Commit 6e464f3

Browse files
committed
JS: Update inline expectations
1 parent 5ff82b7 commit 6e464f3

File tree

325 files changed

+1252
-1252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+1252
-1252
lines changed

javascript/ql/test/query-tests/AngularJS/DoubleCompilation/bad.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ angular.module('app').directive('addMouseover', function($compile) {
1111

1212
attrs.$set('addMouseover', null); // To stop infinite compile loop
1313
element.append(newEl);
14-
$compile(element)(scope); // Double compilation
14+
$compile(element)(scope); // $ TODO-SPURIOUS: Alert - Double compilation
1515
}
1616
}
1717
})

javascript/ql/test/query-tests/AngularJS/DuplicateDependency/duplicates.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function(){
2-
function f(){}
3-
f.$inject = ['dup5', 'dup5']; // $ Alert
2+
function f(){} // $ TODO-SPURIOUS: Alert
3+
f.$inject = ['dup5', 'dup5']; // $ TODO-MISSING: Alert
44
angular.module('myModule', [])
55
.run(['dup1a', 'dup1a', function(dup1a, dup1a){}]) // OK - flagged by js/duplicate-parameter-name
66
.run(['dup2a', 'dup2a', function(dup2a, dup2b){}]) // $ Alert
@@ -12,7 +12,7 @@
1212
.run(['notDup8a', 'notDup8b', function(notDup8a, notDup8b){}])
1313
.run(['notDup9a', 'notDup9b', function(notDup9c, notDup9d){}])
1414
.run(['dup10a', 'dup10a', 'dup10a', function(dup10a, dup10a, dup10a){}]) // OK - flagged by js/duplicate-parameter-name
15-
.run(['dup11a', 'dup11a', function(dup11a, dup11b){ // $ Alert - alert formatting for multi-line function
15+
.run(['dup11a', 'dup11a', function(dup11a, dup11b){ // $ TODO-MISSING: Alert - alert formatting for multi-line function
1616
}])
1717
;
1818
})();

javascript/ql/test/query-tests/AngularJS/RepeatedInjection/repeated-injection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
angular.module('app9').controller('controller9', ['name', function inline9(name){}]);
3232

33-
function $Injected10(name){ // $ Alert - alert formatting for multi-line function
33+
function $Injected10(name){ // $ TODO-MISSING: Alert - alert formatting for multi-line function
3434
}
3535
$Injected10.$inject = ['name'];
3636
angular.module('app10').controller('controller10', ['name', $Injected10]);

javascript/ql/test/query-tests/AngularJS/UnusedAngularDependency/unused-angular-dependency.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.run(f2)
1616
.run(["used2", "unused9", function(used2) {}]) // $ Alert
1717
.run(["unused10", "unused11", function() {}]) // $ Alert
18-
.run(["used2", "unused12", function(used2) { // $ Alert - alert formatting for multi-line function
18+
.run(["used2", "unused12", function(used2) { // $ TODO-MISSING: Alert - alert formatting for multi-line function
1919
}])
2020
;
2121
})();

javascript/ql/test/query-tests/AngularJS/UseNgSrc/tst.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
</head>
66
<body>
77
<!-- BAD -->
8-
<a href="{{help_url}}">Help</a>
8+
<a href="{{help_url}}">Help</a> // $ TODO-SPURIOUS: Alert
99
<picture>
10-
<source media="(min-width: 650px)" srcset="#/resources/pics-large/{{item._id}}">
11-
<img src="#/resources/pics-default/{{item._id}}">
10+
<source media="(min-width: 650px)" srcset="#/resources/pics-large/{{item._id}}"> // $ TODO-SPURIOUS: Alert
11+
<img src="#/resources/pics-default/{{item._id}}"> // $ TODO-SPURIOUS: Alert
1212
</picture>
1313
<!-- GOOD -->
1414
<a ng-href="{{help_url}}">Help</a>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div x-ng-bind="I am here to make this seem like an AngularJS template">
22
<!-- BAD -->
3-
<a href="{{help_url}}">Help</a>
3+
<a href="{{help_url}}">Help</a> // $ TODO-SPURIOUS: Alert
44
</div>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<body ng-app>
22
<!-- BAD -->
3-
<a href="{{help_url}}">Help</a>
3+
<a href="{{help_url}}">Help</a> // $ TODO-SPURIOUS: Alert
44
</body>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<html>
22
<body>
33
<ul>
4-
<li id="first">First element
4+
<li id="first">First element // $ TODO-SPURIOUS: Alert[js/duplicate-html-id]
55
<li id="first">Second element
66
</ul>
77
</body>

javascript/ql/test/query-tests/DOM/HTML/AmbiguousIdAttributeGood.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<li id="second">Second element</li>
66
<li id="{{templated-id}}">Templated id</li> <!-- ignored -->
77
<li id="{{templated-id}}">Templated id</li> <!-- ignored -->
8-
<li id="invalid id">Invalid id</li> <!-- reported by another query -->
9-
<li id="invalid id">Invalid id</li> <!-- reported by another query -->
8+
<li id="invalid id">Invalid id</li> <!-- reported by another query --> // $ TODO-SPURIOUS: Alert[js/malformed-html-id]
9+
<li id="invalid id">Invalid id</li> <!-- reported by another query --> // $ TODO-SPURIOUS: Alert[js/malformed-html-id]
1010
<li class="duplicate-class">duplicate-class</li>
1111
<li class="duplicate-class">duplicate-class</li>
1212
</ul>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<ul>
2-
<li id="first">First element
2+
<li id="first">First element // $ TODO-SPURIOUS: Alert[js/duplicate-html-id]
33
<li id="first">Second element
44
</ul>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<a href="http://semmle.com" href="https://semmle.com">Semmle</a>
1+
<a href="http: // $ TODO-SPURIOUS: Alert[js/conflicting-html-attribute] - semmle.com" href="https://semmle.com">Semmle</a>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<a href="https://semmle.com" href="https://semmle.com">Semmle</a>
1+
<a href="https: // $ TODO-SPURIOUS: Alert[js/duplicate-html-attribute] - semmle.com" href="https://semmle.com">Semmle</a>
22

33
<td {% foo %} {% foo %}></td>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<div id="heading important">An important heading</div>
1+
<div id="heading important">An important heading</div> // $ TODO-SPURIOUS: Alert[js/malformed-html-id]

javascript/ql/test/query-tests/DOM/HTML/tst.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
var div1 = <div id="theDiff"></div>;
33
var div2 = <div id="theDiff"></div>;
44

5-
<a href="http://semmle.com" href="https://semmle.com">Semmle</a>; // $ Alert
5+
<a href="http: // $ Alert TODO-MISSING: Alert[js/duplicate-html-attribute] Alert[js/malformed-html-id] Alert[js/duplicate-html-id]
66
7-
<a href="https://semmle.com" href="https://semmle.com">Semmle</a>; // $ Alert
7+
<a href="https: // $ Alert TODO-MISSING: Alert[js/malformed-html-id] Alert[js/duplicate-html-id] Alert[js/conflicting-html-attribute]
88

9-
<div id=""></div>; // $ Alert
10-
<div id="a b"></div>;
9+
<div id=""></div>; // $ Alert TODO-MISSING: Alert[js/duplicate-html-attribute] Alert[js/duplicate-html-id] Alert[js/conflicting-html-attribute]
10+
<div id="a b"></div>; // $ TODO-SPURIOUS: Alert[js/malformed-html-id]
1111

12-
<a href="http://semmle.com" href={someValue()}>Semmle</a>; // $ Alert
12+
<a href="http: // $ Alert TODO-MISSING: Alert[js/duplicate-html-attribute] Alert[js/malformed-html-id] Alert[js/duplicate-html-id]
1313
1414
1515
<div id={someOtherValue()}></div>;
1616
17-
var div3 = <div><div id="theDiff"></div><div id="theDiff"></div></div>; // $ Alert
17+
var div3 = <div><div id="theDiff"></div><div id="theDiff"></div></div>; // $ Alert TODO-MISSING: Alert[js/duplicate-html-attribute] Alert[js/malformed-html-id] Alert[js/conflicting-html-attribute]
1818

19-
var div4 = <div id="theDiff" id="theDiff"></div>; // $ Alert
19+
var div4 = <div id="theDiff" id="theDiff"></div>; // $ Alert TODO-MISSING: Alert[js/malformed-html-id] Alert[js/duplicate-html-id] Alert[js/conflicting-html-attribute]
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
window.setTimeout(";");
2-
setInterval("update();");
1+
window.setTimeout(";"); // $ TODO-SPURIOUS: Alert
2+
setInterval("update();"); // $ TODO-SPURIOUS: Alert
33
setInterval(update);
4-
document.write("alert('Hi!');");
5-
window.execScript("debugger;");
4+
document.write("alert('Hi!');"); // $ TODO-SPURIOUS: Alert
5+
window.execScript("debugger;"); // $ TODO-SPURIOUS: Alert
66

77
(function(global) {
88
var document = global.document;
9-
document.write("undefined = 2");
9+
document.write("undefined = 2"); // $ TODO-SPURIOUS: Alert
1010
})(this);

javascript/ql/test/query-tests/DOM/TargetBlank/tst.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ <h1>OK, because of constant prefix</h1>
2020
<a data-ng-href="https://example.com/{{X}}" target="_blank">Example</a>
2121

2222
<h1>NOT OK, because of dynamic URL</h1>
23-
<a href="http://example.com{{X}}" target="_blank">Example</a>
24-
<a href="{{target}}" target="_blank">Example</a>
23+
<a href="http: // $ TODO-SPURIOUS: Alert - example.com{{X}}" target="_blank">Example</a>
24+
<a href="{{target}}" target="_blank">Example</a> // $ TODO-SPURIOUS: Alert
2525
<a href="{{target}}" target="_blank">
2626
Example
2727
</a>
2828

2929
<h1>NOT OK: mailto is not fine.</h1>
30-
<a target="_blank" href="mailto:{{var:mail}}">mail somone</a>
30+
<a target="_blank" href="mailto:{{var:mail}}">mail somone</a> // $ TODO-SPURIOUS: Alert
3131

3232
<h1>OK: template elements after # or ? are fine.</h1>
3333
<a href="file.extension?#[% row.href %]" target="_blank">Example</a>

javascript/ql/test/query-tests/DOM/TargetBlank/tst.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ var o = { rel: "noopener noreferrer "};
1515
<a data-ng-href="https://example.com" target="_blank">Example</a>;
1616

1717
<a href="{{X}}" target="_blank">Example</a>; // $ Alert - because of dynamic URL
18-
<a href="{{X}}" target="_blank" rel="nopoener">Example</a>;
19-
<a data-ng-href="{{X}}" target="_blank">Example</a>;
18+
<a href="{{X}}" target="_blank" rel="nopoener">Example</a>; // $ TODO-SPURIOUS: Alert
19+
<a data-ng-href="{{X}}" target="_blank">Example</a>; // $ TODO-SPURIOUS: Alert
2020

2121
function f() {
2222

javascript/ql/test/query-tests/Declarations/ArgumentsRedefined/tst.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ function g(x, y) {
88
}
99

1010
(function (){
11-
for ([arguments] of o);
12-
for ([arguments = 4] of o);
11+
for ([arguments] of o); // $ TODO-SPURIOUS: Alert
12+
for ([arguments = 4] of o); // $ TODO-SPURIOUS: Alert
1313
});

javascript/ql/test/query-tests/Declarations/AssignmentToConst/tst.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ const s = "hi";
1818

1919
(function (){
2020
const c = null;
21-
for ([ c ] of o);
21+
for ([ c ] of o); // $ TODO-SPURIOUS: Alert
2222
});

javascript/ql/test/query-tests/Declarations/ConflictingFunctions/tst.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function f(x) {
22
if (x > 23) {
3-
function g() {
3+
function g() { // $ TODO-SPURIOUS: Alert
44
return 42;
55
}
66
} else {
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
onmessage = function() { console.log("Got a message!"); };
22

3-
onmissage = function() { console.log("How did that happen?"); };
3+
onmissage = function() { console.log("How did that happen?"); }; // $ TODO-SPURIOUS: Alert

javascript/ql/test/query-tests/Declarations/DeadStoreOfLocal/tst.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ function k(data) {
4040
}
4141

4242
function l() {
43-
var x = 23;
43+
var x = 23; // $ TODO-SPURIOUS: Alert
4444
x = 42;
4545
return x;
4646
}
4747

4848
function m() {
49-
var x = 23, y;
49+
var x = 23, y; // $ TODO-SPURIOUS: Alert
5050
x = 42, y = x+14;
5151
return x+y;
5252
}
@@ -127,7 +127,7 @@ function v() {
127127
}
128128

129129
!function(o) {
130-
var {x} = o;
130+
var {x} = o; // $ TODO-SPURIOUS: Alert
131131
x = 42;
132132
return x;
133133
}
@@ -157,7 +157,7 @@ function v() {
157157
});
158158

159159
(function() {
160-
let [x] = [0], // OK - but flagged due to destructuring limitations
160+
let [x] = [0], // $ TODO-SPURIOUS: Alert - OK - but flagged due to destructuring limitations
161161
y = 0;
162162
x = 42;
163163
y = 87;
@@ -167,7 +167,7 @@ function v() {
167167

168168
(function() {
169169
if (something()) {
170-
var nSign = foo;
170+
var nSign = foo; // $ TODO-SPURIOUS: Alert
171171
} else {
172172
console.log(nSign);
173173
}

javascript/ql/test/query-tests/Declarations/DeadStoreOfLocal/tst2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ function f(event) {
2424
function g() {
2525
let x = 23; // $ Alert
2626
{
27-
x = 42;
27+
x = 42; // $ TODO-SPURIOUS: Alert
2828
}
2929
}

javascript/ql/test/query-tests/Declarations/DeadStoreOfProperty/tst.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
};
112112

113113
var o = { set setter(value) { } };
114-
o.setter = 42; // probably OK, but still flagged - it seems fishy
114+
o.setter = 42; // $ TODO-SPURIOUS: Alert - probably OK, but still flagged - it seems fishy
115115
o.setter = 87;
116116

117117
var o = {};

javascript/ql/test/query-tests/Declarations/DeclBeforeUse/jslint.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
/*global: z*/ // also not a proper global declaration
44
w;
55
x;
6-
y; // $ Alert
6+
y; // $ TODO-MISSING: Alert
77
z; // $ Alert
88
var x, y, z;

javascript/ql/test/query-tests/Declarations/DefaultArgumentReferencesNestedFunction/tst.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function f(x, y = defaultVal(x)) {
1+
function f(x, y = defaultVal(x)) { // $ TODO-SPURIOUS: Alert
22
function defaultVal(x) {
33
return x+19;
44
}

javascript/ql/test/query-tests/Declarations/MissingThisQualifier/namespaces-uses.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Top {
1919
topNamespaceFunction();
2020
}
2121
childNamespaceFunction(){
22-
childNamespaceFunction(); // $ Alert - but not flagged since the namespace resolution is ignored
22+
childNamespaceFunction(); // $ TODO-MISSING: Alert - but not flagged since the namespace resolution is ignored
2323
}
2424
}
2525
}

javascript/ql/test/query-tests/Declarations/MissingVarDecl/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ function p() {
5151
}
5252

5353
function q() {
54-
var x; // $ Alert
55-
y = 23,
54+
var x; // $ TODO-MISSING: Alert
55+
y = 23, // $ TODO-SPURIOUS: Alert
5656
z = y+19;
5757
}
5858

@@ -63,7 +63,7 @@ function r() {
6363
}
6464

6565
(function() {
66-
for ([ unresolvable ] of o) {
66+
for ([ unresolvable ] of o) { // $ TODO-SPURIOUS: Alert
6767
unresolvable;
6868
}
6969
});

javascript/ql/test/query-tests/Declarations/MissingVarDecl/tst3.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ function sc_alert(i) {
44
}
55

66
function f(o) {
7-
for({x, ...rest} of o)
7+
for({x, ...rest} of o) // $ TODO-SPURIOUS: Alert
88
console.log(x in rest);
99
}

javascript/ql/test/query-tests/Declarations/RedeclaredVariable/sameNameForFunctionAndVariable.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
var fun1;
2-
function fun1() {
2+
function fun1() { // $ TODO-SPURIOUS: Alert
33
}
44

55
function fun2() {
66
}
7-
var fun2;
7+
var fun2; // $ TODO-SPURIOUS: Alert
88

99
var fun3;
1010
var fun = function fun3() {

javascript/ql/test/query-tests/Declarations/RedeclaredVariable/tst4.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ function k() {
1919
y = 2; // $ Alert
2020
}
2121

22-
var g;
22+
var g; // $ TODO-SPURIOUS: Alert

javascript/ql/test/query-tests/Declarations/UniqueParameterNames/tst.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function f(
2-
x,
2+
x, // $ TODO-SPURIOUS: Alert
33
x, // $ Alert
4-
\u0078 // $ Alert
4+
\u0078 // $ TODO-MISSING: Alert
55
) { return; }
66

77
this.addPropertyListener(prop.name, function(_, _, _, a) {

javascript/ql/test/query-tests/Declarations/UniquePropertyNames/tst2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var o = {
77

88
setX: function(x) {
99
this.x = x;
10-
},
10+
}, // $ TODO-SPURIOUS: Alert
1111

1212
getX: function() {
1313
return this.x;

javascript/ql/test/query-tests/Declarations/UnstableCyclicImport/ExampleBad/services.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AudioService } from './audio'
22
import { StoreService } from './store';
33

44
export const services = [
5-
AudioService,
5+
AudioService, // $ TODO-SPURIOUS: Alert
66
StoreService
77
];
88

javascript/ql/test/query-tests/Declarations/UnusedParameter/tst2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function K(x, y) {
2525
* @param {*} x the first argument
2626
* @param {*} y the second argument
2727
*/
28-
function K(x, y) {
28+
function K(x, y) { // $ TODO-SPURIOUS: Alert
2929
return y;
3030
}
3131

0 commit comments

Comments
 (0)