From da3c5f44f241337b99a7c64d59fd1c7bd33ba2f4 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Wed, 11 Sep 2024 16:13:39 +0200 Subject: [PATCH] C#: Include `.razor` files in `File::fromSource` --- csharp/ql/integration-tests/all-platforms/cshtml/Files.ql | 2 +- csharp/ql/lib/semmle/code/csharp/File.qll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/ql/integration-tests/all-platforms/cshtml/Files.ql b/csharp/ql/integration-tests/all-platforms/cshtml/Files.ql index 3933d037ed5d..bea5557a25f1 100644 --- a/csharp/ql/integration-tests/all-platforms/cshtml/Files.ql +++ b/csharp/ql/integration-tests/all-platforms/cshtml/Files.ql @@ -1,5 +1,5 @@ import csharp from File f -where f.fromSource() or f.getExtension() = "cshtml" +where f.fromSource() select f diff --git a/csharp/ql/lib/semmle/code/csharp/File.qll b/csharp/ql/lib/semmle/code/csharp/File.qll index 3e1a0ca477b5..464e08cebb48 100644 --- a/csharp/ql/lib/semmle/code/csharp/File.qll +++ b/csharp/ql/lib/semmle/code/csharp/File.qll @@ -61,7 +61,7 @@ class File extends Container, Impl::File { /** Holds if this file contains source code. */ final predicate fromSource() { - this.getExtension() = ["cs", "cshtml"] and + this.getExtension() = ["cs", "cshtml", "razor"] and not this.isStub() }