Skip to content

Commit 5e45377

Browse files
authored
Merge pull request github#12725 from github/redsun82/swift-successfully-extracted-lines
Swift: add `SuccessfullyExtractedLines` query
2 parents 69619f1 + bc69854 commit 5e45377

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name Successfully extracted lines
3+
* @description Count all lines in source code in which something was extracted. Entities spanning multiple lines like multi-line strings or comments only contribute one line to this count.
4+
* @kind metric
5+
* @id swift/diagnostics/successfully-extracted-lines
6+
* @tags summary
7+
*/
8+
9+
import swift
10+
11+
select count(File f, int line |
12+
exists(Location loc |
13+
not loc instanceof UnknownLocation and loc.getFile() = f and loc.getStartLine() = line
14+
)
15+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| 4 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
diagnostics/SuccessfullyExtractedLines.ql
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//codeql-extractor-env: CODEQL_EXTRACTOR_SWIFT_RUN_UNDER=true
2+
3+
func not_compiled() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
// a comment
4+
5+
6+
func foo() {}

0 commit comments

Comments
 (0)