Java: Introduce LoC summary metric query

This commit is contained in:
Tamas Vajk
2021-04-21 14:25:54 +02:00
parent 7080b256fb
commit e25305e3cc
4 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
/**
* @id java/summary/lines-of-code
* @name Total lines of 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
* or comments.
* @kind metric
* @tags summary
*/
import java
select sum(File f, int i | i = f.getNumberOfLinesOfCode() | i)

View File

@@ -0,0 +1,9 @@
public class A {
public void M() {
//some comment
}
/* public void M() {
//some comment
} */
}

View File

@@ -0,0 +1 @@
| 4 |

View File

@@ -0,0 +1 @@
Metrics/Summaries/LinesOfCode.ql