Configuration for scanning blazor razor files

We are using blazor within our project, specifically blazor webassembly but i assume this would be an issue for blazor server side as well.

At the moment sonar cloud is ignoring these files

Blazor files are .razor extension which do not curently sit under any language in the scanner.

A blazor razor file contains a combination of both html and c# code as such i intially thought the fix would be to add the .razor extension to both the c# language and html langauge suffixes list but this gives the following errror

Language of file ‘Component.razor’ can not be decided as the file matches patterns of both sonar.lang.patterns.cs : **/*.cs,**/*.razor and sonar.lang.patterns.web : **/*.html,**/*.xhtml,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml,**/*.cmp,**/*.twig,**/*.razor

So it seems i cant scan for both C# and html issues

Following the fact that cshtml is under html for now i have put .razor under that but given that with blazor the amount of code in a razor file is much much higher than if you were for example doing mvc with a few helpers etc this feels wrong and im missing out on static analysis for the C# code, the same is true through if i reverse this. (although it didnt seem to pick up any lines of code when its under the c# language in my test)

Is there a recomendation for how to handle blazor .razor files? Has anyone had any luck with analyzing blazor projects?

Is there a plan to add support for these file types where there is multiple languages / code sets in a single file?


Sorry but we just don’t support .razor files yet.