Simplify generated file paths

This commit is contained in:
Ed Minnix
2024-12-19 09:52:39 -05:00
parent 9089c9ca16
commit e9ac32fbd1

View File

@@ -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)