Skip to content

Commit ba9c2f1

Browse files
committed
Rust: Add extractor warnings query.
1 parent 3fa52ad commit ba9c2f1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

rust/ql/lib/codeql/rust/Diagnostics.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ class Diagnostic extends @diagnostic {
5252
class ExtractionError extends Diagnostic {
5353
ExtractionError() { this.getTag() = "parse_error" }
5454
}
55+
56+
/** A diagnostic that is warning severity. */
57+
class ExtractionWarning extends Diagnostic {
58+
ExtractionWarning() { this.getSeverity() = 30 }
59+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @name Extraction warnings
3+
* @description List all extraction warnings for files in the source code directory.
4+
* @kind diagnostic
5+
* @id rust/diagnostics/extraction-warnings
6+
*/
7+
8+
import codeql.rust.Diagnostics
9+
import codeql.files.FileSystem
10+
11+
/** Gets the SARIF severity to associate with a warning. */
12+
int getSeverity() { result = 1 }
13+
14+
from ExtractionWarning warning, File f
15+
where
16+
f = warning.getLocation().getFile() and
17+
exists(f.getRelativePath())
18+
select warning, "Extraction warning in " + f + " with message " + warning.getMessage(),
19+
getSeverity()

0 commit comments

Comments
 (0)