Scan my project
On this page
SonarLint, a core component of the Sonar solution, is a developer's first line of defense to find and fix coding issues in real-time. The results of a SonarLint scan provide rich contextual guidance to help you improve your skills while enhancing productivity to help you resolve issues in code.
SonarLint scans your project to provide instant feedback against hundreds of language-specific rules. When running in Connected Mode with SonarQube or SonarCloud, you can benefit from additional rules that identify security vulnerabilities and security hotspots as well as take advantage of team features that help your organization work towards a Clean Code state.
Every organization has custom policies and procedures; the SonarLint analyzer offers a level of customization to help you achieve those practices.
Language-specific information
SonarLint in Rider
The SonarSource C# analyzer is written as a Roslyn analyzer. We leverage the OmniSharp project (the language server used by VSCode) as a "runner" for our analyzer.
Supported features in Rider
- Loading of C# projects type supported by VSCode C# (.NET Core, .NET Framework, Unity, ...) (but manual configuration may be required, see
sonar.cs.internal.useNet6
below) - Analyze on the fly.
- Analyze the entire solution (may be slow, as files are analyzed one at a time).
- Display of rules descriptions.
- Setting up Connected Mode.
Missing features, known limitations
- We can't automatically determine the OmniSharp flavor to use for your project. You have to manually set
sonar.cs.internal.useNet6
tofalse
for legacy or Mono projects. - No VB.NET support (let us know if you are interested).
- Big solutions can take a lot of time to load/consume a lot of resources. See the Advanced Configuration section below for a list of properties to configure.
- If you have a
~/.omnisharp/omnisharp.json
configuration file, it will conflict with SonarLint. Please remove it. - Solutions mixing "new" and "legacy" projects are partially supported. Depending on the value of
sonar.cs.internal.useNet6
, only the supported projects will be loaded and have issues reported.
Advanced configuration
We aim at making SonarLint easy to use, and smart enough to avoid manual configuration. Unfortunately, we are not there yet for Rider. So here are a few properties you can set to tune embedded OmniSharp behavior:
Analysis Property | Default value | Description |
sonar.cs.internal.useNet6 | true | Use the modern Net 6 build of OmniSharp. If you are working with a Mono solution on Linux/Unix, or with an old NET Framework solution on Windows (< 4), set it to false |
sonar.cs.internal.loadProjectsOnDemand | false | By default the all projects of the solution will be loaded. This ensure maximum rules accuracy. For very big solutions that take too long to load, change this to true . |
sonar.cs.internal.startupTimeout | 60 | Maximum waiting time (in seconds) for OmniSharp to start |
sonar.cs.internal.loadProjectsTimeout | 60 | Maximum waiting time (in seconds) for OmniSharp to load all projects (not relevant if sonar.cs.internal.loadProjectsOnDemand is set to true ) |
To define those properties, go to SonarLint Project Settings:
Reporting issues
We are interested in your feedback. In case of an issue, please share:
- Your version of Rider:
- Your project/solution target and type (.NET Core, .NET Framework, ASP, Unity, ...):
- The version of SonarLint you installed:
- SonarLint + OmniSharp logs: in the SonarLint console, you have to enable verbose/analysis logs.
Was this page helpful?