filter out Controller suffixed class in non asp.net projects

This commit is contained in:
Jaroslav Lobačevski
2022-06-02 15:05:17 +03:00
committed by Michael Nebel
parent 3d281fbb71
commit 853a80bdbc

View File

@@ -194,9 +194,16 @@ class MicrosoftAspNetCoreMvcControllerBaseClass extends Class {
} }
} }
/** A subtype of `Microsoft.AspNetCore.Mvc.Controller` or `Microsoft.AspNetCore.Mvc.ControllerBase`. */ /** A valid ASP.NET Core controller according to https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/actions?view=aspnetcore-3.1 */
class MicrosoftAspNetCoreMvcController extends Class { class MicrosoftAspNetCoreMvcController extends Class {
MicrosoftAspNetCoreMvcController() { MicrosoftAspNetCoreMvcController() {
exists(Assembly a, string name |
a.getName() = name and
(
name = "Microsoft.AspNetCore.Mvc.Core" or
name = "Microsoft.AspNetCore.Mvc.ViewFeatures"
)
) and
( (
this.getABaseType*() instanceof MicrosoftAspNetCoreMvcControllerBaseClass or this.getABaseType*() instanceof MicrosoftAspNetCoreMvcControllerBaseClass or
this.getABaseType*().getName().matches("%Controller") or this.getABaseType*().getName().matches("%Controller") or