Skip to content

Commit fa3ac30

Browse files
authored
C++: Update query to latest spec.
1 parent f75b969 commit fa3ac30

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

cpp/ql/src/Summary/LinesOfCode.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* @id cpp/summary/lines-of-code
33
* @name Total lines of C/C++ code in the database.
4-
* @description The total number of lines of C/C++ code across all files, including system headers and libraries. This is a useful metric of the size of a database.
4+
* @description The total number of lines of C/C++ code across all files, including system headers, libraries and auto-generated files. This is a useful metric of the size of a database. Lines of code are all lines in a file that was seen during the build that contain code, i.e. are not whitespace or comments.
55
* @kind metric
66
* @tags summary
77
*/
88

99
import cpp
1010

11-
select sum(File f | f.fromSource() | f.getMetrics().getNumberOfLines())
11+
select sum(File f | f.fromSource() | f.getMetrics().getNumberOfLinesOfCode())
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| 122 |
1+
| 93 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

cpp/ql/test/query-tests/Summary/large-file.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ int a06(float x) {
2626
return (int)x;
2727
}
2828

29+
/**
30+
* This is a multi-line comment
31+
*/
2932
int a07(float x) {
3033
return (int)x;
3134
}
3235

36+
// this is a single-line comment
3337
int a08(float x) {
3438
return (int)x;
3539
}

0 commit comments

Comments
 (0)