mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Swift: add SuccessfullyExtractedLines query
This counts how many lines we have extracted some entity in. If we test changes in this, we can have a more fine grained look into how much we actually extract than looking at the extracted files.
This commit is contained in:
15
swift/ql/src/diagnostics/SuccessfullyExtractedLines.ql
Normal file
15
swift/ql/src/diagnostics/SuccessfullyExtractedLines.ql
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @name Successfully extracted lines
|
||||
* @description Count all lines in source code in which something was extracted.
|
||||
* @kind metric
|
||||
* @id swift/diagnostics/successfully-extracted-lines
|
||||
* @tags summary
|
||||
*/
|
||||
|
||||
import swift
|
||||
|
||||
select count(File f, int line |
|
||||
exists(Location loc |
|
||||
not loc instanceof UnknownLocation and loc.getFile() = f and loc.getStartLine() = line
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
| 4 |
|
||||
@@ -0,0 +1 @@
|
||||
diagnostics/SuccessfullyExtractedLines.ql
|
||||
3
swift/ql/test/query-tests/Diagnostics/ignored.swift
Normal file
3
swift/ql/test/query-tests/Diagnostics/ignored.swift
Normal file
@@ -0,0 +1,3 @@
|
||||
//codeql-extractor-env: CODEQL_EXTRACTOR_SWIFT_RUN_UNDER=true
|
||||
|
||||
func not_compiled() {}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
// a comment
|
||||
|
||||
|
||||
func foo() {}
|
||||
|
||||
Reference in New Issue
Block a user