Configure SonarQube with VS-Code in Linux Environment
SonarQube is the leading tool for continuously inspecting the Code Quality and Security of your codebases
and guiding development teams during Code Reviews.
Please follow the steps to configure the SonarQube with your Linux local environment.
Open your VS-Code, and install the SonarLint extension.
Open the setting by clicking the “manage” icon in the Extension list, then click the “Edit in settings.json”
Now you need your token to activate the SonarQube connection with the server.
- Go to your organization SonarQube (e.g: https://sonarqube.company.com/) and login with your GitHub Enterprise SSO Login
- Go to Account → Security (e.g: https://sonarqube.company.com/account/security/)
- Generate a token and copy that token
In your settings.json of the SonarQube which you opened in VS-Code, add these configurations.
- Replace <TOKEN> with your token
- Replace <JAVA_HOME> with your Java Home directory (e.g:
/usr/lib/jvm/java-11-openjdk-amd64/
) - Replace <PROJECT_KEY> with one of your configured project in SonarQube. You may have to configure multiple
projectKey
if you have multiple configurations.
{
....existing default configurations,
"sonarlint.connectedMode.connections.sonarqube": [
{
"serverUrl": "https://sonarqube.company.com",
"token": "<TOKEN>"
}
],
"sonarlint.ls.javaHome": "<JAVA_HOME>",
"sonarlint.connectedMode.project": {
"projectKey": "<PROJECT_KEY>"
}
}
Open your command plate in VS Code (Ctrl+Shift+P), and run the following command to update the dependencies
> SonarLint: Update all project bindings to SonarQube/SonarClound
Once you executed the above command, you can see the logs in your output terminal.
Once it downloaded all the plugins, restart your VS-Code. Open a JS file after the restart, You can see that the SonarQube will start to analyze your files in the local environment. You can see the logs in your output terminal!!!