mirror of
https://github.com/github/codeql.git
synced 2026-04-14 19:44:03 +02:00
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.
123 lines
1.1 KiB
JavaScript
123 lines
1.1 KiB
JavaScript
function bad1() {
|
|
if (cond())
|
|
f();
|
|
g(); // $ Alert
|
|
}
|
|
|
|
function good1() {
|
|
if (cond()) {
|
|
f();
|
|
}
|
|
g();
|
|
}
|
|
|
|
function good2() {
|
|
if (cond())
|
|
f();
|
|
g();
|
|
}
|
|
|
|
function bad2() {
|
|
if (cond())
|
|
f();
|
|
else
|
|
g();
|
|
h(); // $ Alert
|
|
}
|
|
|
|
function good3() {
|
|
if (cond())
|
|
f();
|
|
g();
|
|
}
|
|
|
|
function wbad1() {
|
|
while (cond())
|
|
f();
|
|
g(); // $ Alert
|
|
}
|
|
|
|
function wgood1() {
|
|
while (cond()) {
|
|
f();
|
|
}
|
|
g();
|
|
}
|
|
|
|
function wgood2() {
|
|
while (cond())
|
|
f();
|
|
g();
|
|
}
|
|
|
|
function wgood3() {
|
|
while (cond())
|
|
f();
|
|
g();
|
|
}
|
|
|
|
function dgood() {
|
|
do
|
|
f();
|
|
while (false);
|
|
g();
|
|
}
|
|
|
|
function tgood() {
|
|
try {
|
|
if (cond())
|
|
throw new Error();
|
|
} finally {}
|
|
f();
|
|
}
|
|
|
|
function good4() {
|
|
if (cond())
|
|
f();
|
|
g();
|
|
}
|
|
|
|
function good5() {
|
|
try {
|
|
} catch (e) {
|
|
}
|
|
}
|
|
|
|
function good6() {
|
|
try {
|
|
} catch (e) {
|
|
};
|
|
}
|
|
|
|
function good7() {
|
|
if (e) {
|
|
try {
|
|
} catch (e) {
|
|
}
|
|
}
|
|
}
|
|
|
|
function good8() {
|
|
if (e) {
|
|
try {
|
|
} catch (e) {
|
|
};
|
|
}
|
|
}
|
|
|
|
function good9() {
|
|
if(e){
|
|
try{
|
|
} catch(e){
|
|
};
|
|
}
|
|
}
|
|
|
|
function good10() {
|
|
if(e){
|
|
try{
|
|
}catch(e){
|
|
};
|
|
}
|
|
}
|