Skip to content

Commit 254fafc

Browse files
author
Max Schaefer
committed
JavaScript: Round down percentage in DuplicateToplevel.ql.
All the other duplication queries already do this.
1 parent 39191ed commit 254fafc

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

javascript/ql/src/external/DuplicateToplevel.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ from TopLevel one, TopLevel another, float percent
2222
where
2323
duplicateContainers(one, another, percent) and
2424
one.getNumLines() > 5
25-
select one.(FirstLineOf), percent + "% of statements in this script are duplicated in $@.",
25+
select one.(FirstLineOf), percent.floor() + "% of statements in this script are duplicated in $@.",
2626
another.(FirstLineOf), "another script"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
| 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 |
12
| 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 |
3+
| 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 |
24
| 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 |
5+
| 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 |
6+
| 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 |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
if (arguments.length == 0)
3+
23;
4+
if (arguments.length % 2 != 0)
5+
42;
6+
console.log(arguments[0]);
7+
arguments[0]--;
8+
arguments[1] += 19;
9+
arguments[0] * arguments[1];
10+
arguments[2] / arguments[3];
11+
arguments[4] % arguments[5];
12+
/*arguments[6] % arguments[7]*/;
13+
}

0 commit comments

Comments
 (0)