Scan not flagging code from non-compliant example

I took the non-compliant code example from a rule page, and put it into a dotnet core project. On scanning, sonar does not flag the non-compliant code with a code smell.

https://rules.sonarsource.com/csharp/type/Code%20Smell/RSPEC-4462

dotnet-sonarscanner version 4.9.0
sonarqube version: 8.3.1.34397

Hello @foragerr,

I just did it now with the latest version of the C# analyzer:

It works as expected.

You figured out that this rule is not enabled by default so you have to create a Quality Profile to enable it, right? Other than that, it’s likely your analysis which is misconfigured or something.

Cheers

You figured out that this rule is not enabled by default so you have to create a Quality Profile to enable it, right?

Nope, I did not, and that was exactly it. I wrongly assumed these rules were included in the default quality profile. Thank you.

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