-
Notifications
You must be signed in to change notification settings - Fork 154
Getting Started
The easiest way to install the SonarLint plugin is to search the marketplace from the IDE.
Go to File
> Settings
:
Then select the Plugins
> Marketplace
tab:
Then click OK
and restart the IDE to finalize the installation.
You can now enjoy SonarLint!
In case you want to install SonarLint offline, you need to first get access to the plugin zip file.
You can download official versions on the marketplace, or sometimes an ad-hoc version can be built mainly for debugging purposes when a user reports a bug on our community forum.
To install the zip, you can go to File
> Settings
> Plugins
, click on the wheel at the right, then Install Plugin from Disk...
SonarLint for IntelliJ provides out of the box support for the following languages:
- Java
- JavaScript/TypeScript
- Kotlin
- PHP
- Python
- Ruby
- HTML
- XML
More languages can be supported by binding your project to SonarQube or SonarCloud
Let's analyze a first source file and see what SonarLint can bring.
Copy paste this Java code snippet in a project. It contains a code smell because of duplicated methods:
package org.mycompany;
class MyClass {
private static final String CODE = "XXX";
public String calculateCode() {
doTheThing();
return CODE;
}
public String getName() {
doTheThing();
return CODE;
}
private void doTheThing() {
// do it
}
}
If you open this Java file within the editor, you should see SonarLint reporting the issue by highlighting the text range.
You can hover on the highlight to get a short description of the issue.
If you want to read a more detailed explanation of the issue, we provide context actions. One of them will open the detailed rule description.