Java/Kotlin: Split lines of code by language

We were giving the sum of all lines for both languages, but labelling it
as "Total lines of Java code in the database", which was confusing.

Now we give separate sums for Kotlin and Java lines.
This commit is contained in:
Ian Lynagh
2023-06-05 13:20:14 +01:00
parent c28af7672d
commit a4a7ad8f99
2 changed files with 21 additions and 3 deletions

View File

@@ -1,8 +1,8 @@
/**
* @id java/summary/lines-of-code
* @name Total lines of Java code in the database
* @description The total number of lines of code across all files. This is a useful metric of the size of a database.
* For all files that were seen during the build, this query counts the lines of code, excluding whitespace
* @description The total number of lines of code across all Java files. This is a useful metric of the size of a database.
* For all Java files that were seen during the build, this query counts the lines of code, excluding whitespace
* or comments.
* @kind metric
* @tags summary
@@ -11,4 +11,4 @@
import java
select sum(CompilationUnit f | f.fromSource() | f.getNumberOfLinesOfCode())
select sum(CompilationUnit f | f.fromSource() and f.isJavaSourceFile() | f.getNumberOfLinesOfCode())

View File

@@ -0,0 +1,18 @@
/**
* @id java/summary/lines-of-code-kotlin
* @name Total lines of Kotlin code in the database
* @description The total number of lines of code across all Kotlin files. This is a useful metric of the size of a database.
* For all Kotlin files that were seen during the build, this query counts the lines of code, excluding whitespace
* or comments.
* @kind metric
* @tags summary
* lines-of-code
*/
import java
select sum(CompilationUnit f |
f.fromSource() and f.isKotlinSourceFile()
|
f.getNumberOfLinesOfCode()
)