forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiagnostics.qll
More file actions
80 lines (66 loc) · 2.68 KB
/
Diagnostics.qll
File metadata and controls
80 lines (66 loc) · 2.68 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/** Provides definitions related to the namespace `System.Diagnostics`. */
import semmle.code.csharp.Type
private import semmle.code.csharp.frameworks.System
/** The `System.Diagnostics` namespace. */
class SystemDiagnosticsNamespace extends Namespace {
SystemDiagnosticsNamespace() {
this.getParentNamespace() instanceof SystemNamespace and
this.hasName("Diagnostics")
}
}
/** The `System.Diagnostics.CodeAnalysis` namespace. */
class SystemDiagnosticsCodeAnalysisNamespace extends Namespace {
SystemDiagnosticsCodeAnalysisNamespace() {
this.getParentNamespace() instanceof SystemDiagnosticsNamespace and
this.hasName("CodeAnalysis")
}
}
/** A class in the `System.Diagnostics` namespace. */
class SystemDiagnosticsClass extends Class {
SystemDiagnosticsClass() { this.getNamespace() instanceof SystemDiagnosticsNamespace }
}
/** A class in the `System.Diagnostics.CodeAnalysis` namespace. */
class SystemDiagnosticsCodeAnalysisClass extends Class {
SystemDiagnosticsCodeAnalysisClass() {
this.getNamespace() instanceof SystemDiagnosticsCodeAnalysisNamespace
}
}
/** The `System.Diagnostics.Debug` class. */
class SystemDiagnosticsDebugClass extends SystemDiagnosticsClass {
SystemDiagnosticsDebugClass() {
this.hasName("Debug") and
this.isStatic()
}
/** Gets an `Assert(bool, ...)` method. */
Method getAssertMethod() {
result.getDeclaringType() = this and
result.hasName("Assert")
}
}
/** The `System.Diagnostics.ProcessStartInfo` class. */
class SystemDiagnosticsProcessStartInfoClass extends SystemDiagnosticsClass {
SystemDiagnosticsProcessStartInfoClass() { this.hasName("ProcessStartInfo") }
/** Gets the `Arguments` property. */
Property getArgumentsProperty() { result = this.getProperty("Arguments") }
/** Gets the `FileName` property. */
Property getFileNameProperty() { result = this.getProperty("FileName") }
/** Gets the `WorkingDirectory` property. */
Property getWorkingDirectoryProperty() { result = this.getProperty("WorkingDirectory") }
}
/** The `System.Diagnostics.Process` class. */
class SystemDiagnosticsProcessClass extends SystemDiagnosticsClass {
SystemDiagnosticsProcessClass() { this.hasName("Process") }
/** Get a `Start( ...)` method. */
Method getAStartMethod() {
result.getDeclaringType() = this and
result.hasName("Start") and
result.getReturnType() instanceof SystemDiagnosticsProcessClass
}
}
/** The `System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute` class. */
class SystemDiagnosticsCodeAnalysisDoesNotReturnIfAttributeClass extends SystemDiagnosticsCodeAnalysisClass
{
SystemDiagnosticsCodeAnalysisDoesNotReturnIfAttributeClass() {
this.hasName("DoesNotReturnIfAttribute")
}
}