Skip to content

Commit 03d70b9

Browse files
committed
C#: Add another nuget.config integration test.
1 parent e29770c commit 03d70b9

9 files changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test-db/working/packages/newtonsoft.json/13.0.4/lib/net6.0/Newtonsoft.Json.dll:0:0:0:0 | Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import csharp
2+
3+
from Assembly a
4+
where exists(a.getFile().getAbsolutePath().indexOf("newtonsoft.json"))
5+
select a
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
| All NuGet feeds reachable | 1.0 |
2+
| Failed project restore with missing package error | 0.0 |
3+
| Failed project restore with package source error | 0.0 |
4+
| Failed solution restore with missing package error | 0.0 |
5+
| Failed solution restore with package source error | 0.0 |
6+
| Inherited NuGet feed count | 1.0 |
7+
| NuGet feed responsiveness checked | 1.0 |
8+
| Project files on filesystem | 1.0 |
9+
| Reachable fallback NuGet feed count | 1.0 |
10+
| Resolved assembly conflicts | 0.0 |
11+
| Resource extraction enabled | 0.0 |
12+
| Restored .NET framework variants | 1.0 |
13+
| Restored projects through solution files | 0.0 |
14+
| Solution files on filesystem | 0.0 |
15+
| Source files generated | 0.0 |
16+
| Source files on filesystem | 1.0 |
17+
| Successfully restored project files | 1.0 |
18+
| Successfully restored solution files | 0.0 |
19+
| Unresolved references | 0.0 |
20+
| UseWPF set | 0.0 |
21+
| UseWindowsForms set | 0.0 |
22+
| WebView extraction enabled | 1.0 |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import csharp
2+
import semmle.code.csharp.commons.Diagnostics
3+
4+
query predicate compilationInfo(string key, float value) {
5+
key != "Resolved references" and
6+
not key.matches("Compiler diagnostic count for%") and
7+
exists(Compilation c, string infoKey, string infoValue | infoValue = c.getInfo(infoKey) |
8+
key = infoKey and
9+
value = infoValue.toFloat()
10+
or
11+
not exists(infoValue.toFloat()) and
12+
key = infoKey + ": " + infoValue and
13+
value = 1
14+
)
15+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
</packageSources>
6+
</configuration>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "10.0.201"
4+
}
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Program { }
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFrameworks>net10.0</TargetFrameworks>
6+
</PropertyGroup>
7+
8+
<Target Name="DeleteBinObjFolders" BeforeTargets="Clean">
9+
<RemoveDir Directories=".\bin" />
10+
<RemoveDir Directories=".\obj" />
11+
</Target>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
15+
</ItemGroup>
16+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
import runs_on
3+
4+
5+
@runs_on.posix
6+
def test(codeql, csharp):
7+
# Making sure the reachability test of `nuget.org` succeeds:
8+
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_TIMEOUT"] = "1000"
9+
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_LIMIT"] = "5"
10+
11+
# This test checks that the nuget.config file in the clear folder is not applied to the restore of the project.
12+
codeql.database.create(build_mode="none")

0 commit comments

Comments
 (0)