Sonarqube for IDE [Visual Studio] issues/questions

but I saw the issue S1541 for example is shown in the error list

What is the Sonar severity of S2094 in the Report view? If it’s Info or Low - that is expected. TreatWarningsAsErrors should only affect issues with Medium, High and Blocker severities

We can test it with a simple issue ‘“async” and “await” should not be used as identifiers’ csharpsquid:S2306

Can you add this to your code:

int await = 42; // Noncompliant, but compiles
int async = 42; // Noncompliant, but compiles

async and await issue is shown as error yes.

Maybe the S2094 severity is to low. Where can I find the severity in the report view?

image

And could it be possible to customize that, that also “Info” and “Low” severities is treated as errors? We have nearly all Sonarqube rules active with only a few exceptions and we have the policy that the code need to have zero issues

Severity is the icon on the left, the yellow circle in this case.

Currently our severity mapping (from Sonar to VS/Roslyn severity) is hardcoded, but you should be able to change the Sonar severity of each rule in your server’s Quality Profile.

You can also submit a feature request for customizable severity mappings separately, as that is something new, unlike the other regressions that were reported in this thread originally.

1 Like

image
BTW, you can also hover over the icon to get the severity

1 Like

@Lutti1988 we’ve also added the notification regarding discovered errors at the end of the Build, could you check if it looks good to you?

To see it you should have TreatWarningsAsErrors enabled, have Sonar errors in the Error List and run a build in VisualStudio

1 Like

Looks fine. Thank you!

Hi. JFYI There’s an issue with the implementation: SonarQube Reporting Multiple Global Analyzer Warning Message in Brand New Project

Not sure why this is happening, but I might need to disable the disabling of cleanup for our issues

I disabled the feature temporarily, will work on the alternative fix

I’ve made a new PR with the proper fix, could you try it? SLVS-2878 Fix: suppression_exclusions.globalconfig should only be included once · SonarSource/sonarlint-visualstudio@68da07d · GitHub

that version works!

thank you

1 Like

Hi, I added analysis for unused pragma directives. It also includes an automatic fix for each individual issue, however there’s no batch fixing yet. Here’s the build: SLVS-2855 Highlight pragma-based warning suppressions for sonar rules… · SonarSource/sonarlint-visualstudio@d340098 · GitHub

You can also configure the reported severity in the extension options.

2 Likes

Hi,

works great. thank you for that too!