简体   繁体   中英

Android lint: How to disable “NewerVersionAvailable” check for testCompile dependencies?

I'm using NewerVersionAvailable lint check to determine newer dependencies versions. But it looks like that this check is useful only for implementation dependencies. I think we don't need to update junit anytime soon. How to disable this check for separate dependency type? It is boring to add //noinspection to each testImplementation dependency. Example given:

dependencies {

    // should warn
    implementation 'com.android.support:support-annotations:25.0.0'

    // shouldn't warn
    testImplementation 'junit:junit:4.12'
}

One should better disable the check for individual dependencies, simply because then one would still be notified of any further outdated libraries:

<issue id="NewerVersionAvailable">
    <ignore regexp="junit:junit*"/>
</issue>

With such a pattern: junit:junit* one can ignore individual dependencies - and one can ignore whole dependency-groups with such a pattern: junit:* .

This still needs to be combined with //noinspection GradleDependency , because lint and the IDE's code-inspection are not the same thing.

You can create a configuration file for lint inside your project and add this line to it, likes below:

<lint>
   ...
   <issue id="NewerVersionAvailable" severity="ignore" />
   ...
</lint>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM