mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Rust: exclude Comment nodes from lines of code counts
This commit is contained in:
@@ -4,6 +4,7 @@ private import codeql.Locations
|
||||
private import codeql.util.FileSystem
|
||||
private import codeql.rust.elements.SourceFile
|
||||
private import codeql.rust.elements.AstNode
|
||||
private import codeql.rust.elements.Comment
|
||||
|
||||
private module Input implements InputSig {
|
||||
abstract class ContainerBase extends @container {
|
||||
@@ -44,7 +45,9 @@ class File extends Container, Impl::File {
|
||||
result =
|
||||
count(int line |
|
||||
exists(AstNode node, Location loc |
|
||||
not node instanceof SourceFile and loc = node.getLocation()
|
||||
not node instanceof Comment and
|
||||
not node instanceof SourceFile and
|
||||
loc = node.getLocation()
|
||||
|
|
||||
node.getFile() = this and
|
||||
line = [loc.getStartLine(), loc.getEndLine()] and
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| Elements extracted | 204 |
|
||||
| Elements extracted | 210 |
|
||||
| Elements unextracted | 0 |
|
||||
| Files extracted | 6 |
|
||||
| Lines of code extracted | 48 |
|
||||
|
||||
Reference in New Issue
Block a user