SonarLint is an IDE extension that helps you detect and fix quality issues as you write code. Like a spell checker, SonarLint squiggles flaws so they can be fixed before committing code.
- Documentation
- A full list of supported programming languages and links to the static code analysis rules associated with each language is available on the Rules page.
- Community
- Report an issue, ask for some help or suggest new features
You can install SonarLint from the JetBrains Plugin Repository, directly available in the IDE preferences.
Full up-to-date details are available on the Requirements and Installation pages.
For SonarLint support questions ("How do I?", "I got this error, why?", ...), please first read the FAQ to learn how to get your logs, and then head to the SonarSource forum. Before creating a new topic, please check if your question has already been answered because there is a chance that someone has already had the same issue.
Be aware that this forum is a community, and the standard pleasantries are expected (Hello, Thank you, I appreciate the reply, etc). If you don't get an answer to your thread, you should sit on your hands for at least three days before bumping it. Operators are not standing by, but the Teams and Community Managers know that your questions are important. :-)
If you would like to see a new feature, check out the PM for a Day page! There we provide a forum to discuss your needs and offer you a chance to engage the Product Manager and development teams directly. Feel free to add to an ongoing discussion or create a new thread if you have something new to bring up.
Please be aware that we are not actively looking for feature contributions. The truth is that it's extremely difficult for someone outside SonarSource to comply with our roadmap and expectations. Therefore, we typically only accept minor cosmetic changes and typo fixes.
With that in mind, if you would like to submit a code contribution, please create a pull request for this repository. Please explain your motives to contribute the change, describe what problem you are trying to fix, and tell us what improvement you are trying to make. The SonarLint Team will review the PR and discuss internally how it aligns with the roadmap.
Make sure that you follow our code style and that all tests are passing.
./gradlew buildPlugin
Note that the above won't run tests and checks. To do that too, run:
./gradlew check buildPlugin
For the complete list of tasks, see:
./gradlew tasks
./gradlew :its:runIdeForUiTests &
The above will start an IDE instance with the SonarLint plugin. Wait for the UI robot server to start, then run the ITs:
./gradlew :its:check
Finally close the IDE.
To test against a specific version of IntelliJ, the ijVersion
property can be used, e.g.:
./gradlew :its:runIdeForUiTests -PijVersion=IC-2019.3 &
To test against a specific IDE, the runIdeDirectory
property can be used as such:
./gradlew :its:runIdeForUiTests -PrunIdeDirectory=<IDE_PATH> &
Please note that the IDE must be in foreground while tests are executed.
Import the project as a Gradle project.
Note: whenever you change a Gradle setting (for example in build.gradle.kts
),
don't forget to Refresh all Gradle projects in the Gradle toolbar.
To run an IntelliJ instance with the plugin installed, execute the Gradle task runIde
using the command line,
or the Gradle toolbar in IntelliJ, under Tasks/intellij
.
The instance files are stored under build/idea-sandbox
.
To run against a specific IDE, the runIdeDirectory
property can be used as such:
./gradlew :runIde -PrunIdeDirectory=<IDE_PATH>
Keep in mind that the clean
task will wipe out the content of build/idea-sandbox
,
so you will need to repeat some setup steps for that instance, such as configuring the JDK.
Whenever you change dependency version, the previous versions are not deleted from the sandbox, and the JVM might not load the version that you expect.
As the clean
task may be inconvenient, an easier workaround is to delete the jars in the sandbox, for example with:
find build/idea-sandbox/ -name '*.jar' -delete
Copyright 2015-2023 SonarSource.
Licensed under the GNU Lesser General Public License, Version 3.0