SonarSource/sonarlint-intellij

GitHub: SonarSource/sonarlint-intellij

Stars: 636 | Forks: 156

# SonarQube for IntelliJ Plugin [![Build Status](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/063e1ea5ae133739.svg)](https://github.com/SonarSource/sonarlint-intellij/actions/workflows/build.yml?query=branch%3Amaster) [![Quality Gate](https://next.sonarqube.com/sonarqube/api/project_badges/measure?project=org.sonarsource.sonarlint.intellij%3Asonarlint-intellij&metric=alert_status)](https://next.sonarqube.com/sonarqube/dashboard?id=org.sonarsource.sonarlint.intellij%3Asonarlint-intellij) SonarQube for IDE is an IDE extension that helps you detect and fix quality issues, ensuring you deliver [integrated code quality and security](https://www.sonarsource.com/solutions/for-developers/). Like a spell checker, SonarQube for IntelliJ squiggles flaws so they can be fixed before committing code. ## Useful links - [Documentation](https://docs.sonarsource.com/sonarqube-for-intellij/) - A full list of supported programming languages and links to the static code analysis rules associated with each language are available on the [Rules page](https://docs.sonarsource.com/sonarqube-for-intellij/using/rules/). - [Community](https://community.sonarsource.com/c/help/sl) - Report an issue, ask for some help, or suggest new features. ## How to install You can install SonarQube for IntelliJ from the [JetBrains Plugin Repository](https://plugins.jetbrains.com/plugin/7973-sonarlint), directly available in the IDE preferences. Full up-to-date details are available on the [Requirements](https://docs.sonarsource.com/sonarqube-for-intellij/getting-started/requirements/) and [Installation](https://docs.sonarsource.com/sonarqube-for-intellij/getting-started/installation/) pages. ## Questions and Feedback? ## How to build ./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 ## How to run UI tests ./gradlew :its:runIdeForUiTests & The above will start an IDE instance with the SonarQube for IntelliJ 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-2025.2 & If you want to use a local installation, you can use the `runIdeDirectory` property to point to the directory of the IDE you want to run: ./gradlew :its:runIdeForUiTests -PrunIdeDirectory= & Please note that the IDE must be in the foreground while tests are executed. Because some ITs are leveraging SonarCloud, make sure the `SONARCLOUD_IT_TOKEN` env var is defined (you can find the value in our password management tool). ## How to debug UI tests If you want to debug what happens on the test side, you can launch the test in debug mode from the IDE. If you want to debug what happens in the SonarQube for IntelliJ plugin, you can open the project in IntelliJ, and run the `its:runIdeForUiTests` task in debug mode (for example, from the Gradle panel on the right). ## How to debug SLOOP If you want to debug SLOOP: * open the Run configuration you are using to launch the IDE (`runLocalIde` or `its:runIdeForUiTests`) * Add an environment variable: `SONARLINT_JVM_OPTS` with the value `-agentlib:jdwp=transport=dt_socket,address=8080,server=y,suspend=n` * Run the task * Open the SLCORE project and click `Run` > `Attach to process` * Choose the SLOOP running process If you want to plug the debugger as soon as SLOOP is started, you can modify the command above by having `suspend=y`. This will wait for the debugger to attach the process before starting SLOOP. ## How to develop in IntelliJ Import the project as a Gradle project. Note: whenever you change a Gradle setting (for example in `build.gradle.kts`), remember to **Refresh all Gradle projects** in the **Gradle** toolbar. To run an IntelliJ instance with the plugin installed, execute the Gradle task `runLocalide` using the command line, or the **Gradle** toolbar in IntelliJ, under `Tasks/intellij platform`. The instance files are stored under `build/sonarlint-test`. To run against a specific IDE, you can use the `runIdeDirectory` property to point to the directory of the IDE you want to run. For example: ./gradlew :runLocalIde -PrunIdeDirectory= Keep in mind that the `clean` task will wipe out the content of `build/`, so you will need to repeat some setup steps for that instance, such as configuring the JDK. ## Plugin Verification The project includes automated plugin verification across multiple JetBrains IDEs using the IntelliJ Platform Plugin Verifier. To run it locally: ./gradlew :verifyPlugin # For regular CI builds, only minimal version of IC ./gradlew :verifyPlugin -PverifierEnv=CI ## License Copyright SonarSource. Licensed under the [GNU Lesser General Public License, Version 3.0](http://www.gnu.org/licenses/lgpl.txt)