mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Rust: Improve getNumberOfLinesOfCode (in particular, it will now include the closing of blocks { } ).
This commit is contained in:
@@ -40,6 +40,12 @@ class File extends Container, Impl::File {
|
||||
*/
|
||||
int getNumberOfLinesOfCode() {
|
||||
result =
|
||||
count(int line | exists(Location loc | loc.getFile() = this and loc.getStartLine() = line and not loc instanceof EmptyLocation))
|
||||
count(int line |
|
||||
exists(Location loc |
|
||||
loc.getFile() = this and
|
||||
line = [loc.getStartLine(), loc.getEndLine()] and
|
||||
not loc instanceof EmptyLocation
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
| 6806 |
|
||||
| 13437 |
|
||||
|
||||
@@ -1 +1 @@
|
||||
| 16 |
|
||||
| 24 |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
| my_struct.rs:0:0:0:0 | my_struct.rs | 8 |
|
||||
| main.rs:0:0:0:0 | main.rs | 3 |
|
||||
| does_not_compile.rs:0:0:0:0 | does_not_compile.rs | 2 |
|
||||
| my_macro.rs:0:0:0:0 | my_macro.rs | 2 |
|
||||
| error.rs:0:0:0:0 | error.rs | 1 |
|
||||
| my_struct.rs:0:0:0:0 | my_struct.rs | 11 |
|
||||
| main.rs:0:0:0:0 | main.rs | 4 |
|
||||
| my_macro.rs:0:0:0:0 | my_macro.rs | 4 |
|
||||
| does_not_compile.rs:0:0:0:0 | does_not_compile.rs | 3 |
|
||||
| error.rs:0:0:0:0 | error.rs | 2 |
|
||||
| lib.rs:0:0:0:0 | lib.rs | 0 |
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
| Lines of code | 6806 |
|
||||
| Lines of user code | 16 |
|
||||
| Lines of code | 13437 |
|
||||
| Lines of user code | 24 |
|
||||
|
||||
Reference in New Issue
Block a user