Merge pull request #827 from xiemaisi/js/duplicate-toplevel-percent

Approved by esben-semmle
This commit is contained in:
semmle-qlci
2019-01-28 08:40:23 +00:00
committed by GitHub
5 changed files with 24 additions and 1 deletions

View File

@@ -22,5 +22,5 @@ from TopLevel one, TopLevel another, float percent
where
duplicateContainers(one, another, percent) and
one.getNumLines() > 5
select one.(FirstLineOf), percent + "% of statements in this script are duplicated in $@.",
select one.(FirstLineOf), percent.floor() + "% of statements in this script are duplicated in $@.",
another.(FirstLineOf), "another script"

View File

@@ -1,2 +1,6 @@
| a.js:1:1:1:1 | <toplevel> | 90% of statements in this script are duplicated in $@. | e.js:1:1:1:1 | <toplevel> | another script |
| a.js:1:1:1:1 | <toplevel> | 100% of statements in this script are duplicated in $@. | b.js:1:1:1:1 | <toplevel> | another script |
| b.js:1:1:1:1 | <toplevel> | 90% of statements in this script are duplicated in $@. | e.js:1:1:1:1 | <toplevel> | another script |
| b.js:1:1:1:1 | <toplevel> | 100% of statements in this script are duplicated in $@. | a.js:1:1:1:1 | <toplevel> | another script |
| e.js:1:1:1:1 | <toplevel> | 90% of statements in this script are duplicated in $@. | a.js:1:1:1:1 | <toplevel> | another script |
| e.js:1:1:1:1 | <toplevel> | 90% of statements in this script are duplicated in $@. | b.js:1:1:1:1 | <toplevel> | another script |

View File

@@ -7,4 +7,7 @@
arguments[0]--;
arguments[1] += 19;
arguments[0] * arguments[1];
arguments[2] / arguments[3];
arguments[4] % arguments[5];
arguments[6] % arguments[7];
}

View File

@@ -7,4 +7,7 @@
arguments[0]--;
arguments[1] += 19;
arguments[0] * arguments[1];
arguments[2] / arguments[3];
arguments[4] % arguments[5];
arguments[6] % arguments[7];
}

View File

@@ -0,0 +1,13 @@
{
if (arguments.length == 0)
23;
if (arguments.length % 2 != 0)
42;
console.log(arguments[0]);
arguments[0]--;
arguments[1] += 19;
arguments[0] * arguments[1];
arguments[2] / arguments[3];
arguments[4] % arguments[5];
/*arguments[6] % arguments[7]*/;
}