Skip to content

Commit e25305e

Browse files
committed
Java: Introduce LoC summary metric query
1 parent 7080b25 commit e25305e

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @id java/summary/lines-of-code
3+
* @name Total lines of 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
6+
* or comments.
7+
* @kind metric
8+
* @tags summary
9+
*/
10+
11+
import java
12+
13+
select sum(File f, int i | i = f.getNumberOfLinesOfCode() | i)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class A {
2+
public void M() {
3+
//some comment
4+
}
5+
6+
/* public void M() {
7+
//some comment
8+
} */
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| 4 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Metrics/Summaries/LinesOfCode.ql

0 commit comments

Comments
 (0)