vanessa-opensource / sonarqube-inject-vsc

SonarQube support for Visual Studio Code - MAIN repo
https://marketplace.visualstudio.com/items?itemName=silverbulleters.sonarqube-inject
MIT License
4 stars 4 forks source link

SonarQube support for Visual Studio Code extension

Join the chat at https://gitter.im/silverbulleters/sonarqube-inject-vsc GitHub release Build Status Dependency Status

SonarQube support for Visual Studio Code that provides on-the-fly feedback to developers on new bugs and quality issues injected into their code.
Non-official realization of SonarLint for VS Code.

TLDR: Quick Setup for Standalone mode

TLDR: Quick Setup for Connected mode

Connected mode

You can run analysis with connection to your SonarQube server. To do this you need to create two small config files.

Create and edit first file - global config - via SonarQube Inject: Create global config with credentials to servers command. In this file you need to define your SonarQube servers - id's, url, credentials (auth token or login and password pair) and organizationKey, if your SonarQube server has enabled Organization mode.

Example:

{
  "$schema": "https://gist.github.com/nixel2007/18b4e86ef1d98fb60b901ca4fcecb0e9/raw/bca2e6d461143f11aabe825deb596755893efbf9/global.json",
  "servers": [
    {
      "id": "localhost",
      "url": "http://localhost:9000",
      "token": "fe299234962a304f63386db4ffa0cbdb22367b52"
    }
  ]
}

Create and edit second file - project config - via SonarQube Inject: Create local sonarlint config with project binding command. In this file you need to define the serverId (id from global.json file) and projectKey - key of project at your SonarQube server.

Example:

{
    "$schema": "https://raw.githubusercontent.com/silverbulleters/sonarqube-inject-vsc/master/schemas/sonarlint.json",
    "serverId": "localhost",
    "projectKey": "my-project"
}

Don't forget to run SonarQube Inject: Update bindings to SonarQube server command in VSCode to update server bindings.

If you have any troubles or questions please start discussion in Issues page or Gitter.

SonarQube server with enabled Organization mode (eg. SonarCloud.io)

To analyze projects on SonarQube servers with Organizations you need to add organizationKey property in your global.json configuration file.

{
    "servers": [
        {
            "id": "localhost",
            "url": "http://localhost:9000",
            "token": "c8ecbc03f615ddbc1d97ad478ee024b45b6784c1",
            "organizationKey": "my-organization-key"
        }
    ]
}

You need to add new entry to servers array for every organization you want to add.

Extension settings

Hint:
If you need to specify multiply paths in GLOB patterns, you can use `{path1,path2}' notation.

Extension commands

Limitations

Currently works only with special sonarlint-cli version bundled with the extension. Source code can be found here.

Supported languages

Screenshot

default