Skip to content

Commit 88f6e04

Browse files
committed
Make Resx extraction opt-in
1 parent b560ab1 commit 88f6e04

File tree

6 files changed

+36
-4
lines changed

6 files changed

+36
-4
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SourceGenerators/ResxGenerator.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public ResxGenerator(
3838
protected override bool IsEnabled()
3939
{
4040
var resourceExtractionOption = Environment.GetEnvironmentVariable(EnvironmentVariableNames.ResourceGeneration);
41-
if (resourceExtractionOption == null ||
42-
bool.TryParse(resourceExtractionOption, out var shouldExtractResources) &&
41+
if (bool.TryParse(resourceExtractionOption, out var shouldExtractResources) &&
4342
shouldExtractResources)
4443
{
4544
compilationInfoContainer.CompilationInfos.Add(("Resource extraction enabled", "1"));
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
| Failed project restore with package source error | 0.0 |
2+
| Failed solution restore with package source error | 0.0 |
3+
| Project files on filesystem | 1.0 |
4+
| Resolved assembly conflicts | 0.0 |
5+
| Resource extraction enabled | 1.0 |
6+
| Restored .NET framework variants | 1.0 |
7+
| Restored projects through solution files | 0.0 |
8+
| Solution files on filesystem | 0.0 |
9+
| Source files generated | 2.0 |
10+
| Source files on filesystem | 1.0 |
11+
| Successfully restored project files | 1.0 |
12+
| Successfully restored solution files | 0.0 |
13+
| Unresolved references | 0.0 |
14+
| UseWPF set | 0.0 |
15+
| UseWindowsForms set | 0.0 |
16+
| 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import os
22
from create_database_utils import *
33

4+
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_EXTRACT_RESOURCES"] = "true"
5+
46
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"])

csharp/ql/integration-tests/posix-only/standalone_dependencies_nuget_config_error/CompilationInfo.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
| Fallback nuget restore | 1.0 |
44
| Project files on filesystem | 1.0 |
55
| Resolved assembly conflicts | 7.0 |
6-
| Resource extraction enabled | 1.0 |
6+
| Resource extraction enabled | 0.0 |
77
| Restored .NET framework variants | 0.0 |
88
| Restored projects through solution files | 0.0 |
99
| Solution files on filesystem | 1.0 |

csharp/ql/integration-tests/posix-only/standalone_dependencies_nuget_config_error_timeout/CompilationInfo.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
| Inherited Nuget feed count | 1.0 |
44
| Project files on filesystem | 1.0 |
55
| Resolved assembly conflicts | 7.0 |
6-
| Resource extraction enabled | 1.0 |
6+
| Resource extraction enabled | 0.0 |
77
| Restored .NET framework variants | 0.0 |
88
| Solution files on filesystem | 1.0 |
99
| Source files generated | 0.0 |

0 commit comments

Comments
 (0)