Skip to content

Commit 43dc9bb

Browse files
authored
Merge pull request github#5744 from tamasvajk/feature/java-loc
Java: Introduce LoC summary metric query
2 parents 96a4d91 + 9c93686 commit 43dc9bb

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(CompilationUnit f | f.fromSource() | f.getNumberOfLinesOfCode())
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)