Skip to content

Commit 2f98c5b

Browse files
committed
Rust: Add lines-of-code queries.
1 parent c7be2ae commit 2f98c5b

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @name Total lines of Rust code in the database
3+
* @description The total number of lines of Rust code across all files, including any libraries and auto-generated files that the extractor sees. 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.
4+
* @kind metric
5+
* @id rust/summary/lines-of-code
6+
* @tags summary
7+
* lines-of-code
8+
* telemetry
9+
*/
10+
11+
import rust
12+
13+
select sum(File f | | f.getNumberOfLinesOfCode())
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @name Total lines of user written Rust code in the database
3+
* @description The total number of lines of Rust code from the source code directory. This query counts the lines of code, excluding whitespace or comments.
4+
* @kind metric
5+
* @id rust/summary/lines-of-user-code
6+
* @tags summary
7+
* lines-of-code
8+
* debug
9+
*/
10+
11+
import rust
12+
13+
select sum(File f | exists(f.getRelativePath()) | f.getNumberOfLinesOfCode())
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name Lines of user code in files
3+
* @description Measures the number of lines of code in each file from the source directory, ignoring lines that contain only comments or whitespace.
4+
* @kind metric
5+
* @id rust/summary/lines-of-user-code-in-files
6+
* @metricType file
7+
*/
8+
9+
import rust
10+
11+
from File f, int n
12+
where
13+
exists(f.getRelativePath()) and
14+
n = f.getNumberOfLinesOfCode()
15+
select f, n order by n desc

0 commit comments

Comments
 (0)