Skip to content

yagoluiz/sonar-dotnet-vscode

Repository files navigation

Sonar Dotnet for Visual Studio Code

Sonar Dotnet is an Visual Studio Code extensions that helps you detect and fix quality issues as you write code in C#.

Features

Open the Command Palette and search Sonar Dotnet.

Lint

How to Use

Lint

  1. Set your desired path in terminal
  2. Select Sonar Dotnet: Lint in Command Palette

Result:

Lint

  1. Execute dotnet build command

Result:

Lint

Once configured in the project it is no longer necessary to run the lint again.

Requirements

  1. The Sonar Dotnet needs a .NET Core 2.0+.
  2. Install tool dotnet-sonarscanner.

dotnet tool install --global dotnet-sonarscanner

Extension Settings

Configure organizationKey, token and serverUrl properties in user settings:

Settings

Field organizationKey and serverUrl is optional. Server url default is SonarCloud: https://sonarcloud.io.

{
    "sonar-dotnet-vscode.connection.sonar": {
        "organizationKey": "<myOrganizationKey>",
        "token": "<myToken>",
        "serverUrl": "<myServerUrl>"
    }
}

Configure project key in configuration file .vscode/settings.json.

{
    "sonar-dotnet-vscode.connection.project": {
        "projectKey": "<myProjectKey>"
    }
}

Release Notes

See the CHANGELOG for more information.

License

Licensed under the MIT.