Android – Writing custom lint.xml

androidlintreporting

Our Android project is dependent on some external projects over which we do not have control. Therefore I'm trying to setup custom lint.xml file so we can add ignore rules for them. As starting scenario I tried to remove warnings from ActionBarSherlock (no offence Jake)

<?xml version="1.0" encoding="UTF-8"?>
<lint>
  <issue id="FloatMath">
    <ignore path="app/target/classes/com/actionbarsherlock/*" />
  </issue>
  <issue id="DefaultLocale">
    <ignore path="app/target/classes/com/actionbarsherlock/*" />
  </issue>
  <issue id="ViewConstructor">
    <ignore path="app/target/classes/com/actionbarsherlock/*" />
  </issue>
</lint>

with following command in

lint app --disable FloatMath,DefaultLocale,ViewConstructor --xml lint-result.xml

However produced report still included messages from ABS.

Update
I changed command to

lint --disable FloatMath,DefaultLocale,ViewConstructor --xml lint-result.xml app

Doesn't make any change for Jenkins still produce same report no matter what is in ignore, however if run in command line it does ignores all issues listed after disable. I wish that there was simple way to say, hey ignore/exclude things in sort of way Maven does…

Best Answer

Now it's possible to do so:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="all">
        <ignore regexp="target/classes/com/actionbarsherlock/.*[.]class" />
    </issue>
</lint>
Related Topic