Issues not created for Android lint rules

860 views
Skip to first unread message

Madasamy Sankarapandian

unread,
Jul 10, 2015, 4:53:28 AM7/10/15
to sona...@googlegroups.com

It looks like sonar is not applying Android specific rules defined in Android Lint quality profile.
As a result, android specific violations are not reported. Only java violations are reported.

I am using below environment.
  • Sonarqube v5.1.1
  • Android Lint v1.1
  • Sonar runner plugin v2.4 is used in my android project
  • Used Android Lint quality profile for my project

Configuration in build.gradle


sonarRunner {
sonarProperties {
property "sonar.host.url", "http://localhost.204:9000/sonar"
property "sonar.jdbc.url", "jdbc:mysql://localhost:3306/sonarnew?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true"
property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
property "sonar.jdbc.username", "foo"
property "sonar.jdbc.password", "****"
property "sonar.login", "bar"
property "sonar.password", "***"
property "sonar.sources", "src/main"
property "sonar.java.binaries", "build/intermediates/classes/debug/com/"
property "sonar.projectKey", "Myapp::Android"
property "sonar.projectName", "Myapp::Android"
property "sonar.projectVersion", "myversion"
property "sonar.projectDescription", "Myapp for android"
property 'sonar.sourceEncoding', 'UTF-8'
property 'sonar.language', 'java'
}
toolVersion = '2.4'
}






Nicolas Peru

unread,
Jul 10, 2015, 5:35:27 AM7/10/15
to Madasamy Sankarapandian, sona...@googlegroups.com
Hi, 

How and where do you generate the android lint report ? (see documentation for configuring where the android lint plugin should pick up the report : http://docs.sonarqube.org/display/PLUG/Android+Lint+Plugin

Cheers,


Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/4333e7c9-8449-4a3c-9c87-c3d70b782463%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Madasamy Sankarapandian

unread,
Jul 12, 2015, 9:31:38 PM7/12/15
to sona...@googlegroups.com, mada...@mcruncher.com
 @Nicolas, Thank you very much. I extremely sorry, i did not generate android lint report.

Madasamy Sankarapandian

unread,
Jul 12, 2015, 11:25:09 PM7/12/15
to sona...@googlegroups.com
Still i have same issue after generating android lint report.

To using below command to generating android lint report.

$lint --fullpath --xml <path>/app/build/outputs/lint-results.xml <projectDirectory>

Freddy Mallet

unread,
Jul 17, 2015, 11:27:22 AM7/17/15
to Madasamy Sankarapandian, sona...@googlegroups.com
Just to be sure Madasamy:
  • Have you defined the property "sonar.android.lint.report" to make it possible for the SonarQube analyser to find the Android Lint report ?
  • Have you activated all Android Lint rules in the active Quality Profile ?
++


Freddy MALLET | SonarSource
Product Director & Co-Founder
http://sonarsource.com

Madasamy Sankarapandian

unread,
Jul 19, 2015, 8:47:43 PM7/19/15
to sona...@googlegroups.com
Hi Freddy
  •  I have been defined sonar.android.lint.report in build.gradle
  •  All the rules are activated in quality profile

When i execute  $gradle sonarRunner, i got below warning message in my console


08:32:30.446 INFO  - Sensor org.sonar.plugins.android.lint.AndroidLintSensor@64589c34
08:32:30.493 INFO  - Processing android lint report: <path>/app/build/outputs/lint-results.xml
08:32:30.637 WARN  - Unable to find rule for LintError
08:32:30.638 WARN  - Unable to find file /<path>/AndroidManifest.xml to report issue
08:32:30.639 WARN  - Unable to find rule for UnusedAttribute
08:32:30.645 WARN  - Unable to find file <path>/AndroidManifest.xml to report issue
08:32:30.645 WARN  - Unable to find file <path>/AndroidManifest.xml to report issue
08:32:30.645 WARN  - Unable to find file <path>/layout_drawer.xml to report issue
08:32:30.645 WARN  - Unable to find file <path>/layout_drawer_customheader.xml to report issue
.
.
.

But this files are existing in respective path.

Julien HENRY

unread,
Jul 20, 2015, 3:11:13 AM7/20/15
to sona...@googlegroups.com, mada...@mcruncher.com
Hi Madasamy,

Are the paths relative to project baseDir (ie the root of the Gradle project)? Or maybe absolute paths?

++

Julien

Madasamy Sankarapandian

unread,
Jul 20, 2015, 8:24:49 PM7/20/15
to sona...@googlegroups.com
Hi Julien

   The paths are absolute path.


On Friday, July 10, 2015 at 4:53:28 PM UTC+8, Madasamy Sankarapandian wrote:

Julien HENRY

unread,
Jul 21, 2015, 4:53:26 AM7/21/15
to sona...@googlegroups.com, mada...@mcruncher.com
OK, I think your issue is that Android Lint plugin try to report issues on XML files that are not indexed. You should install the SonarQube XML plugin and configure sonar.sources to include concerned xml files. For example sonar.sources=AndroidManifest.xml,src

++

Madasamy Sankarapandian

unread,
Jul 23, 2015, 8:18:15 PM7/23/15
to SonarQube, mada...@mcruncher.com
Hi Julien Henry

         I have been installed SonarQube XML plugin in our SonarQube server.


On Friday, July 10, 2015 at 4:53:28 PM UTC+8, Madasamy Sankarapandian wrote:

sre...@intercall-se.com

unread,
Aug 13, 2015, 8:17:15 AM8/13/15
to SonarQube, mada...@mcruncher.com
Could it be related to the fact that you force java language, so xml files would not be loaded?
What happens if you remove the line:property 'sonar.language', 'java'

Martin

unread,
Sep 7, 2017, 7:35:52 AM9/7/17
to SonarQube
Yes! Indeed that's it! Been sitting with this for a while. When I removed 'sonar.language', 'java' it works. It also needs the XML files :) Great! Thanks!
Reply all
Reply to author
Forward
0 new messages