Skip to content

Commit 4693f72

Browse files
committed
C#: Rename CallableMethod to Endpoint
1 parent f468b2a commit 4693f72

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ private import semmle.code.csharp.dataflow.internal.FlowSummaryImpl as FlowSumma
1212
private import semmle.code.csharp.dataflow.internal.TaintTrackingPrivate
1313
private import semmle.code.csharp.frameworks.Test
1414
private import semmle.code.csharp.security.dataflow.flowsources.Remote
15-
1615
private import Telemetry.TestLibrary
1716

1817
/** Holds if the given callable is not worth supporting. */
@@ -25,8 +24,8 @@ private predicate isUninteresting(DotNet::Callable c) {
2524
/**
2625
* An callable method from either the C# Standard Library, a 3rd party library, or from the source.
2726
*/
28-
class CallableMethod extends DotNet::Callable {
29-
CallableMethod() {
27+
class Endpoint extends DotNet::Callable {
28+
Endpoint() {
3029
[this.(Modifiable), this.(Accessor).getDeclaration()].isEffectivelyPublic() and
3130
not isUninteresting(this)
3231
}
@@ -121,23 +120,23 @@ class CallableMethod extends DotNet::Callable {
121120
}
122121
}
123122

124-
boolean isSupported(CallableMethod callableMethod) {
125-
callableMethod.isSupported() and result = true
123+
boolean isSupported(Endpoint endpoint) {
124+
endpoint.isSupported() and result = true
126125
or
127-
not callableMethod.isSupported() and
126+
not endpoint.isSupported() and
128127
result = false
129128
}
130129

131-
string supportedType(CallableMethod method) {
132-
method.isSink() and result = "sink"
130+
string supportedType(Endpoint endpoint) {
131+
endpoint.isSink() and result = "sink"
133132
or
134-
method.isSource() and result = "source"
133+
endpoint.isSource() and result = "source"
135134
or
136-
method.hasSummary() and result = "summary"
135+
endpoint.hasSummary() and result = "summary"
137136
or
138-
method.isNeutral() and result = "neutral"
137+
endpoint.isNeutral() and result = "neutral"
139138
or
140-
not method.isSupported() and result = ""
139+
not endpoint.isSupported() and result = ""
141140
}
142141

143142
string methodClassification(Call method) {

csharp/ql/src/utils/modeleditor/FetchApplicationModeMethods.ql

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@
1010
private import csharp
1111
private import AutomodelVsCode
1212

13-
class ExternalApi extends CallableMethod {
14-
ExternalApi() {
13+
class ExternalEndpoint extends Endpoint {
14+
ExternalEndpoint() {
1515
this.isUnboundDeclaration() and
1616
this.fromLibrary()
1717
}
1818
}
1919

20-
private Call aUsage(ExternalApi api) { result.getTarget().getUnboundDeclaration() = api }
20+
private Call aUsage(ExternalEndpoint api) { result.getTarget().getUnboundDeclaration() = api }
2121

2222
from
23-
ExternalApi api, string apiName, boolean supported, Call usage, string type, string classification
23+
ExternalEndpoint endpoint, string apiName, boolean supported, Call usage, string type,
24+
string classification
2425
where
25-
apiName = api.getApiName() and
26-
supported = isSupported(api) and
27-
usage = aUsage(api) and
28-
type = supportedType(api) and
26+
apiName = endpoint.getApiName() and
27+
supported = isSupported(endpoint) and
28+
usage = aUsage(endpoint) and
29+
type = supportedType(endpoint) and
2930
classification = methodClassification(usage)
30-
select usage, apiName, supported.toString(), "supported", api.dllName(), api.dllVersion(), type,
31-
"type", classification, "classification"
31+
select usage, apiName, supported.toString(), "supported", endpoint.dllName(), endpoint.dllVersion(),
32+
type, "type", classification, "classification"

csharp/ql/src/utils/modeleditor/FetchFrameworkModeMethods.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ private import dotnet
1212
private import semmle.code.csharp.frameworks.Test
1313
private import AutomodelVsCode
1414

15-
class PublicMethod extends CallableMethod {
16-
PublicMethod() { this.fromSource() and not this.getFile() instanceof TestFile }
15+
class PublicEndpointFromSource extends Endpoint {
16+
PublicEndpointFromSource() { this.fromSource() and not this.getFile() instanceof TestFile }
1717
}
1818

19-
from PublicMethod publicMethod, string apiName, boolean supported, string type
19+
from PublicEndpointFromSource endpoint, string apiName, boolean supported, string type
2020
where
21-
apiName = publicMethod.getApiName() and
22-
supported = isSupported(publicMethod) and
23-
type = supportedType(publicMethod)
24-
select publicMethod, apiName, supported.toString(), "supported",
25-
publicMethod.getFile().getBaseName(), "library", type, "type", "unknown", "classification"
21+
apiName = endpoint.getApiName() and
22+
supported = isSupported(endpoint) and
23+
type = supportedType(endpoint)
24+
select endpoint, apiName, supported.toString(), "supported", endpoint.getFile().getBaseName(),
25+
"library", type, "type", "unknown", "classification"

0 commit comments

Comments
 (0)