Skip to content

Commit 446ad5e

Browse files
committed
JS: Remove code duplication library
1 parent c812bd9 commit 446ad5e

File tree

11 files changed

+8
-437
lines changed

11 files changed

+8
-437
lines changed

javascript/ql/src/Metrics/FLinesOfDuplicatedCode.ql

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,8 @@
1313
* non-attributable
1414
*/
1515

16-
import external.CodeDuplication
17-
18-
/**
19-
* Holds if line `l` of file `f` should be excluded from duplicated code detection.
20-
*
21-
* Currently, only lines on which an import declaration occurs are excluded.
22-
*/
23-
predicate whitelistedLineForDuplication(File f, int l) {
24-
exists(ImportDeclaration i | i.getFile() = f and i.getLocation().getStartLine() = l)
25-
}
26-
27-
/**
28-
* Holds if line `l` of file `f` belongs to a block of lines that is duplicated somewhere else.
29-
*/
30-
predicate dupLine(int l, File f) {
31-
exists(DuplicateBlock d | d.sourceFile() = f |
32-
l in [d.sourceStartLine() .. d.sourceEndLine()] and
33-
not whitelistedLineForDuplication(f, l)
34-
)
35-
}
16+
import javascript
3617

3718
from File f, int n
38-
where n = count(int l | dupLine(l, f))
19+
where none()
3920
select f, n order by n desc

javascript/ql/src/Metrics/FLinesOfSimilarCode.ql

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@
1414
* non-attributable
1515
*/
1616

17-
import external.CodeDuplication
18-
19-
/**
20-
* Holds if line `l` of file `f` belong to a block of lines that is similar to a block
21-
* of lines appearing somewhere else.
22-
*/
23-
predicate simLine(int l, File f) {
24-
exists(SimilarBlock d | d.sourceFile() = f | l in [d.sourceStartLine() .. d.sourceEndLine()])
25-
}
17+
import javascript
2618

2719
from File f, int n
28-
where n = count(int l | simLine(l, f))
20+
where none()
2921
select f, n order by n desc

0 commit comments

Comments
 (0)