mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JavaScript: Round down percentage in DuplicateToplevel.ql.
All the other duplication queries already do this.
This commit is contained in:
@@ -22,5 +22,5 @@ from TopLevel one, TopLevel another, float percent
|
|||||||
where
|
where
|
||||||
duplicateContainers(one, another, percent) and
|
duplicateContainers(one, another, percent) and
|
||||||
one.getNumLines() > 5
|
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"
|
another.(FirstLineOf), "another script"
|
||||||
|
|||||||
@@ -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 |
|
| 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 |
|
| 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 |
|
||||||
|
|||||||
13
javascript/ql/test/query-tests/external/DuplicateToplevel/e.js
vendored
Normal file
13
javascript/ql/test/query-tests/external/DuplicateToplevel/e.js
vendored
Normal 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]*/;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user