All C# and VB.NET analyzers present in SonarLint for Visual Studio, in the SonarQube SonarC# Plugin or in the SonarQube SonarVB plugin are being developed here. These analyzers rely on Roslyn 1.0 API.
- Clone SonarC# repository: https://github.com/SonarSource/sonar-csharp.git
- Go to
sonaranalyzer-dotnet
sub-folder - Open SonarAnalyzer.sln
Note: SonarAnalyzer.VS2015.sln and SonarAnalyzer.VS2017.sln are not ready for use yet and are part of our plan to support .Net Core and C# 7 features.
We currently rely on Visual Studio 2015 for the development on the Analyzer. Any change to the solution or the projects linked to development with Visual Studio 2017 should not be included in PR.
You can run the Unit Tests via Test Explorer of Visual Studio.
If this is the first time you are running the ITs you will need to run the following command:
git submodule update --init --recursive
To run the ITs you will need to follow this pattern:
- Open the
Developer Command Prompt for VS2015
- Go to
PATH_TO_CLONED_REPOSITORY/sonar-csharp/sonaranalyzer-dotnet/its
- Run
powershell
- Run
.\regression-test.ps1
If the script ends with SUCCESS: No differences were found!
(or exit code 0), this means the changes you have made
haven't impacted any rule.
If the script ends with ERROR: There are differences between the actual and the expected issues.
(or exit code 1),
the changes you have made have impacted one or many issues raised by the rules.
You can visualize the differences using:
cd actual
git diff --cached
Please review all added/removed/updated issue to confirm they are wanted. When this is done run .\UpdateExpected.ps1
to update the list of expected issues.
From Visual Studio, make sure SonarAnalyzer.Vsix.csproj is selected as startup project. And then do the following:
- Make sure SonarLint for Visual Studio is uninstalled
- Hit
F5
to launch the experimental instance of Visual Studio - Open one of the following solutions from the experimental instance:
- Turn on your new rule in Validation Ruleset, review the results, improve, and setup the regression test once you are satisfied. Note: the solutions have been pre-configured to use this ruleset on all their projects.
Please see Contributing Code for details on contributing changes back to the code.