-
-
Notifications
You must be signed in to change notification settings - Fork 90
Connect SonarLint extension to our SonarCloud
This tutorial shows how to connect SonarLint extension to our SonarCloud.
SonarCloud is a cloud-based static analysis tool we integrated in our CI/CD pipeline. It analyses code in each PR for bugs, vulnerabilities and code smells, and reports issues for the contributor to fix.
If you want to have your code analysed locally, as you write it, you want to install SonarLint extension for your IDE.
Immediate feedback is important, as it increases your productivity. You can see issues immediately as you write code, and you can easily fix them. Having to push to trigger the analysis every time is cumbersome. You have to wait for the results, and then write and push the fix, and what if the fix has some issues as well?
The issue is, even with SonarLint, you might encounter these workflow issues, since SonarLint is not as powerful as SonarCloud and doesn't have all of our rules enabled. So the goal of this tutorial is to mitigate that as much as possible, and connect the local SonarLint extension to the SonarCloud.
- IDE or code editor supported by SonarLint: IntelliJ, Eclipse or VSCode
- SonarLint extension. You can find them in marketplaces: IntelliJ extension, Eclipse extension
- Connect SonarLint to our SonarCloud
When SonarLint works in connected mode, it can:
- use the same quality profile (same rules activation, parameters, severity, ...)
- reuse some settings defined on the server (rule exclusions, analyzer parameters, ...)
- suppress issues that are marked as Won’t Fix or False Positive on the server
If you don't have an account, use OAuth with your github account to login.
For connecting to SonarCloud, we will use a User Token, as it is the most secure way to connect to the SonarCloud.
Go to your SonarCloud account security settings, and generate new token.
- Go to: File | Settings | Tools | SonarLint
- Click on +, or press Alt + Insert
- Enter connection name, for example 'TJ' and click Next (or press return)
- Enter the token you just created and click Next
- Click 'Select another organization..' and enter
togetherjava
, click OK and then Next - Click Next again if you are happy with notifications settings
- Click Next once again
- Go to: File | Settings | Tools | SonarLint | Project Settings
- Check 'Bind project to SonarQube / SonarCloud'
- Select previously created connection in 'Connection:' dropdown menu
- Click 'Search in list...' button, and click OK; or enter project key manually:
Together-Java_TJ-Bot
- Click Apply
Follow these official tutorials for your IDE: