3

I want to add some custom rules in the sonar-android-master plugin.

Found this answer but its not clear in this where to login as Administrator.

But while searching more I got this Extending Coding Rules, which states that to add custom rules for android-lint XPath and Java can't be used.

So please here is my question:

  • Is it possible to add a custom rule in the sonar-android-plugin ?
  • If answer to above question is yes then please provide me with some inputs on how to proceed ?
Community
  • 1
  • 1
Shruti
  • 1
  • 13
  • 55
  • 95

1 Answers1

1

Android lint plugin is currently relying on android lint tool (available in the android SDK). Therefore there is no way provided by this sonar plugin to add custom rules. (and no real plan to do so, as we want to provide nice android rules via the java plugin).

You could try to write a small plugin to add your custom android lint rules (because I think you can write custom rules for that tool) to sonarqube so then the android lint plugin would be able to import issues related to those rules in sonarqube.

benzonico
  • 10,635
  • 5
  • 42
  • 50
  • Thanks for your reply,I didn't got about which tool you are talking here "because I think you can write custom rules for that tool" .Also it would be great if you can provide some tutorial link to create small plugin for lint rules. – Shruti Nov 20 '15 at 10:26
  • I am talking about android lint tool. I have absolutely no deep knowledge about the features of android lint, so look it up. – benzonico Nov 20 '15 at 10:51
  • can u please explain me architecture of this plugin https://github.com/SonarSource/sonar-android .. or atleast point me to some documentation link..as it is not clear from code how and where rules are defined – Shruti Dec 21 '15 at 14:02
  • @benzonico Is it possible for me to add the existing lint rules(new ones) which are missing in this plugin? This plugin is not longer maintained and contains only 158 lint checks while the actual lint has 260 checks. – Ajith M A Apr 22 '17 at 15:30