Javascript rules for .cshtml

Hi Community,

I need some suggestion. In our organization some project have inline JavaScript code in .cshtml files. In these files there are some bugs/code smells/vulnerability such as S1525. How can we capture these bugs?
Should we write a custom html rule or is there an easier way?

Thank you in advance.

Hi,

I’m going to move this to the ‘Suggest new features’ category, since the functionality isn’t currently available.

 
Ann

Thank you ganncamp,

So we have to write our custom html rule, until the new functionality for cshtml.

Thank you.

Hi,

To be clear, you won’t be able to write this custom rule to run within SonarQube; it’s not supported for html files. Instead, you’ll need to write something that runs before analysis & creates a Generic Issue Report to be read during analysis.

 
Ann

Hi,

Actually i have wrote a rule for this and it is working well for now.
But as you can see i could not show the actual line number of the debugger statement. Instead i could show the line number of the script tag.