Skip to content

Commit ffc36e4

Browse files
authored
Merge pull request #15085 from michaelnebel/csharp/telemetrycalls
C#: Telemetry should only count calls in source.
2 parents 16e8613 + 8218f80 commit ffc36e4

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

csharp/ql/src/Telemetry/ExternalApi.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ module Results<relevantApi/1 getRelevantUsages> {
134134
strictcount(Call c, ExternalApi api |
135135
c.getTarget().getUnboundDeclaration() = api and
136136
apiName = api.getApiName() and
137-
getRelevantUsages(api)
137+
getRelevantUsages(api) and
138+
c.fromSource()
138139
)
139140
}
140141

csharp/ql/src/Telemetry/ExternalLibraryUsage.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ private predicate getRelevantUsages(string namespace, int usages) {
1414
usages =
1515
strictcount(Call c, ExternalApi api |
1616
c.getTarget().getUnboundDeclaration() = api and
17-
api.getNamespace() = namespace
17+
api.getNamespace() = namespace and
18+
c.fromSource()
1819
)
1920
}
2021

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
semmle-extractor-options: /r:System.Collections.Specialized.dll
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
23
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Web.cs
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
semmle-extractor-options: /r:System.Collections.Specialized.dll
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
23
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Web.cs
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj

0 commit comments

Comments
 (0)