Sonarqube Visual Studio



SonarLint spots bugs and quality issues as fast as you code.

SonarLint leverages the.NET Compiler Platform ('Roslyn') to offer a fully integrated Visual Studio experience. Check the rules to see what SonarLint can do for you: SonarQube and SonarCloud connected mode SonarLint can be connected to a SonarQube server or SonarCloud to share rulesets, get event notifications and use a resolution flow.

  1. Exploring the Code Architecture in Visual Studio through Dependency Graph The NDepend dependency graph has been completely rebuilt within NDepend version 2020.1 released in April 2020. You might have used the NDepend dependency graph in the past but the new graph is certainly worth a try because it represents an important milestone in how code.
  2. SonarQube™ is the leading tool for continuously inspecting the Code Quality and Security™ of your codebases, all while empowering development teams. Analyze over 25 popular programming languages including C#, VB.Net, JavaScript, TypeScript and C. SonarQube easily pairs up with your Azure DevOps environment and tracks down bugs, security vulnerabilities and code smells.
  • 5 languages supported: C#, VB .Net, C, C++ and Javascript.
  • Open source, Roslyn based code analyzers.
  • Deep code analysis algorithms using pattern matching and dataflow analysis
  • Hundreds of rules, and growing.
  • Comes with explanations to resolve detected issues.

Get started in seconds

Simply open a file within a project or a solution, start coding, and you will start seeing issues detected by SonarLint.

Visit SonarLint website: https://vs.sonarlint.org

Smart code analysis, on the fly

Detect quality issues as you code
SonarLint gives immediate feedback on bugs, code smells and vulnerabilities.

Remain focused and productive
SonarLint lists issues found in all the files that you updated. It subtly points out these issues so that you can still focus on coding.

Get clear explanations to fix issues
SonarLint provides you with all the information you need to understand and fix issues.

Fully integrated in Visual Studio

SonarLint leverages the .NET Compiler Platform ('Roslyn') to offer a fully integrated Visual Studio experience.

Check the rules to see what SonarLint can do for you:

C#See rules
VB.NETSee rules
CSee rules
C++See rules
JavaScriptSee rules

SonarQube and SonarCloud connected mode

SonarLint can be connected to a SonarQube server or SonarCloud to share rulesets, get event notifications and use a resolution flow.
Learn more about SonarQube.

Have question or feedback?

The preferred way to discuss about SonarLint is by posting on the SonarSource Community Forum. Feel free to ask questions, report issues, and give suggestions.

How to contribute

Check out the contributing page to see the best places to log issues and start discussions.

License

Copyright 2016-2020 SonarSource.
Licensed under the GNU Lesser General Public License, Version 3.0

This page lists analysis parameters related to test coverage and execution reports. For more other parameters, see Analysis Parameters.

SonarQube doesn't run your tests or generate reports. It only imports pre-generated reports. Below you'll find language- and tool-specific analysis parameters for importing coverage and execution reports.

Sonarqube For Visual Studio

Visual

In the Guides category of the SonarSource Community forum you might find instructions on generating these reports.

Extension

Some properties support the following wildcards in paths. The remarks for properties that support wildcards will mention that fact. If the remarks do not say wildcards are supported, then they are not.:

Studio
SymbolMeaning
?a single character
*any number of characters
**any number of directories

Sonarqube Visual Studio Code

Test Coverage

Unless otherwise specified, these properties require values that are relative to project root.

