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:
Paolo Tranquilli
2023-03-31 10:02:11 +02:00
parent 3e703802b1
commit 33b4d2d653
5 changed files with 26 additions and 0 deletions

View 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
)
)

View File

@@ -0,0 +1 @@
diagnostics/SuccessfullyExtractedLines.ql

View File

@@ -0,0 +1,3 @@
//codeql-extractor-env: CODEQL_EXTRACTOR_SWIFT_RUN_UNDER=true
func not_compiled() {}

View File

@@ -0,0 +1,6 @@
// a comment
func foo() {}