-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDiagnostics.qll
More file actions
61 lines (49 loc) · 1.72 KB
/
Diagnostics.qll
File metadata and controls
61 lines (49 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/** Provides classes relating to extraction diagnostics. */
private import codeql.Locations
private import codeql.rust.elements.internal.LocationImpl
/** A diagnostic emitted during extraction, such as a parse error */
class Diagnostic extends @diagnostic {
int severity;
string tag;
string message;
string fullMessage;
Location location;
Diagnostic() {
exists(@location_default loc |
diagnostics(this, severity, tag, message, fullMessage, loc) and
location = LocationImpl::TLocationDefault(loc)
)
}
/**
* Gets the numerical severity level associated with this diagnostic.
*/
int getSeverity() { result = severity }
/** Gets a string representation of the severity of this diagnostic. */
string getSeverityText() {
severity = 10 and result = "Debug"
or
severity = 20 and result = "Info"
or
severity = 30 and result = "Warning"
or
severity = 40 and result = "Error"
}
/** Gets the error code associated with this diagnostic, e.g. parse_error. */
string getTag() { result = tag }
/**
* Gets the error message text associated with this diagnostic.
*/
string getMessage() { result = message }
/**
* Gets the full error message text associated with this diagnostic.
*/
string getFullMessage() { result = fullMessage }
/** Gets the source location of this diagnostic. */
Location getLocation() { result = location }
/** Gets a textual representation of this diagnostic. */
string toString() { result = this.getMessage() }
}
/** A diagnostic that is error severity. */
class ExtractionError extends Diagnostic, @diagnostic_error { }
/** A diagnostic that is warning severity. */
class ExtractionWarning extends Diagnostic, @diagnostic_warning { }