Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing custom lint.xml

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...

like image 925
peter_budo Avatar asked Nov 22 '12 15:11

peter_budo


People also ask

What is lint XML?

The lint.xml fileA configuration file that you can use to specify any lint checks that you want to exclude and to customize problem severity levels.

How do you make lint baseline?

First, create a new project. Perform a Gradle sync. Then run lint: Analyze > Inspect Code; choose the whole project. Lint should now run, the Inspections View opens up, and in the bottom right corner a bubble tells you that lint has created a baseline file with the current issues.

What is lintOptions?

lintOptions { abortOnError false } This means it will run lint checks but won't abort the build if any lint error found. By default, its true and stops the build if errors are found.


1 Answers

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>
like image 147
alex.dorokhov Avatar answered Sep 30 '22 02:09

alex.dorokhov