Skip to content

Commit dc6def7

Browse files
committed
C#: Split API name column into separate columns
1 parent 0fea21f commit dc6def7

File tree

5 files changed

+45
-50
lines changed

5 files changed

+45
-50
lines changed

csharp/ql/src/utils/modeleditor/ApplicationModeEndpoints.ql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ import ModelEditor
1212

1313
private Call aUsage(ExternalEndpoint api) { result.getTarget().getUnboundDeclaration() = api }
1414

15-
from
16-
ExternalEndpoint endpoint, string apiName, boolean supported, Call usage, string type,
17-
string classification
15+
from ExternalEndpoint endpoint, boolean supported, Call usage, string type, string classification
1816
where
19-
apiName = endpoint.getApiName() and
2017
supported = isSupported(endpoint) and
2118
usage = aUsage(endpoint) and
2219
type = supportedType(endpoint) and
2320
classification = methodClassification(usage)
24-
select usage, apiName, supported, endpoint.dllName(), endpoint.dllVersion(), type, classification
21+
select usage, endpoint.getNamespace(), endpoint.getTypeName(), endpoint.getName(),
22+
endpoint.getParameterTypes(), supported, endpoint.dllName(), endpoint.dllVersion(), type,
23+
classification

csharp/ql/src/utils/modeleditor/FrameworkModeEndpoints.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import csharp
1010
import FrameworkModeEndpointsQuery
1111
import ModelEditor
1212

13-
from PublicEndpointFromSource endpoint, string apiName, boolean supported, string type
13+
from PublicEndpointFromSource endpoint, boolean supported, string type
1414
where
15-
apiName = endpoint.getApiName() and
1615
supported = isSupported(endpoint) and
1716
type = supportedType(endpoint)
18-
select endpoint, apiName, supported, endpoint.getFile().getBaseName(), type
17+
select endpoint, endpoint.getNamespace(), endpoint.getTypeName(), endpoint.getName(),
18+
endpoint.getParameterTypes(), supported, endpoint.getFile().getBaseName(), type

csharp/ql/src/utils/modeleditor/ModelEditor.qll

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,22 @@ class Endpoint extends Callable {
2525
}
2626

2727
/**
28-
* Gets the unbound type, name and parameter types of this API.
28+
* Gets the namespace of this endpoint.
2929
*/
3030
bindingset[this]
31-
private string getSignature() {
32-
result =
33-
nestedName(this.getDeclaringType().getUnboundDeclaration()) + "#" + this.getName() + "(" +
34-
parameterQualifiedTypeNamesToString(this) + ")"
35-
}
31+
string getNamespace() { this.getDeclaringType().hasQualifiedName(result, _) }
3632

3733
/**
38-
* Gets the namespace of this API.
34+
* Gets the unbound type name of this endpoint.
3935
*/
4036
bindingset[this]
41-
string getNamespace() { this.getDeclaringType().hasQualifiedName(result, _) }
37+
string getTypeName() { result = nestedName(this.getDeclaringType().getUnboundDeclaration()) }
4238

4339
/**
44-
* Gets the namespace and signature of this API.
40+
* Gets the parameter types of this endpoint.
4541
*/
4642
bindingset[this]
47-
string getApiName() { result = this.getNamespace() + "." + this.getSignature() }
43+
string getParameterTypes() { result = parameterQualifiedTypeNamesToString(this) }
4844