LanguagePropertyRemarks
Anysonar.coverageReportPathsPath to coverage report in the Generic Test Data format.
Apexsonar.apex.coverage.reportPathPath to the test-result-codecoverage.json report file generated by the apex:test:run command of the Salesforce CLI. Note, you must have a Salesforce DX project set up and linked to your Org
C / C++ / Objective-Csonar.cfamily.gcov.reportsPathPath to the directory containing native *.gcov reports (not the XML reports generated by gcovr)
C / C++ / Objective-Csonar.cfamily.llvm-cov.reportPathPath to a llvm-cov report
C / C++ / Objective-Csonar.cfamily.vscoveragexml.reportsPathPath may be absolute or relative to the solution directory. Path wildcards (see above) are supported. Note that the .coveragexml report format offered by Visual Studio is not supported.
C / C++ / Objective-Csonar.cfamily.bullseye.reportPathPath to the report from Bullseye, version >= 8.9.63 (use covxml tool)
C#sonar.cs.vscoveragexml.reportsPathsPath to Visual Studio Code Coverage report. Multiple paths may be comma-delimited, or included via wildcards. See Notes on importing .NET reports below.
C#sonar.cs.dotcover.reportsPathsPath to dotCover coverage report. See Notes on importing .NET reports below.
C#sonar.cs.opencover.reportsPathsPath to OpenCover coverage report. See Notes on importing .NET reports below.
C#sonar.cs.ncover3.reportsPathsDeprecated. Path to NCover3 coverage report. See Notes on importing .NET reports below.
Flexsonar.flex.cobertura.reportPathsPath to the Cobertura XML reports. Multiple paths may be comma-delimited. May be absolute or relative to the project base directory.
Gosonar.go.coverage.reportPathsComma-delimited list of paths to coverage report files. Path wildcards are supported (see above) since SonarGo 1.1.
Java / Kotlin / Scala / JVMsonar.coverage.jacoco.xmlReportPathsPath to JaCoCo XML coverage reports. Path wildcards are supported (see above).
Javasonar.jacoco.reportPathsDeprecated. Use sonar.coverage.jacoco.xmlReportPaths. Path to JaCoCo reports in binary format. Supported only for Java.
JavaScript / TypeScriptsonar.javascript.lcov.reportPathsComma-delimited list of paths to LCOV coverage report files. Paths may be absolute or relative to project root.
PHPsonar.php.coverage.reportPathsComma-delimited list of paths to Clover XML-format coverage report files. Paths may be absolute or relative to project root.
Pythonsonar.python.coverage.reportPathsComma-delimited list of paths to coverage reports in the Cobertura XML format. Path wildcards are supported (see above). Leave unset to use the default (coverage-reports/*coverage-*.xml).
Rubysonar.ruby.coverage.reportPathsComma-delimited list of paths to SimpleCov report files generated with the JSON formatter (availaible from SimpleCov 0.20). For SimpleCov versions < 0.18, you can provide .resultset.json report files (not recommended). Paths may be absolute or relative to project-root.
Scalasonar.scala.coverage.reportPathsComma-separated list of paths to scoverage.xml report files generaged by Scoverage.
Swift, Xcode 9.3+You can use the xccov-to-sonarqube-generic.sh script from the sonar-scanning-examples/swift-coverage project convert output from Xcode 9.3's xccov tool to the Generic Test Data format.
Swift, Xcode 7-9.2sonar.swift.coverage.reportPathPath to the report generated by llvm-cov show. Path may be absolute or relative to project root.
VB.NETsonar.vbnet.vscoveragexml.reportsPathsPath to Visual Studio Code Coverage report. Multiple paths may be comma-delimited, or included via wildcards. See Notes on importing .NET reports below.
VB.NETsonar.vbnet.dotcover.reportsPathsPath to dotCover coverage report. See Notes on importing .NET reports below.
VB.NETsonar.vbnet.opencover.reportsPathsPath to OpenCover coverage report. See Notes on importing .NET reports below.
VB.Netsonar.vbnet.ncover3.reportsPathsDeprecated. Path to NCover3 coverage report. See Notes on importing .NET reports below.

Test Execution

Unless otherwise specified, these properties require values that are relative to project root.

Sonarqube visual studio plugin
LanguagePropertyRemarks
Allsonar.testExecutionReportPathsComma-delimited list of paths to execution reports in the Generic Execution Data format.
C / C++ / Objective-Csonar.cfamily.cppunit.reportsPathPath to the directory holding the CPPUnit reports. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.
C#sonar.cs.vstest.reportsPathsPaths to VSTest reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.
C#sonar.cs.nunit.reportsPathsPaths to NUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.
C#sonar.cs.xunit.reportsPathsPaths to xUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.
Gosonar.go.tests.reportPathsComma-delimited list of paths to unit test report files. Paths may be absolute or relative to project root.
Java / Kotlinsonar.junit.reportPathsComma-delimited list of paths to Surefire XML-format reports.
JavaScript / TypeScriptYou can use jest-sonar-reporter or karma-sonarqube-unit-reporter to create reports in the Generic Execution Data format. Both packages are available on npm.
PHPsonar.php.tests.reportPathPath to the PHPUnit unit test execution report file. Path may be absolute or relative to project root.
Pythonsonar.python.xunit.reportPathPath to unit test execution report. Leave unset to use the default (xunit-reports/xunit-result-*.xml). Path wildcards (see above) are supported. If any paths in the report are invalid, set sonar.python.xunit.skipDetails=true to collect only project-level details.
VB.NETsonar.vbnet.vstest.reportsPathsPaths to VSTest execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.
VB.NETsonar.vbnet.nunit.reportsPathsPaths to NUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.
VB.NETsonar.vbnet.xunit.reportsPathsPaths to xUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.

Importing .NET reports

To import .NET reports, the report generation process must be executed after the begin step and before the end MSBuild command. The following steps detail importing .NET reports:

  1. Run the SonarScanner.MSBuild.exe begin command, specifying the absolute path where the reports will be available using the /d:propertyKey='path' syntax ('propertyKey' depends on the tool)
  2. Build your project using MSBuild
  3. Run your test tool, instructing it to produce a report at the same location specified earlier to the MSBuild SonarQube Runner (How to generate reports with different tools)
  4. Run the SonarScanner.MSBuild.exe end command

Sonarqube Visual Studio

For more information, see the Generate Reports for C#, VB.net Community Post.