Skip to content

Commit a4a7ad8

Browse files
committed
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.
1 parent c28af76 commit a4a7ad8

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* @id java/summary/lines-of-code
33
* @name Total lines of Java code in the database
4-
* @description The total number of lines of code across all files. This is a useful metric of the size of a database.
5-
* For all files that were seen during the build, this query counts the lines of code, excluding whitespace
4+
* @description The total number of lines of code across all Java files. This is a useful metric of the size of a database.
5+
* For all Java files that were seen during the build, this query counts the lines of code, excluding whitespace
66
* or comments.
77
* @kind metric
88
* @tags summary
@@ -11,4 +11,4 @@
1111

1212
import java
1313

14-
select sum(CompilationUnit f | f.fromSource() | f.getNumberOfLinesOfCode())
14+
select sum(CompilationUnit f | f.fromSource() and f.isJavaSourceFile() | f.getNumberOfLinesOfCode())
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id java/summary/lines-of-code-kotlin
3+
* @name Total lines of Kotlin code in the database
4+
* @description The total number of lines of code across all Kotlin files. This is a useful metric of the size of a database.
5+
* For all Kotlin files that were seen during the build, this query counts the lines of code, excluding whitespace
6+
* or comments.
7+
* @kind metric
8+
* @tags summary
9+
* lines-of-code
10+
*/
11+
12+
import java
13+
14+
select sum(CompilationUnit f |
15+
f.fromSource() and f.isKotlinSourceFile()
16+
|
17+
f.getNumberOfLinesOfCode()
18+
)

0 commit comments

Comments
 (0)