Short answer: yes, you can use the SonarQube IntelliJ community plugin
Long answer:
Assuming you have build.gradle, for example:
apply plugin: "sonar-runner" sonarRunner { sonarProperties { // can be also set on command line like -Dsonar.analysis.mode=incremental property "sonar.host.url", "http://your.sonar.server:9000" property "sonar.analysis.mode", "incremental" property 'sonar.sourceEncoding', 'UTF-8' property 'sonar.language', 'java' property 'sonar.profile', 'my_profile' } } subprojects { sonarRunner { sonarProperties { properties["sonar.sources"] += "src/main/java" } } } ....
then you can start local sonar analysis using gradle:
$ ./gradlew sonarRunner
this will lead to the creation of a sonar-report.json file:
$ cat build/sonar/sonar-report.json
Now you have everything you need for the plugin:
- SonarQube Server
- Local analysis script
- Name: gradle script
- Script: / path / to / android-studio-example-project / gradlew sonarRunner
- Path to sonar-report.json: /path/to/android-studio-example-project/build/sonar/sonar-report.json
After the setup is complete, you can see new problems by checking SonarQube (new problems) inside Intellij (Android Studio)
I used this project as an example:
https://github.com/sonar-intellij-plugin/android-studio-example-project
and sonarqube server 4.0 with a set of rules for squid only (4.4 could not parse the gradle project)
source share