4945
private string getDllName() { result = this.getLocation().(Assembly).getName() }
5046

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
| NonPublicClass.cs:9:9:9:31 | call to method WriteLine | System.Console#WriteLine(System.String) | true | System.Console | 7.0.0.0 | neutral | source |
2-
| PublicClass.cs:9:9:9:30 | call to method WriteLine | System.Console#WriteLine(System.String) | true | System.Console | 7.0.0.0 | neutral | source |
3-
| PublicClass.cs:14:9:14:30 | call to method WriteLine | System.Console#WriteLine(System.String) | true | System.Console | 7.0.0.0 | neutral | source |
4-
| PublicClass.cs:19:9:19:51 | call to method WriteLine | System.Console#WriteLine(System.String) | true | System.Console | 7.0.0.0 | neutral | source |
5-
| PublicClass.cs:19:33:19:50 | call to method ReadLine | System.Console#ReadLine() | true | System.Console | 7.0.0.0 | neutral | source |
6-
| PublicClass.cs:19:33:19:50 | call to method ReadLine | System.Console#ReadLine() | true | System.Console | 7.0.0.0 | source | source |
7-
| PublicClass.cs:24:9:24:46 | call to method Write | System.Console#Write(System.Object) | true | System.Console | 7.0.0.0 | neutral | source |
8-
| PublicClass.cs:24:23:24:45 | access to property BackgroundColor | System.Console#get_BackgroundColor() | true | System.Console | 7.0.0.0 | neutral | source |
9-
| PublicClass.cs:25:9:25:31 | access to property ForegroundColor | System.Console#set_ForegroundColor(System.ConsoleColor) | true | System.Console | 7.0.0.0 | neutral | source |
10-
| PublicClass.cs:30:9:30:30 | call to method WriteLine | System.Console#WriteLine(System.String) | true | System.Console | 7.0.0.0 | neutral | source |
11-
| PublicGenericClass.cs:9:9:9:30 | call to method WriteLine | System.Console#WriteLine(System.Object) | true | System.Console | 7.0.0.0 | neutral | source |
12-
| PublicGenericClass.cs:14:9:14:30 | call to method WriteLine | System.Console#WriteLine(System.Object) | true | System.Console | 7.0.0.0 | neutral | source |
13-
| PublicGenericInterface.cs:13:9:13:30 | call to method WriteLine | System.Console#WriteLine(System.String) | true | System.Console | 7.0.0.0 | neutral | source |
14-
| PublicInterface.cs:13:9:13:30 | call to method WriteLine | System.Console#WriteLine(System.String) | true | System.Console | 7.0.0.0 | neutral | source |
1+
| NonPublicClass.cs:9:9:9:31 | call to method WriteLine | System | Console | WriteLine | System.String | true | System.Console | 7.0.0.0 | neutral | source |
2+
| PublicClass.cs:9:9:9:30 | call to method WriteLine | System | Console | WriteLine | System.String | true | System.Console | 7.0.0.0 | neutral | source |
3+
| PublicClass.cs:14:9:14:30 | call to method WriteLine | System | Console | WriteLine | System.String | true | System.Console | 7.0.0.0 | neutral | source |
4+
| PublicClass.cs:19:9:19:51 | call to method WriteLine | System | Console | WriteLine | System.String | true | System.Console | 7.0.0.0 | neutral | source |
5+
| PublicClass.cs:19:33:19:50 | call to method ReadLine | System | Console | ReadLine | | true | System.Console | 7.0.0.0 | neutral | source |
6+
| PublicClass.cs:19:33:19:50 | call to method ReadLine | System | Console | ReadLine | | true | System.Console | 7.0.0.0 | source | source |
7+
| PublicClass.cs:24:9:24:46 | call to method Write | System | Console | Write | System.Object | true | System.Console | 7.0.0.0 | neutral | source |
8+
| PublicClass.cs:24:23:24:45 | access to property BackgroundColor | System | Console | get_BackgroundColor | | true | System.Console | 7.0.0.0 | neutral | source |
9+
| PublicClass.cs:25:9:25:31 | access to property ForegroundColor | System | Console | set_ForegroundColor | System.ConsoleColor | true | System.Console | 7.0.0.0 | neutral | source |
10+
| PublicClass.cs:30:9:30:30 | call to method WriteLine | System | Console | WriteLine | System.String | true | System.Console | 7.0.0.0 | neutral | source |
11+
| PublicGenericClass.cs:9:9:9:30 | call to method WriteLine | System | Console | WriteLine | System.Object | true | System.Console | 7.0.0.0 | neutral | source |
12+
| PublicGenericClass.cs:14:9:14:30 | call to method WriteLine | System | Console | WriteLine | System.Object | true | System.Console | 7.0.0.0 | neutral | source |
13+
| PublicGenericInterface.cs:13:9:13:30 | call to method WriteLine | System | Console | WriteLine | System.String | true | System.Console | 7.0.0.0 | neutral | source |
14+
| PublicInterface.cs:13:9:13:30 | call to method WriteLine | System | Console | WriteLine | System.String | true | System.Console | 7.0.0.0 | neutral | source |
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
| PublicClass.cs:7:17:7:21 | stuff | GitHub.CodeQL.PublicClass#stuff(System.String) | false | PublicClass.cs | |
2-
| PublicClass.cs:12:24:12:34 | staticStuff | GitHub.CodeQL.PublicClass#staticStuff(System.String) | false | PublicClass.cs | |
3-
| PublicClass.cs:17:20:17:33 | protectedStuff | GitHub.CodeQL.PublicClass#protectedStuff(System.String) | false | PublicClass.cs | |
4-
| PublicClass.cs:33:45:33:47 | get_PublicProperty | GitHub.CodeQL.PublicClass#get_PublicProperty() | false | PublicClass.cs | |
5-
| PublicClass.cs:33:50:33:52 | set_PublicProperty | GitHub.CodeQL.PublicClass#set_PublicProperty(System.String) | false | PublicClass.cs | |
6-
| PublicClass.cs:35:19:35:30 | summaryStuff | GitHub.CodeQL.PublicClass#summaryStuff(System.String) | true | PublicClass.cs | summary |
7-
| PublicClass.cs:40:19:40:29 | sourceStuff | GitHub.CodeQL.PublicClass#sourceStuff() | true | PublicClass.cs | source |
8-
| PublicClass.cs:45:17:45:25 | sinkStuff | GitHub.CodeQL.PublicClass#sinkStuff(System.String) | true | PublicClass.cs | sink |
9-
| PublicClass.cs:50:17:50:28 | neutralStuff | GitHub.CodeQL.PublicClass#neutralStuff(System.String) | true | PublicClass.cs | neutral |
10-
| PublicGenericClass.cs:7:17:7:21 | stuff | GitHub.CodeQL.PublicGenericClass<,>#stuff(T) | false | PublicGenericClass.cs | |
11-
| PublicGenericClass.cs:12:17:12:26 | stuff2<> | GitHub.CodeQL.PublicGenericClass<,>#stuff2<>(T2) | false | PublicGenericClass.cs | |
12-
| PublicGenericInterface.cs:7:10:7:14 | stuff | GitHub.CodeQL.PublicGenericInterface<>#stuff(T) | false | PublicGenericInterface.cs | |
13-
| PublicGenericInterface.cs:9:10:9:19 | stuff2<> | GitHub.CodeQL.PublicGenericInterface<>#stuff2<>(T2) | false | PublicGenericInterface.cs | |
14-
| PublicGenericInterface.cs:11:17:11:27 | staticStuff | GitHub.CodeQL.PublicGenericInterface<>#staticStuff(System.String) | false | PublicGenericInterface.cs | |
15-
| PublicInterface.cs:7:10:7:14 | stuff | GitHub.CodeQL.PublicInterface#stuff(System.String) | false | PublicInterface.cs | |
16-
| PublicInterface.cs:9:29:9:31 | get_PublicProperty | GitHub.CodeQL.PublicInterface#get_PublicProperty() | false | PublicInterface.cs | |
17-
| PublicInterface.cs:9:34:9:36 | set_PublicProperty | GitHub.CodeQL.PublicInterface#set_PublicProperty(System.String) | false | PublicInterface.cs | |
18-
| PublicInterface.cs:11:17:11:27 | staticStuff | GitHub.CodeQL.PublicInterface#staticStuff(System.String) | false | PublicInterface.cs | |
1+
| PublicClass.cs:7:17:7:21 | stuff | GitHub.CodeQL | PublicClass | stuff | System.String | false | PublicClass.cs | |
2+
| PublicClass.cs:12:24:12:34 | staticStuff | GitHub.CodeQL | PublicClass | staticStuff | System.String | false | PublicClass.cs | |
3+
| PublicClass.cs:17:20:17:33 | protectedStuff | GitHub.CodeQL | PublicClass | protectedStuff | System.String | false | PublicClass.cs | |
4+
| PublicClass.cs:33:45:33:47 | get_PublicProperty | GitHub.CodeQL | PublicClass | get_PublicProperty | | false | PublicClass.cs | |
5+
| PublicClass.cs:33:50:33:52 | set_PublicProperty | GitHub.CodeQL | PublicClass | set_PublicProperty | System.String | false | PublicClass.cs | |
6+
| PublicClass.cs:35:19:35:30 | summaryStuff | GitHub.CodeQL | PublicClass | summaryStuff | System.String | true | PublicClass.cs | summary |
7+
| PublicClass.cs:40:19:40:29 | sourceStuff | GitHub.CodeQL | PublicClass | sourceStuff | | true | PublicClass.cs | source |
8+
| PublicClass.cs:45:17:45:25 | sinkStuff | GitHub.CodeQL | PublicClass | sinkStuff | System.String | true | PublicClass.cs | sink |
9+
| PublicClass.cs:50:17:50:28 | neutralStuff | GitHub.CodeQL | PublicClass | neutralStuff | System.String | true | PublicClass.cs | neutral |
10+
| PublicGenericClass.cs:7:17:7:21 | stuff | GitHub.CodeQL | PublicGenericClass<,> | stuff | T | false | PublicGenericClass.cs | |
11+
| PublicGenericClass.cs:12:17:12:26 | stuff2<> | GitHub.CodeQL | PublicGenericClass<,> | stuff2<> | T2 | false | PublicGenericClass.cs | |
12+
| PublicGenericInterface.cs:7:10:7:14 | stuff | GitHub.CodeQL | PublicGenericInterface<> | stuff | T | false | PublicGenericInterface.cs | |
13+
| PublicGenericInterface.cs:9:10:9:19 | stuff2<> | GitHub.CodeQL | PublicGenericInterface<> | stuff2<> | T2 | false | PublicGenericInterface.cs | |
14+
| PublicGenericInterface.cs:11:17:11:27 | staticStuff | GitHub.CodeQL | PublicGenericInterface<> | staticStuff | System.String | false | PublicGenericInterface.cs | |
15+
| PublicInterface.cs:7:10:7:14 | stuff | GitHub.CodeQL | PublicInterface | stuff | System.String | false | PublicInterface.cs | |
16+
| PublicInterface.cs:9:29:9:31 | get_PublicProperty | GitHub.CodeQL | PublicInterface | get_PublicProperty | | false | PublicInterface.cs | |
17+
| PublicInterface.cs:9:34:9:36 | set_PublicProperty | GitHub.CodeQL | PublicInterface | set_PublicProperty | System.String | false | PublicInterface.cs | |
18+
| PublicInterface.cs:11:17:11:27 | staticStuff | GitHub.CodeQL | PublicInterface | staticStuff | System.String | false | PublicInterface.cs | |

0 commit comments

Comments
 (0)