mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
JS: Accept trivial test changes
This adds Alert annotations for alerts that seem intentional by the test but has not been annotated with 'NOT OK', or the comment was in the wrong place. In a few cases I included 'Source' expectations to make it easier to see what happened. Other 'Source' expectations will be added in bulk a later commit.
This commit is contained in:
@@ -11,7 +11,7 @@ angular.module('app').directive('addMouseover', function($compile) {
|
||||
|
||||
attrs.$set('addMouseover', null); // To stop infinite compile loop
|
||||
element.append(newEl);
|
||||
$compile(element)(scope); // Double compilation
|
||||
$compile(element)(scope); // $ Alert - Double compilation
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<body>
|
||||
<a href="{{help_url}}">Help</a> <!-- $ Alert -->
|
||||
<picture>
|
||||
<source media="(min-width: 650px)" srcset="#/resources/pics-large/{{item._id}}">
|
||||
<img src="#/resources/pics-default/{{item._id}}">
|
||||
<source media="(min-width: 650px)" srcset="#/resources/pics-large/{{item._id}}"> <!-- $ Alert -->
|
||||
<img src="#/resources/pics-default/{{item._id}}"> <!-- $ Alert -->
|
||||
</picture>
|
||||
|
||||
<a ng-href="{{help_url}}">Help</a>
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
#select
|
||||
| AmbiguousIdAttribute.html:4:5:4:14 | id=first | This element has the same id as $@. | AmbiguousIdAttribute.html:5:5:5:14 | id=first | another element |
|
||||
| AmbiguousIdAttribute_fragment.html:2:7:2:16 | id=first | This element has the same id as $@. | AmbiguousIdAttribute_fragment.html:3:7:3:16 | id=first | another element |
|
||||
| tst.js:17:22:17:33 | id="theDiff" | This element has the same id as $@. | tst.js:17:46:17:57 | id="theDiff" | another element |
|
||||
testFailures
|
||||
| AmbiguousIdAttribute.html:4:5:4:14 | This element has the same id as $@. | Unexpected result: Alert |
|
||||
| AmbiguousIdAttribute_fragment.html:2:7:2:16 | This element has the same id as $@. | Unexpected result: Alert |
|
||||
| tst.js:5:67:5:76 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:7:68:7:77 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:9:20:9:29 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:12:60:12:69 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:19:51:19:60 | // $ Alert | Missing result: Alert |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<ul>
|
||||
<li id="first">First element
|
||||
<li id="first">First element <!-- $ Alert[js/duplicate-html-id] -->
|
||||
<li id="first">Second element
|
||||
</ul>
|
||||
</body>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<li id="second">Second element</li>
|
||||
<li id="{{templated-id}}">Templated id</li> <!-- ignored -->
|
||||
<li id="{{templated-id}}">Templated id</li> <!-- ignored -->
|
||||
<li id="invalid id">Invalid id</li> <!-- reported by another query -->
|
||||
<li id="invalid id">Invalid id</li> <!-- reported by another query -->
|
||||
<li id="invalid id">Invalid id</li> <!-- $ Alert[js/malformed-html-id] -->
|
||||
<li id="invalid id">Invalid id</li> <!-- $ Alert[js/malformed-html-id] -->
|
||||
<li class="duplicate-class">duplicate-class</li>
|
||||
<li class="duplicate-class">duplicate-class</li>
|
||||
</ul>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<ul>
|
||||
<li id="first">First element
|
||||
<li id="first">First element <!-- $ Alert[js/duplicate-html-id] -->
|
||||
<li id="first">Second element
|
||||
</ul>
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#select
|
||||
| ConflictingAttributes.html:1:4:1:27 | href=http://semmle.com | This attribute has the same name as $@ of the same element, but a different value. | ConflictingAttributes.html:1:29:1:53 | href=https://semmle.com | another attribute |
|
||||
| tst.js:5:4:5:27 | href="h ... le.com" | This attribute has the same name as $@ of the same element, but a different value. | tst.js:5:29:5:53 | href="h ... le.com" | another attribute |
|
||||
| tst.js:12:4:12:27 | href="h ... le.com" | This attribute has the same name as $@ of the same element, but a different value. | tst.js:12:29:12:46 | href={someValue()} | another attribute |
|
||||
testFailures
|
||||
| ConflictingAttributes.html:1:4:1:27 | This attribute has the same name as $@ of the same element, but a different value. | Unexpected result: Alert |
|
||||
| tst.js:7:68:7:77 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:9:20:9:29 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:17:73:17:82 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:19:51:19:60 | // $ Alert | Missing result: Alert |
|
||||
|
||||
@@ -1 +1 @@
|
||||
<a href="http://semmle.com" href="https://semmle.com">Semmle</a>
|
||||
<a href="http://semmle.com" href="https://semmle.com">Semmle</a> <!-- $ Alert[js/conflicting-html-attribute] -->
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#select
|
||||
| DuplicateAttributes.html:1:4:1:28 | href=https://semmle.com | This attribute $@. | DuplicateAttributes.html:1:30:1:54 | href=https://semmle.com | is duplicated later |
|
||||
| tst.js:7:4:7:28 | href="h ... le.com" | This attribute $@. | tst.js:7:30:7:54 | href="h ... le.com" | is duplicated later |
|
||||
| tst.js:19:17:19:28 | id="theDiff" | This attribute $@. | tst.js:19:30:19:41 | id="theDiff" | is duplicated later |
|
||||
testFailures
|
||||
| DuplicateAttributes.html:1:4:1:28 | This attribute $@. | Unexpected result: Alert |
|
||||
| tst.js:5:67:5:76 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:9:20:9:29 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:12:60:12:69 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:17:73:17:82 | // $ Alert | Missing result: Alert |
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<a href="https://semmle.com" href="https://semmle.com">Semmle</a>
|
||||
<a href="https://semmle.com" href="https://semmle.com">Semmle</a> <!-- $ Alert[js/duplicate-html-attribute] -->
|
||||
|
||||
<td {% foo %} {% foo %}></td>
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
#select
|
||||
| AmbiguousIdAttributeGood.html:8:5:8:19 | id=invalid id | The value of the id attribute must not contain any space characters. |
|
||||
| AmbiguousIdAttributeGood.html:9:5:9:19 | id=invalid id | The value of the id attribute must not contain any space characters. |
|
||||
| MalformedIdAttribute.html:1:6:1:27 | id=heading important | The value of the id attribute must not contain any space characters. |
|
||||
| tst.js:9:6:9:10 | id="" | The value of the id attribute must contain at least one character. |
|
||||
| tst.js:10:6:10:13 | id="a b" | The value of the id attribute must not contain any space characters. |
|
||||
testFailures
|
||||
| AmbiguousIdAttributeGood.html:8:5:8:19 | The value of the id attribute must not contain any space characters. | Unexpected result: Alert |
|
||||
| AmbiguousIdAttributeGood.html:9:5:9:19 | The value of the id attribute must not contain any space characters. | Unexpected result: Alert |
|
||||
| MalformedIdAttribute.html:1:6:1:27 | The value of the id attribute must not contain any space characters. | Unexpected result: Alert |
|
||||
| tst.js:5:67:5:76 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:7:68:7:77 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:10:6:10:13 | The value of the id attribute must not contain any space characters. | Unexpected result: Alert |
|
||||
| tst.js:12:60:12:69 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:17:73:17:82 | // $ Alert | Missing result: Alert |
|
||||
| tst.js:19:51:19:60 | // $ Alert | Missing result: Alert |
|
||||
|
||||
@@ -1 +1 @@
|
||||
<div id="heading important">An important heading</div>
|
||||
<div id="heading important">An important heading</div> <!-- $ Alert[js/malformed-html-id] -->
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
var div1 = <div id="theDiff"></div>;
|
||||
var div2 = <div id="theDiff"></div>;
|
||||
|
||||
<a href="http://semmle.com" href="https://semmle.com">Semmle</a>; // $ Alert
|
||||
<a href="http://semmle.com" href="https://semmle.com">Semmle</a>; // $ Alert[js/conflicting-html-attribute]
|
||||
|
||||
<a href="https://semmle.com" href="https://semmle.com">Semmle</a>; // $ Alert
|
||||
<a href="https://semmle.com" href="https://semmle.com">Semmle</a>; // $ Alert[js/duplicate-html-attribute]
|
||||
|
||||
<div id=""></div>; // $ Alert
|
||||
<div id="a b"></div>;
|
||||
<div id=""></div>; // $ Alert[js/malformed-html-id]
|
||||
<div id="a b"></div>; // $ Alert[js/malformed-html-id]
|
||||
|
||||
<a href="http://semmle.com" href={someValue()}>Semmle</a>; // $ Alert
|
||||
<a href="http://semmle.com" href={someValue()}>Semmle</a>; // $ Alert[js/conflicting-html-attribute]
|
||||
|
||||
|
||||
<div id={someOtherValue()}></div>;
|
||||
|
||||
var div3 = <div><div id="theDiff"></div><div id="theDiff"></div></div>; // $ Alert
|
||||
var div3 = <div><div id="theDiff"></div><div id="theDiff"></div></div>; // $ Alert[js/duplicate-html-id]
|
||||
|
||||
var div4 = <div id="theDiff" id="theDiff"></div>; // $ Alert
|
||||
var div4 = <div id="theDiff" id="theDiff"></div>; // $ Alert[js/duplicate-html-attribute]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
window.setTimeout(";");
|
||||
setInterval("update();");
|
||||
window.setTimeout(";"); // $ Alert
|
||||
setInterval("update();"); // $ Alert
|
||||
setInterval(update);
|
||||
document.write("alert('Hi!');");
|
||||
window.execScript("debugger;");
|
||||
document.write("alert('Hi!');"); // $ Alert
|
||||
window.execScript("debugger;"); // $ Alert
|
||||
|
||||
(function(global) {
|
||||
var document = global.document;
|
||||
document.write("undefined = 2");
|
||||
document.write("undefined = 2"); // $ Alert
|
||||
})(this);
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
<a data-ng-href="https://example.com/{{X}}" target="_blank">Example</a>
|
||||
|
||||
<h1>NOT OK, because of dynamic URL</h1>
|
||||
<a href="http://example.com{{X}}" target="_blank">Example</a>
|
||||
<a href="{{target}}" target="_blank">Example</a>
|
||||
<a href="{{target}}" target="_blank">
|
||||
<a href="http://example.com{{X}}" target="_blank">Example</a> <!-- $ Alert -->
|
||||
<a href="{{target}}" target="_blank">Example</a> <!-- $ Alert -->
|
||||
<a href="{{target}}" target="_blank"> <!-- $ Alert -->
|
||||
Example
|
||||
</a>
|
||||
|
||||
<h1>NOT OK: mailto is not fine.</h1>
|
||||
<a target="_blank" href="mailto:{{var:mail}}">mail somone</a>
|
||||
<a target="_blank" href="mailto:{{var:mail}}">mail somone</a> <!-- $ Alert -->
|
||||
|
||||
<h1>OK: template elements after # or ? are fine.</h1>
|
||||
<a href="file.extension?#[% row.href %]" target="_blank">Example</a>
|
||||
|
||||
@@ -15,8 +15,8 @@ var o = { rel: "noopener noreferrer "};
|
||||
<a data-ng-href="https://example.com" target="_blank">Example</a>;
|
||||
|
||||
<a href="{{X}}" target="_blank">Example</a>; // $ Alert - because of dynamic URL
|
||||
<a href="{{X}}" target="_blank" rel="nopoener">Example</a>;
|
||||
<a data-ng-href="{{X}}" target="_blank">Example</a>;
|
||||
<a href="{{X}}" target="_blank" rel="nopoener">Example</a>; // $ Alert
|
||||
<a data-ng-href="{{X}}" target="_blank">Example</a>; // $ Alert
|
||||
|
||||
function f() {
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ function g(x, y) {
|
||||
}
|
||||
|
||||
(function (){
|
||||
for ([arguments] of o);
|
||||
for ([arguments = 4] of o);
|
||||
for ([arguments] of o); // $ Alert
|
||||
for ([arguments = 4] of o); // $ Alert
|
||||
});
|
||||
|
||||
@@ -18,5 +18,5 @@ const s = "hi";
|
||||
|
||||
(function (){
|
||||
const c = null;
|
||||
for ([ c ] of o);
|
||||
for ([ c ] of o); // $ Alert
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function f(x) {
|
||||
if (x > 23) {
|
||||
function g() {
|
||||
function g() { // $ Alert
|
||||
return 42;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
onmessage = function() { console.log("Got a message!"); };
|
||||
|
||||
onmissage = function() { console.log("How did that happen?"); };
|
||||
onmissage = function() { console.log("How did that happen?"); }; // $ Alert
|
||||
@@ -40,13 +40,13 @@ function k(data) {
|
||||
}
|
||||
|
||||
function l() {
|
||||
var x = 23;
|
||||
var x = 23; // $ Alert
|
||||
x = 42;
|
||||
return x;
|
||||
}
|
||||
|
||||
function m() {
|
||||
var x = 23, y;
|
||||
var x = 23, y; // $ Alert
|
||||
x = 42, y = x+14;
|
||||
return x+y;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ function v() {
|
||||
}
|
||||
|
||||
!function(o) {
|
||||
var {x} = o;
|
||||
var {x} = o; // $ Alert
|
||||
x = 42;
|
||||
return x;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ function v() {
|
||||
|
||||
(function() {
|
||||
if (something()) {
|
||||
var nSign = foo;
|
||||
var nSign = foo; // $ Alert
|
||||
} else {
|
||||
console.log(nSign);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ function f(event) {
|
||||
function g() {
|
||||
let x = 23; // $ Alert
|
||||
{
|
||||
x = 42;
|
||||
x = 42; // $ Alert
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
};
|
||||
|
||||
var o = { set setter(value) { } };
|
||||
o.setter = 42; // probably OK, but still flagged - it seems fishy
|
||||
o.setter = 42; // $ Alert - probably OK, but still flagged - it seems fishy
|
||||
o.setter = 87;
|
||||
|
||||
var o = {};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function f(x, y = defaultVal(x)) {
|
||||
function f(x, y = defaultVal(x)) { // $ Alert
|
||||
function defaultVal(x) {
|
||||
return x+19;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ function p() {
|
||||
}
|
||||
|
||||
function q() {
|
||||
var x; // $ Alert
|
||||
y = 23,
|
||||
var x;
|
||||
y = 23, // $ Alert
|
||||
z = y+19;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ function r() {
|
||||
}
|
||||
|
||||
(function() {
|
||||
for ([ unresolvable ] of o) {
|
||||
for ([ unresolvable ] of o) { // $ Alert
|
||||
unresolvable;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,6 +4,6 @@ function sc_alert(i) {
|
||||
}
|
||||
|
||||
function f(o) {
|
||||
for({x, ...rest} of o)
|
||||
for({x, ...rest} of o) // $ Alert
|
||||
console.log(x in rest);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var fun1;
|
||||
function fun1() {
|
||||
function fun1() { // $ Alert
|
||||
}
|
||||
|
||||
function fun2() {
|
||||
}
|
||||
var fun2;
|
||||
var fun2; // $ Alert
|
||||
|
||||
var fun3;
|
||||
var fun = function fun3() {
|
||||
|
||||
@@ -19,4 +19,4 @@ function k() {
|
||||
y = 2; // $ Alert
|
||||
}
|
||||
|
||||
var g;
|
||||
var g; // $ Alert
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function func1() {
|
||||
}
|
||||
|
||||
function func2(p1, p2, p3, p4, p5, p6, p7, p8) {
|
||||
function func2(p1, p2, p3, p4, p5, p6, p7, p8) { // $ Alert
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ var o = {
|
||||
|
||||
setX: function(x) {
|
||||
this.x = x;
|
||||
},
|
||||
}, // $ Alert
|
||||
|
||||
getX: function() {
|
||||
return this.x;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { AudioService } from './audio'
|
||||
import { StoreService } from './store';
|
||||
|
||||
export const services = [
|
||||
AudioService,
|
||||
AudioService, // $ Alert
|
||||
StoreService
|
||||
];
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ function K(x, y) {
|
||||
* @param {*} x the first argument
|
||||
* @param {*} y the second argument
|
||||
*/
|
||||
function K(x, y) {
|
||||
function K(x, y) { // $ Alert
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function(){
|
||||
var captured1 = {
|
||||
used1: 42,
|
||||
unused1: 42
|
||||
unused1: 42 // $ Alert
|
||||
};
|
||||
captured1.used1;
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
f(...{used6: 42});
|
||||
[...{used7: 42}];
|
||||
({...{used8: 42}});
|
||||
({ unused9: 42 }) + "";
|
||||
({ unused9: 42 }) + ""; // $ Alert
|
||||
({ used10: 42 }).hasOwnProperty;
|
||||
({ used10: 42 }).propertyIsEnumerable;
|
||||
|
||||
(function(){
|
||||
var captured11 = {
|
||||
used11: 42,
|
||||
unused11: 42
|
||||
unused11: 42 // $ Alert
|
||||
};
|
||||
captured11.used11;
|
||||
|
||||
var captured12 = {
|
||||
used12_butNotReally: 42,
|
||||
unused12: 42
|
||||
used12_butNotReally: 42, // $ Alert
|
||||
unused12: 42 // $ Alert
|
||||
};
|
||||
|
||||
throw x;
|
||||
@@ -49,10 +49,10 @@
|
||||
});
|
||||
|
||||
var captured14 = {
|
||||
unused14: 42
|
||||
unused14: 42 // $ Alert
|
||||
};
|
||||
captured14.unused14 = 42;
|
||||
captured14.unused14 = 42;
|
||||
captured14.unused14 = 42; // $ Alert
|
||||
captured14.unused14 = 42; // $ Alert
|
||||
|
||||
|
||||
var captured15 = {
|
||||
|
||||
@@ -21,7 +21,7 @@ class C {
|
||||
}
|
||||
|
||||
(function(){
|
||||
var o1: any = { p: 42, q: 42 };
|
||||
var o1: any = { p: 42, q: 42 }; // $ Alert
|
||||
o1.q;
|
||||
var o2: any = { p: 42, q: 42 };
|
||||
var o3: { p: int, q: int } = o2;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Foo, Bar } from "somewhere";
|
||||
import { Foo, Bar } from "somewhere"; // $ Alert
|
||||
|
||||
type FooBar<T> =
|
||||
T extends [infer S extends Foo, ...unknown[]]
|
||||
|
||||
@@ -3,8 +3,8 @@ const {BrowserWindow} = require('electron')
|
||||
function test() {
|
||||
var unsafe_used = {
|
||||
webPreferences: {
|
||||
webSecurity: false,
|
||||
allowRunningInsecureContent: true,
|
||||
webSecurity: false, // $ Alert[js/disabling-electron-websecurity]
|
||||
allowRunningInsecureContent: true, // $ Alert[js/enabling-electron-insecure-content]
|
||||
experimentalFeatures: true,
|
||||
enableBlinkFeatures: ['ExecCommandInJavaScript'],
|
||||
blinkFeatures: 'CSSVariables'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function bitIsSet(x, n) {
|
||||
return (x & (1<<n)) > 0;
|
||||
return (x & (1<<n)) > 0; // $ Alert
|
||||
}
|
||||
|
||||
console.log(bitIsSet(-1, 31)); // prints 'false'
|
||||
@@ -10,7 +10,7 @@ console.log(bitIsSet(-1, 31)); // prints 'false'
|
||||
x = -1;
|
||||
console.log((x | 0) > (0)); // prints 'false'
|
||||
|
||||
console.log((x >>> 0) > 0); // prints 'true' // $ Alert
|
||||
console.log((x >>> 0) > 0); // $ Alert - prints 'true'
|
||||
|
||||
|
||||
console.log((x << 16 >> 16) > 0); // prints 'false'
|
||||
|
||||
@@ -8,7 +8,7 @@ function Rectangle(x, y, width, height) {
|
||||
Rectangle.prototype.contains = function(x, y) {
|
||||
return (this.x <= x &&
|
||||
x < this.x+this.width) &&
|
||||
(y <= y &&
|
||||
(y <= y && // $ Alert
|
||||
y < this.y+this.height);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
x == NaN;
|
||||
x != NaN;
|
||||
x === NaN;
|
||||
NaN !== x;
|
||||
x < NaN;
|
||||
NaN === NaN;
|
||||
x == NaN; // $ Alert
|
||||
x != NaN; // $ Alert
|
||||
x === NaN; // $ Alert
|
||||
NaN !== x; // $ Alert
|
||||
x < NaN; // $ Alert
|
||||
NaN === NaN; // $ Alert
|
||||
isNaN(x);
|
||||
|
||||
function f(x, NaN) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function controller(msg) {
|
||||
if (msg == 'start')
|
||||
start();
|
||||
else if (msg == 'start')
|
||||
else if (msg == 'start') // $ Alert
|
||||
stop();
|
||||
else
|
||||
throw new Error("Message not understood.");
|
||||
|
||||
@@ -3,7 +3,7 @@ var o = {
|
||||
|
||||
getX: function() {
|
||||
return this.x;
|
||||
},
|
||||
}, // $ Alert
|
||||
|
||||
setX: function(x) {
|
||||
this.x = x;
|
||||
|
||||
@@ -3,7 +3,7 @@ function controller(msg) {
|
||||
case 'start':
|
||||
start();
|
||||
break;
|
||||
case 'start':
|
||||
case 'start': // $ Alert
|
||||
stop();
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -18,8 +18,8 @@ String.prototype.slice;
|
||||
/** @typedef {(string|number)} */
|
||||
goog.NumberLike;
|
||||
|
||||
/** Useless */ // $ Alert
|
||||
x;
|
||||
/** Useless */
|
||||
x; // $ Alert
|
||||
|
||||
// OK - magic DOM property
|
||||
elt.clientTop;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
(function f() {
|
||||
(function f() { // $ Alert
|
||||
console.log("I'm never called.");
|
||||
})
|
||||
@@ -8,13 +8,13 @@
|
||||
// disable the whitelist
|
||||
known = known; unknown = unknown; gotKnown = gotKnown; gotUnknown = gotUnknown;
|
||||
|
||||
known === 42;
|
||||
known === 42; // $ Alert
|
||||
known == 42;
|
||||
gotKnown === 42;
|
||||
gotKnown == 42;
|
||||
getKnown() === 42;
|
||||
getKnown() === 42; // $ Alert
|
||||
getKnown() == 42;
|
||||
getKnown_indirect() === 42;
|
||||
getKnown_indirect() === 42; // $ Alert
|
||||
getKnown_indirect() == 42;
|
||||
|
||||
unknown === 42;
|
||||
|
||||
@@ -16,8 +16,8 @@ undefined == null;
|
||||
|
||||
null == 0; // $ Alert
|
||||
|
||||
switch ("hi") { // $ Alert
|
||||
case 42:
|
||||
switch ("hi") {
|
||||
case 42: // $ Alert
|
||||
}
|
||||
|
||||
Object.toString() + "!" == undefined; // $ Alert
|
||||
@@ -136,7 +136,7 @@ function h() {
|
||||
}
|
||||
|
||||
function i() {
|
||||
"foo" === undefined
|
||||
"foo" === undefined // $ Alert
|
||||
undefined === "foo" // $ Alert
|
||||
var NaN = 0; // trick analysis to consider warning about NaN, for the purpose of testing pretty printing
|
||||
NaN === "foo" // $ Alert
|
||||
@@ -221,5 +221,5 @@ function l() {
|
||||
})();
|
||||
|
||||
function f(...x) {
|
||||
x === 42
|
||||
x === 42 // $ Alert
|
||||
};
|
||||
|
||||
@@ -86,17 +86,17 @@ function l() {
|
||||
(function(){
|
||||
function f() {
|
||||
}
|
||||
f()|0;
|
||||
f()|0; // $ Alert
|
||||
|
||||
unknown()|0;
|
||||
|
||||
function g() {
|
||||
}
|
||||
g()|0;
|
||||
g()|0; // $ Alert
|
||||
g();
|
||||
|
||||
var a = g() + 2;
|
||||
var b = g() + "str";
|
||||
var a = g() + 2; // $ Alert
|
||||
var b = g() + "str"; // $ Alert
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
var s;
|
||||
s = "this text" +
|
||||
s = "this text" + // $ Alert
|
||||
"is missing a space";
|
||||
s = "the class java.util.ArrayList" +
|
||||
s = "the class java.util.ArrayList" + // $ Alert
|
||||
"without a space";
|
||||
s = "This isn't" +
|
||||
s = "This isn't" + // $ Alert
|
||||
"right.";
|
||||
s = "There's 1" +
|
||||
s = "There's 1" + // $ Alert
|
||||
"thing wrong";
|
||||
s = "There's A/B" +
|
||||
s = "There's A/B" + // $ Alert
|
||||
"and no space";
|
||||
s = "Wait for it...." +
|
||||
s = "Wait for it...." + // $ Alert
|
||||
"No space!";
|
||||
s = "Is there a space?" +
|
||||
s = "Is there a space?" + // $ Alert
|
||||
"No!";
|
||||
|
||||
("missing " + "a space") + "here";
|
||||
("missing " + "a space") + "here"; // $ Alert
|
||||
|
||||
// syntactic variants:
|
||||
s = "missing a space" +
|
||||
s = "missing a space" + // $ Alert
|
||||
"here";
|
||||
s = 'missing a space' +
|
||||
s = 'missing a space' + // $ Alert
|
||||
'here';
|
||||
s = `missing a space` +
|
||||
s = `missing a space` + // $ Alert
|
||||
"here";
|
||||
s = "missing a space" +
|
||||
s = "missing a space" + // $ Alert
|
||||
`here`;
|
||||
s = `missing a space` +
|
||||
s = `missing a space` + // $ Alert
|
||||
`here`;
|
||||
s = (("missing space") + "here")
|
||||
s = (("missing space") + "here") // $ Alert
|
||||
|
||||
s = (("h. 0" + "h")) + "word"
|
||||
s = (("h. 0" + "h")) + "word" // $ Alert
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function selectElements(ids) {
|
||||
for (var i=0, length=ids.length; i<lenght; ++i) {
|
||||
for (var i=0, length=ids.length; i<lenght; ++i) { // $ Alert
|
||||
var id = ids[i];
|
||||
if (id) {
|
||||
var element = document.getElementById(id);
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
function f(errorMessage) {
|
||||
return errorMesage;
|
||||
return errorMesage; // $ Alert
|
||||
}
|
||||
|
||||
function g(errorMesage) {
|
||||
return errorMessage;
|
||||
return errorMessage; // $ Alert
|
||||
}
|
||||
|
||||
function h(errorMessage) {
|
||||
function inner() {
|
||||
return errorMesage;
|
||||
return errorMesage; // $ Alert
|
||||
}
|
||||
}
|
||||
|
||||
function k(errorMesage) {
|
||||
let inner = () =>
|
||||
errorMessage;
|
||||
errorMessage; // $ Alert
|
||||
}
|
||||
|
||||
function foo() {
|
||||
var thisHander;
|
||||
thisHandler.foo1;
|
||||
thisHandler.foo2;
|
||||
thisHandler.foo3;
|
||||
thisHandler.foo4;
|
||||
thisHandler.foo5;
|
||||
thisHandler.foo6;
|
||||
thisHandler.foo7;
|
||||
thisHandler.foo8;
|
||||
thisHandler.foo1; // $ Alert
|
||||
thisHandler.foo2; // $ Alert
|
||||
thisHandler.foo3; // $ Alert
|
||||
thisHandler.foo4; // $ Alert
|
||||
thisHandler.foo5; // $ Alert
|
||||
thisHandler.foo6; // $ Alert
|
||||
thisHandler.foo7; // $ Alert
|
||||
thisHandler.foo8; // $ Alert
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
(x + x) / 2;
|
||||
e[i] - e[i];
|
||||
(x + y)/(x + y);
|
||||
window.height - window.height;
|
||||
x == 23 || x == 23;
|
||||
(x + x) / 2; // $ Alert
|
||||
e[i] - e[i]; // $ Alert
|
||||
(x + y)/(x + y); // $ Alert
|
||||
window.height - window.height; // $ Alert
|
||||
x == 23 || x == 23; // $ Alert
|
||||
x & x;
|
||||
|
||||
// this may actually be OK, but it's not good style
|
||||
pop() && pop();
|
||||
pop() && pop(); // $ Alert
|
||||
|
||||
foo[bar++] && foo[bar++]
|
||||
@@ -1,46 +1,46 @@
|
||||
function NOT_OK() {
|
||||
// regex-like strings
|
||||
"".replace("/foo/i", "");
|
||||
"".replace("/^foo/", "");
|
||||
"".replace("/foo$/", "");
|
||||
"".replace("^foo$", "");
|
||||
"".replace("\s", "");
|
||||
"".replace("foo\sbar", "");
|
||||
"".replace("foo\s", "");
|
||||
"".replace("\sbar", "");
|
||||
"".replace("foo\[bar", "");
|
||||
"".replace("\[", "");
|
||||
"".replace("\]", "");
|
||||
"".replace("\(", "");
|
||||
"".replace("\)", "");
|
||||
"".replace("\*", "");
|
||||
"".replace("\+", "");
|
||||
"".replace("\?", "");
|
||||
"".replace("\{", "");
|
||||
"".replace("\}", "");
|
||||
"".replace("\|", "");
|
||||
"".replace("\^", "");
|
||||
"".replace("\$", "");
|
||||
"".replace("[a-zA-Z123]+", "");
|
||||
"".replace("[a-z]+", "");
|
||||
"".replace("[a-z]*", "");
|
||||
"".replace("[0-9_-]+", "");
|
||||
"".replace("[^a-z]+", "");
|
||||
"".replace("foo[^a-z]+bar", "");
|
||||
"".replace("/foo/i", ""); // $ Alert
|
||||
"".replace("/^foo/", ""); // $ Alert
|
||||
"".replace("/foo$/", ""); // $ Alert
|
||||
"".replace("^foo$", ""); // $ Alert
|
||||
"".replace("\s", ""); // $ Alert
|
||||
"".replace("foo\sbar", ""); // $ Alert
|
||||
"".replace("foo\s", ""); // $ Alert
|
||||
"".replace("\sbar", ""); // $ Alert
|
||||
"".replace("foo\[bar", ""); // $ Alert
|
||||
"".replace("\[", ""); // $ Alert
|
||||
"".replace("\]", ""); // $ Alert
|
||||
"".replace("\(", ""); // $ Alert
|
||||
"".replace("\)", ""); // $ Alert
|
||||
"".replace("\*", ""); // $ Alert
|
||||
"".replace("\+", ""); // $ Alert
|
||||
"".replace("\?", ""); // $ Alert
|
||||
"".replace("\{", ""); // $ Alert
|
||||
"".replace("\}", ""); // $ Alert
|
||||
"".replace("\|", ""); // $ Alert
|
||||
"".replace("\^", ""); // $ Alert
|
||||
"".replace("\$", ""); // $ Alert
|
||||
"".replace("[a-zA-Z123]+", ""); // $ Alert
|
||||
"".replace("[a-z]+", ""); // $ Alert
|
||||
"".replace("[a-z]*", ""); // $ Alert
|
||||
"".replace("[0-9_-]+", ""); // $ Alert
|
||||
"".replace("[^a-z]+", ""); // $ Alert
|
||||
"".replace("foo[^a-z]+bar", ""); // $ Alert
|
||||
|
||||
// shapes
|
||||
f().replace("/foo/i", x);
|
||||
f().replace("/foo/i", x); // $ Alert
|
||||
var v1 = "/foo/i";
|
||||
f().replace(v1, x);
|
||||
o.p.q.replace("/foo/i", x);
|
||||
f().replace(v1, x); // $ Alert
|
||||
o.p.q.replace("/foo/i", x); // $ Alert
|
||||
|
||||
// examples in the wild
|
||||
"".replace('^\s+|\s+$', '');
|
||||
"".replace("[^a-zA-Z0-9 ]+", "");
|
||||
"".replace('^\s+|\s+$', ''); // $ Alert
|
||||
"".replace("[^a-zA-Z0-9 ]+", ""); // $ Alert
|
||||
|
||||
// non-replace methods
|
||||
"".split("/foo/i");
|
||||
"".split("/foo/i", x);
|
||||
"".split("/foo/i"); // $ Alert
|
||||
"".split("/foo/i", x); // $ Alert
|
||||
}
|
||||
|
||||
function OK() {
|
||||
|
||||
@@ -8,6 +8,6 @@ function processResponse(response) {
|
||||
if (error)
|
||||
throw error;
|
||||
} else {
|
||||
error("Unexpected response status " + response.status);
|
||||
error("Unexpected response status " + response.status); // $ Alert
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
(function(){
|
||||
var a = null;
|
||||
a();
|
||||
a(); // $ Alert
|
||||
a?.();
|
||||
|
||||
var b = undefined;
|
||||
b();
|
||||
b(); // $ Alert
|
||||
b?.();
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var getF = function(){}
|
||||
var f = getF();
|
||||
(function () {
|
||||
f();
|
||||
f(); // $ Alert
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function f() {
|
||||
var result;
|
||||
res = computeInterestingResult();
|
||||
return result.value;
|
||||
return result.value; // $ Alert
|
||||
}
|
||||
|
||||
(function(_window) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
(function(){
|
||||
var a = null;
|
||||
a.p;
|
||||
a.p; // $ Alert
|
||||
a?.p;
|
||||
|
||||
var b = undefined;
|
||||
b.p;
|
||||
b.p; // $ Alert
|
||||
b?.p;
|
||||
});
|
||||
|
||||
@@ -29,5 +29,5 @@
|
||||
});
|
||||
|
||||
(function(){
|
||||
function a(){return null;} a(1)[0];
|
||||
function a(){return null;} a(1)[0]; // $ Alert
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ C.foo = 3;
|
||||
|
||||
namespace N {
|
||||
var x;
|
||||
x.p = 5;
|
||||
x.p = 5; // $ Alert
|
||||
|
||||
var q = M.Color.Blue;
|
||||
|
||||
|
||||
@@ -159,10 +159,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof x !== undefined);
|
||||
if (typeof window !== undefined);
|
||||
if (typeof x !== undefined); // $ Alert[js/comparison-between-incompatible-types]
|
||||
if (typeof window !== undefined); // $ Alert[js/comparison-between-incompatible-types]
|
||||
if (typeof x !== x);
|
||||
if (typeof x !== u); // $ Alert
|
||||
if (typeof x !== u); // $ Alert[js/comparison-between-incompatible-types]
|
||||
|
||||
if (typeof window !== "undefined");
|
||||
if (typeof module !== "undefined");
|
||||
@@ -172,12 +172,12 @@
|
||||
if (typeof module !== "undefined" && module.exports);
|
||||
if (typeof global !== "undefined" && global.process);
|
||||
|
||||
u && (f(), u.p);
|
||||
u && (u.p, f()); // technically not OK, but it seems like an unlikely pattern
|
||||
u && (f(), u.p); // $ Alert[js/trivial-conditional]
|
||||
u && (u.p, f()); // $ Alert[js/trivial-conditional] - technically not OK, but it seems like an unlikely pattern
|
||||
u && !u.p; // $ Alert
|
||||
u && !u(); // $ Alert
|
||||
|
||||
|
||||
|
||||
function hasCallbacks(success, error) {
|
||||
if (success) success()
|
||||
if (error) error()
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
function bad(x) {
|
||||
return x + x>>1;
|
||||
return x + x>>1; // $ Alert
|
||||
}
|
||||
|
||||
function ok1(x) {
|
||||
return x + x >> 1;
|
||||
return x + x >> 1;
|
||||
}
|
||||
|
||||
function ok2(x) {
|
||||
return x+x >> 1;
|
||||
return x+x >> 1;
|
||||
}
|
||||
|
||||
function ok3(x) {
|
||||
return x + (x>>1);
|
||||
return x + (x>>1);
|
||||
}
|
||||
|
||||
function ok4(x, y, z) {
|
||||
return x + y + z;
|
||||
}
|
||||
|
||||
|
||||
function ok5(x, y, z) {
|
||||
return x + y+z;
|
||||
}
|
||||
|
||||
function ok6(x) {
|
||||
return x + x>> 1;
|
||||
return x + x>> 1;
|
||||
}
|
||||
|
||||
function ok7(x, y, z) {
|
||||
return x + y - z;
|
||||
}
|
||||
|
||||
|
||||
function ok8(x, y, z) {
|
||||
return x + y-z;
|
||||
}
|
||||
@@ -51,4 +51,4 @@ x + x >> 1 // $ Alert
|
||||
x + x >> 1
|
||||
|
||||
// OK - asm.js-like
|
||||
x = x - 1|0;
|
||||
x = x - 1|0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function (i) {
|
||||
if (i <= 1)
|
||||
return 1;
|
||||
return i*arguments.callee(i-1);
|
||||
return i*arguments.callee(i-1); // $ Alert
|
||||
}(3));
|
||||
|
||||
function f() {
|
||||
@@ -9,7 +9,7 @@ function f() {
|
||||
}
|
||||
|
||||
function g() {
|
||||
return arguments.caller.length;
|
||||
return arguments.caller.length; // $ Alert
|
||||
}
|
||||
|
||||
function h(arguments) {
|
||||
|
||||
@@ -15,10 +15,10 @@ typeof c != "string";
|
||||
|
||||
typeof es6 === 'symbol';
|
||||
|
||||
switch (typeof a) {
|
||||
switch (typeof a) { // $ Alert
|
||||
|
||||
case 'undefined':
|
||||
case 'null': // $ Alert
|
||||
case 'null':
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
function sayHello() {
|
||||
debugger;
|
||||
debugger; // $ Alert
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
delete this.Object;
|
||||
delete String;
|
||||
delete String; // $ Alert
|
||||
function f(o, x) {
|
||||
delete o.p;
|
||||
delete o[x];
|
||||
delete x;
|
||||
delete x; // $ Alert
|
||||
delete (o.p);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
function sayHello() {
|
||||
eval("2+2");
|
||||
eval("2+2"); // $ Alert
|
||||
anotherFunction("2+2");
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ var obj = {prop1: 5, prop2: 13, prop3: 8};
|
||||
|
||||
for each (var item in obj) {
|
||||
sum += item;
|
||||
}
|
||||
} // $ Alert
|
||||
|
||||
console.log(sum); // logs "26", which is 5+13+8
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
function window::onload() {}
|
||||
function window::onload() {} // $ Alert
|
||||
|
||||
window.onload = function onload() {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var x = 42, y = 19;
|
||||
|
||||
console.log(let (x = 23, y = 19) x + y);
|
||||
console.log(let (x = 23, y = 19) x + y); // $ Alert
|
||||
|
||||
console.log(x - y);
|
||||
|
||||
@@ -2,6 +2,6 @@ var x = 42, y = 19;
|
||||
|
||||
let (x = 23, y = 19) {
|
||||
console.log(x + y);
|
||||
}
|
||||
} // $ Alert
|
||||
|
||||
console.log(x - y);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var numbers = [1, 2, 3, 4, 5];
|
||||
var squares = [i*i for (i of numbers)];
|
||||
var squares = [i*i for (i of numbers)]; // $ Alert
|
||||
var specialKeyCodes = [for (keyCodeName of Object.keys(SPECIAL_CODES_MAP))
|
||||
SPECIAL_CODES_MAP[keyCodeName]];
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
var a = [23,,42];
|
||||
var desc = [for(i in a) i + " = a[" + i + "]"];
|
||||
var desc = [for(i in a) i + " = a[" + i + "]"]; // $ Alert
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export function A(x) {
|
||||
export function A(x) { // $ Alert
|
||||
this.x = x;
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
function Point(x, y) {
|
||||
function Point(x, y) { // $ Alert
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ function foo(resource) {
|
||||
throw new Error();
|
||||
} finally {
|
||||
resource.close();
|
||||
return true;
|
||||
return true; // $ Alert
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ function baz(resource) {
|
||||
throw new Error();
|
||||
} finally {
|
||||
resource.close();
|
||||
break;
|
||||
break; // $ Alert
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ if (args.length > j) {
|
||||
console.log(args[j]);
|
||||
}
|
||||
|
||||
function badContains(a, elt) { // $ Alert - incorrect upper bound
|
||||
for (let i = 0; i <= a.length; ++i)
|
||||
function badContains(a, elt) { // incorrect upper bound
|
||||
for (let i = 0; i <= a.length; ++i) // $ Alert
|
||||
if (a[i] === elt)
|
||||
return true;
|
||||
return false;
|
||||
@@ -43,7 +43,7 @@ function goodContains(a, elt) {
|
||||
// this is arguably OK, but we flag it
|
||||
function same(a, b) {
|
||||
for (var i=0; i < a.length || i < b.length ; ++i)
|
||||
if (i <= a.length && i <= b.length && a[i] !== b[i])
|
||||
if (i <= a.length && i <= b.length && a[i] !== b[i]) // $ Alert
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
function distance({x: number, y: number}) {
|
||||
function distance({x: number, y: number}) { // $ Alert
|
||||
return Math.sqrt(x*x + y*y);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ export default function f() {
|
||||
return 23;
|
||||
}
|
||||
|
||||
export var x = 42
|
||||
export var x = 42 // $ Alert
|
||||
|
||||
//pad with enough explicit semicolons to satisfy 90% threshold
|
||||
foo();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function window::onload() {}
|
||||
|
||||
window.onload = function onload() {}
|
||||
window.onload = function onload() {} // $ Alert
|
||||
|
||||
// pad with enough explicit semicolons to satisfy 90% threshold
|
||||
foo();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
function tst() {
|
||||
var a = { // $ Alert
|
||||
var a = {
|
||||
'i': 1,
|
||||
'j': 2
|
||||
}
|
||||
} // $ Alert
|
||||
|
||||
return 1 // $ Alert
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ function A() {
|
||||
get x() {
|
||||
return _x;
|
||||
},
|
||||
set x(v) {
|
||||
}, // $ Alert
|
||||
set x(v) { // $ Alert
|
||||
},
|
||||
|
||||
get y() {
|
||||
return 56;
|
||||
|
||||
@@ -3,13 +3,13 @@ function f1(x) {return;}
|
||||
|
||||
f0.call();
|
||||
f0.call(this);
|
||||
f0.call(this, 1);
|
||||
f0.call(this, 1); // $ Alert
|
||||
f0.call(this, 1, 2);
|
||||
|
||||
f1.call();
|
||||
f1.call(this);
|
||||
f1.call(this, 1);
|
||||
f1.call(this, 1, 2);
|
||||
f1.call(this, 1, 2); // $ Alert
|
||||
|
||||
f0.apply();
|
||||
f0.apply(this);
|
||||
|
||||
@@ -1 +1 @@
|
||||
(a, a) => a + a;
|
||||
(a, a) => a + a; // $ Alert
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class C {
|
||||
#privDecl;
|
||||
bar() {
|
||||
{#privDecl} = this;
|
||||
{#privDecl} = this; // $ Alert
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
function findBox() {
|
||||
return $("box.important
|
||||
return $("box.important // $ Alert
|
||||
|
||||
@@ -2,7 +2,7 @@ function connectAndLog(id) {
|
||||
log.info(`Connecting to ${id}`)
|
||||
let connection = openConnection(id)
|
||||
if (!connection) {
|
||||
log.error('Could not connect to ${id}')
|
||||
log.error('Could not connect to ${id}') // $ Alert
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ function emitTemplate(name, date) {
|
||||
var globalVar = "global";
|
||||
|
||||
function foo() {
|
||||
log.error('globalVar = ${globalVar}');
|
||||
log.error('globalVar = ${globalVar}'); // $ Alert
|
||||
}
|
||||
log.error('globalVar = ${globalVar}');
|
||||
log.error('globalVar = ${globalVar}'); // $ Alert
|
||||
|
||||
function bar() {
|
||||
log.error('Something ${notInScope}');
|
||||
@@ -25,7 +25,7 @@ function bar() {
|
||||
function baz(x){
|
||||
log.error("${x}");
|
||||
log.error("${y}");
|
||||
log.error("${x} ");
|
||||
log.error("${x} "); // $ Alert
|
||||
log.error("${y} ");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
// under the MIT license; see file LICENSE.
|
||||
|
||||
class B1 {}
|
||||
class A30 extends B1 { constructor() { this.c = 0; } }
|
||||
class A31 extends B1 { constructor() { this.c(); } }
|
||||
class A32 extends B1 { constructor() { super.c(); } }
|
||||
class A33 extends B1 { constructor() { this.c = 0; super(); } }
|
||||
class A34 extends B1 { constructor() { this.c(); super(); } }
|
||||
class A35 extends B1 { constructor() { super.c(); super(); } }
|
||||
class A36 extends B1 { constructor() { super(this.c); } }
|
||||
class A37 extends B1 { constructor() { super(this.c()); } }
|
||||
class A38 extends B1 { constructor() { super(super.c()); } }
|
||||
class A39 extends B1 { constructor() { class C extends D { constructor() { super(); this.e(); } } this.f(); super(); } }
|
||||
class A40 extends B1 { constructor() { class C extends D { constructor() { this.e(); super(); } } super(); this.f(); } }
|
||||
class A41 extends B1 { constructor() { if (a) super(); this.a(); } }
|
||||
class A30 extends B1 { constructor() { this.c = 0; } } // $ Alert
|
||||
class A31 extends B1 { constructor() { this.c(); } } // $ Alert
|
||||
class A32 extends B1 { constructor() { super.c(); } } // $ Alert
|
||||
class A33 extends B1 { constructor() { this.c = 0; super(); } } // $ Alert
|
||||
class A34 extends B1 { constructor() { this.c(); super(); } } // $ Alert
|
||||
class A35 extends B1 { constructor() { super.c(); super(); } } // $ Alert
|
||||
class A36 extends B1 { constructor() { super(this.c); } } // $ Alert
|
||||
class A37 extends B1 { constructor() { super(this.c()); } } // $ Alert
|
||||
class A38 extends B1 { constructor() { super(super.c()); } } // $ Alert
|
||||
class A39 extends B1 { constructor() { class C extends D { constructor() { super(); this.e(); } } this.f(); super(); } } // $ Alert
|
||||
class A40 extends B1 { constructor() { class C extends D { constructor() { this.e(); super(); } } super(); this.f(); } } // $ Alert
|
||||
class A41 extends B1 { constructor() { if (a) super(); this.a(); } } // $ Alert
|
||||
|
||||
// the following two cases are not currently detected (even though they should be):
|
||||
// while `this` is, in both cases, guarded by a `super` call, the call does not complete
|
||||
@@ -23,7 +23,7 @@ class A42 extends B2 { constructor() { try { super(); } finally { this.a; } } }
|
||||
class A43 extends B2 { constructor() { try { super(); } catch (err) { } this.a; } }
|
||||
|
||||
class A44 extends B1 {
|
||||
constructor() {
|
||||
constructor() { // $ Alert
|
||||
this.p1 = 0;
|
||||
this.p2 = 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function sum(xs) {
|
||||
var res = 0;
|
||||
for(var i=0; i<xs.length; ++i)
|
||||
for(var i=0; i<xs.length; ++i) // $ Alert
|
||||
res += xs[0]; // BAD: should be xs[i]
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function sum(xs, i) {
|
||||
var res = 0;
|
||||
for(;i++<xs.length;)
|
||||
for(;i++<xs.length;) // $ Alert
|
||||
res += xs[0]; // BAD: should be xs[i]
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function sayHello() {
|
||||
with (foo) {
|
||||
with (foo) { // $ Alert
|
||||
var x = 3;
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Adapted from the Node.js documentation
|
||||
console.log('a starting');
|
||||
exports.done = false;
|
||||
var b = require('./b.js');
|
||||
var b = require('./b.js'); // $ Alert
|
||||
console.log('in a, b.done = %j', b.done);
|
||||
exports.done = true;
|
||||
console.log('a done');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Adapted from the Node.js documentation
|
||||
console.log('b starting');
|
||||
exports.done = false;
|
||||
var a = require('./a.js');
|
||||
var a = require('./a.js'); // $ Alert
|
||||
console.log('in b, a.done = %j', a.done);
|
||||
exports.done = true;
|
||||
console.log('b done');
|
||||
|
||||
@@ -1 +1 @@
|
||||
require('./selfimport');
|
||||
require('./selfimport'); // $ Alert
|
||||
@@ -1,2 +1,2 @@
|
||||
require('../test2/inner/a');
|
||||
require('./b');
|
||||
require('../test2/inner/a'); // $ Alert
|
||||
require('./b'); // $ Alert
|
||||
@@ -1 +1 @@
|
||||
require('../test2/inner/a');
|
||||
require('../test2/inner/a'); // $ Alert
|
||||
@@ -1 +1 @@
|
||||
require('../../test1/a');
|
||||
require('../../test1/a'); // $ Alert
|
||||
@@ -1,4 +1,4 @@
|
||||
var foo = require('./b').foo,
|
||||
var foo = require('./b').foo, // $ Alert
|
||||
bar = require('./c').bar,
|
||||
sneaky = require('./d').sneaky;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ var b = require('./b'),
|
||||
c = require('./c'),
|
||||
d = require('./d');
|
||||
|
||||
b.foo;
|
||||
b.foo; // $ Alert
|
||||
c.bar;
|
||||
d.sneaky;
|
||||
b.prototype;
|
||||
@@ -12,7 +12,7 @@ require('./f').tricky;
|
||||
|
||||
var fs = require('fs');
|
||||
fs.rename('foo', 'bar', function() {});
|
||||
fs.renmae('foo', 'bar', function() {});
|
||||
fs.renmae('foo', 'bar', function() {}); // $ Alert
|
||||
fs.move('foo', 'bar', function() {});
|
||||
|
||||
var k = require('./k');
|
||||
|
||||
@@ -4,5 +4,5 @@ exports.checkOne = function(x) {
|
||||
|
||||
var checkList = exports.checkList = function(xs) {
|
||||
for (var i=0; i<xs.length; ++i)
|
||||
checkOne(xs[i]);
|
||||
checkOne(xs[i]); // $ Alert
|
||||
};
|
||||
@@ -9,8 +9,8 @@ function f() {
|
||||
}
|
||||
|
||||
function g() {
|
||||
var q = [], i = 0; // $ Alert - property
|
||||
for (q[i++] in o);
|
||||
var q = [], i = 0; // property
|
||||
for (q[i++] in o); // $ Alert
|
||||
}
|
||||
|
||||
function h() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user