Diffy
Diffy

Reputation: 2359

Additional lint rules in Android

I want to include some additional lint rules in my Android project. And by additional rules, i mean that i just want to include some extra rules from the list given in Android Studio( Pic attached)enter image description here

From the picture, i want to include the non-checked items also. Now i can do this very easily by checking the checkbox in Android Studio, but i want to do it for my Jenkins setup.

So is there any such XML file in which i can write the rules and just include it and it will run or do i have to go this hard way. I feel that there is an easy way to do it because it just a pre-defined rule and not any custom rule that i will be writing.

EDIT: For Android lint rules, i can create a lint file like this

<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="HardcodedText" severity="error" />
</lint>

But there is no such id/keyword for Java/C++/Other lint rules

Upvotes: 1

Views: 377

Answers (1)

Diffy
Diffy

Reputation: 2359

The rules that we see in Analyze->Inspect code are not actually same as the Android lint rules. These are the rules that is run by insepct.sh file in Android studio only when we do Inspect code and that doesnt run when we run or build the project.

In contrast,when we run the lint command in gradle,it doesnt check the code according to these rules(from the pic). It actually checks against the original Android lint rules(lint --list). So the only way to write additional lint rules is to go the hard way as specified in my question. Or one can use Checkstyle to specify some fair amount of rules.

Upvotes: 1

Related Questions