From a03b23214de2ecbefcea9c020ebe1916fbaf535b Mon Sep 17 00:00:00 2001 From: Ed Minnix Date: Thu, 19 Dec 2024 09:52:39 -0500 Subject: [PATCH] Simplify generated file paths --- .../blazor_build_mode_none/Files.ql | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/csharp/ql/integration-tests/all-platforms/blazor_build_mode_none/Files.ql b/csharp/ql/integration-tests/all-platforms/blazor_build_mode_none/Files.ql index ab0553607253..b3e2a420026d 100644 --- a/csharp/ql/integration-tests/all-platforms/blazor_build_mode_none/Files.ql +++ b/csharp/ql/integration-tests/all-platforms/blazor_build_mode_none/Files.ql @@ -1,5 +1,19 @@ import csharp +private string getPath(File f) { + result = f.getRelativePath() and + not exists(result.indexOf("_ql_csharp_ql_integration_tests_blazor_build_mode_none_")) + or + exists(int index1, int index2, string pattern | + pattern = "Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator" and + index1 = f.getRelativePath().indexOf(pattern) and + index2 = f.getRelativePath().indexOf("_ql_csharp_ql_integration_tests_blazor_build_mode_none_") and + result = + f.getRelativePath().substring(0, index1 + pattern.length()) + "/[...]" + + f.getRelativePath().substring(index2, f.getRelativePath().length()) + ) +} + from File f where f.fromSource() or f.getExtension() = "razor" -select f +select getPath(f)