Help needed with SonarLint

Hello!
I have read through some of the posts where the above two options have been compared and I would prefer to use SonarLint instead of the SonarAnalyser as it works in the background and does not slow down the build time. However, I would like to know if the below can be achieved using SonarLint

Redirect the scan result to the output window instead of ErrorList ( I understand this is a background process, but hoping someone has a solution :slight_smile:)

Using a common shared ruleset file for all projects ( I know the project level file reefer’s to the shared file, but would like to know if we can avoid the project level ruleset file. A warning message is displayed if the project level file is deleted and on update a new file is created.)

Thanks
JC

Hi @J_C. Welcome to the community.

I’m guessing you are using SonarLint for Visual Studio, are using Connected Mode (i.e. you have bound your solution to a SonarQube project), and are analyzing C# or VB.NET code. Is that correct?

Assuming it is:

  1. Redirect scan output to the output window.
    No, this isn’t possible. The SonarC#/VB analyzers are implemented as Roslyn analyzers, so VS is in control of executing them and displaying the output. VS does give some control over the scope of the analysis (i.e. whether all code files should be analysed or just open ones), and you can filter the Error List to reduce the number of issues that are displayed. See the MS docs for more information.

  2. Yes, you can an manually configure your solution to remove the project-level rulesets, and in fact that is how we have the SLVS solution configured. See this thread for more information.

We also have a ticket in the backlog to stop generating project-level rulesets by default. We hope to deliver this in the next version of SLVS in a couple of weeks.

Thank you Duncan for your reply.

Yes, your assumptions are correct.

Looking forward for the ruleset changes as this is really a useful feature to have.

Regards
JC

No problem.

Out of interest, why do you want to see the analysis results in the output window?

Regards,
Duncan

Hi Duncan

That’s the place the developer will first look for warnings and errors, so was exploring options to see the results in the output window. The Error List has some good features by the way, but would prefer the output window.

Regards
JC