Skip to content

Commit 0cc74a2

Browse files
committed
C#: Extract TestLibrary to separate module
1 parent 585fb9d commit 0cc74a2

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

csharp/ql/src/Telemetry/ExternalApi.qll

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,7 @@ 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.security.dataflow.flowsources.Remote
1414

15-
pragma[nomagic]
16-
private predicate isTestNamespace(Namespace ns) {
17-
ns.getFullName()
18-
.matches([
19-
"NUnit.Framework%", "Xunit%", "Microsoft.VisualStudio.TestTools.UnitTesting%", "Moq%"
20-
])
21-
}
22-
23-
/**
24-
* A test library.
25-
*/
26-
class TestLibrary extends RefType {
27-
TestLibrary() { isTestNamespace(this.getNamespace()) }
28-
}
15+
private import TestLibrary
2916

3017
/** Holds if the given callable is not worth supporting. */
3118
private predicate isUninteresting(DotNet::Callable c) {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
private import csharp
2+
private import dotnet
3+
4+
pragma[nomagic]
5+
private predicate isTestNamespace(Namespace ns) {
6+
ns.getFullName()
7+
.matches([
8+
"NUnit.Framework%", "Xunit%", "Microsoft.VisualStudio.TestTools.UnitTesting%", "Moq%"
9+
])
10+
}
11+
12+
/**
13+
* A test library.
14+
*/
15+
class TestLibrary extends RefType {
16+
TestLibrary() { isTestNamespace(this.getNamespace()) }
17+
}

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

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,7 @@ 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
1515

16-
pragma[nomagic]
17-
private predicate isTestNamespace(Namespace ns) {
18-
ns.getFullName()
19-
.matches([
20-
"NUnit.Framework%", "Xunit%", "Microsoft.VisualStudio.TestTools.UnitTesting%", "Moq%"
21-
])
22-
}
23-
24-
/**
25-
* A test library.
26-
*/
27-
class TestLibrary extends RefType {
28-
TestLibrary() { isTestNamespace(this.getNamespace()) }
29-
}
16+
private import Telemetry.TestLibrary
3017

3118
/** Holds if the given callable is not worth supporting. */
3219
private predicate isUninteresting(DotNet::Declaration c) {

0 commit comments

Comments
 (0)