Monits / static-code-analysis-plugin

A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Apache License 2.0
39 stars 12 forks source link

Set ObsoletSdkInt as error #21

Closed barriosnahuel closed 7 years ago

barriosnahuel commented 7 years ago

Suggestion is because it help us to remove those hacks that everyone forget to remove after upgrading the minSdkVersion of the project.

Note: I don't know what happens if you set different minSdkVersion in a specific buildType just to set 21 as minimum to use instant run from the IDE. Is it gonna fail on your CI server? Should we use different rules for debug/release?

Example:

if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {

Docs:

ObsoleteSdkInt
--------------
Summary: Obsolete SDK_INT Version Check

Priority: 6 / 10
Severity: Warning
Category: Performance

This check flags version checks that are not necessary, because the
minSdkVersion (or surrounding known API level) is already at least as high as
the version checked for.
jsotuyod commented 7 years ago

Amazing as ever!