Cshtml file analyzed with CSS rules

Hi,

I’m using SQ 8.5 and one rule coming from CSS quality profile (“at-rules” should be valid) is causing issues on cshtml files (which are html files with embedded CS code).
I had a look in administration > language > CSS, and the file extension *.cshtml is not enabled on the CSS language. Why is this rule applied then to these files?
I noticed though that cshtml extension is enabled in HTML language, and i’m wondering if inlined CSS code in html files is not analyzed too with CSS quality profile?

Thanks,
Maxime

Hi Maxime,

Well spotted! The extensions for a language list the files that the language “claims” and runs all its rules against. Only one language can claim any given extension. However no language is limited to analyzing only the extensions it claims. There are times when we take extra steps to analyze additional files for a language, such as when Java analysis picks up pom.xml files to run some Java/Maven-specific checks on those files. As a feature, we’ve done that in some specific places, such as HTML rules being run against Angular, JSP, Vue.js, and PHP templates. I wasn’t specifically aware of what you’re reporting, but it looks like the same thing.

If it’s a problem for you, then I suppose an exclusion would be the best thing.

 
HTH,
Ann

Hi Ann,
OK thanks for the info, i just configured this exclusion

Thanks,
Maxime

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.