Skip to content

Commit 98c1aa5

Browse files
authored
Merge pull request github#5271 from github/files-query
C++: Summary metrics queries
2 parents 0732f20 + 783a63a commit 98c1aa5

File tree

6 files changed

+140
-0
lines changed

6 files changed

+140
-0
lines changed

cpp/ql/src/Summary/LinesOfCode.ql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @id cpp/summary/lines-of-code
3+
* @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, libraries, and auto-generated 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.
5+
* @kind metric
6+
* @tags summary
7+
*/
8+
9+
import cpp
10+
11+
select sum(File f | f.fromSource() | f.getMetrics().getNumberOfLinesOfCode())
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| 93 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Summary/LinesOfCode.ql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
int a00(float x) {
2+
return (int)x;
3+
}
4+
5+
int a01(float x) {
6+
return (int)x;
7+
}
8+
9+
int a02(float x) {
10+
return (int)x;
11+
}
12+
13+
int a03(float x) {
14+
return (int)x;
15+
}
16+
17+
int a04(float x) {
18+
return (int)x;
19+
}
20+
21+
int a05(float x) {
22+
return (int)x;
23+
}
24+
25+
int a06(float x) {
26+
return (int)x;
27+
}
28+
29+
/**
30+
* This is a multi-line comment
31+
*/
32+
int a07(float x) {
33+
return (int)x;
34+
}
35+
36+
// this is a single-line comment
37+
int a08(float x) {
38+
return (int)x;
39+
}
40+
41+
int a09(float x) {
42+
return (int)x;
43+
}
44+
45+
int a10(float x) {
46+
return (int)x;
47+
}
48+
49+
int a11(float x) {
50+
return (int)x;
51+
}
52+
53+
int a12(float x) {
54+
return (int)x;
55+
}
56+
57+
int a13(float x) {
58+
return (int)x;
59+
}
60+
61+
int a14(float x) {
62+
return (int)x;
63+
}
64+
65+
int a15(float x) {
66+
return (int)x;
67+
}
68+
69+
int a16(float x) {
70+
return (int)x;
71+
}
72+
73+
int a17(float x) {
74+
return (int)x;
75+
}
76+
77+
int a18(float x) {
78+
return (int)x;
79+
}
80+
81+
int a19(float x) {
82+
return (int)x;
83+
}
84+
85+
int a20(float x) {
86+
return (int)x;
87+
}
88+
89+
int a21(float x) {
90+
return (int)x;
91+
}
92+
93+
int a22(float x) {
94+
return (int)x;
95+
}
96+
97+
int a23(float x) {
98+
return (int)x;
99+
}
100+
101+
int a24(float x) {
102+
return (int)x;
103+
}
104+
105+
int a25(float x) {
106+
return (int)x;
107+
}
108+
109+
int a26(float x) {
110+
return (int)x;
111+
}
112+
113+
int a27(float x) {
114+
return (int)x;
115+
}
116+
117+
int a28(float x) {
118+
return (int)x;
119+
}
120+
121+
int a29(float x) {
122+
return (int)x;
123+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
int g(float x) {
2+
return (int)x;
3+
}

0 commit comments

Comments
 (0)