mirror of
https://github.com/github/codeql.git
synced 2026-04-19 22:14:01 +02:00
Merge pull request #13373 from igfoo/igfoo/kotlin-loc
Java/Kotlin: Split lines of code by language
This commit is contained in:
@@ -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())
|
||||
|
||||
18
java/ql/src/Metrics/Summaries/LinesOfCodeKotlin.ql
Normal file
18
java/ql/src/Metrics/Summaries/LinesOfCodeKotlin.ql
Normal 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()
|
||||
)
|
||||
4
java/ql/src/change-notes/2023-06-05-lines-of-code.md
Normal file
4
java/ql/src/change-notes/2023-06-05-lines-of-code.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The `java/summary/lines-of-code` query now only counts lines of Java code. The new `java/summary/lines-of-code-kotlin` counts lines of Kotlin code.
|
||||
Reference in New Issue
Block a user