This page looks best with JavaScript enabled

Lint’s STOPSHIP can save you from pushing your buggy code to production

 ·  ☕ 2 min read  ·  ✍️ Naveen T P
Banner
Photo by Kristaps Grundsteins on Unsplash

Have you anytime come across the situation where you published your app to playstore and recalling the bug that you left unfixed?

Gif
If yes, then this article is for you.

Android Lint is one of the most important and powerful static analysis tool that we are not using to its fullest. We can customise lint in our build.gradle to avoid accidentally pushing the known bugs to production.

Add this code block in your app’s build.gradle file.
1
2
3
4
5
6
// build.gradle
android {
  lintOptions {
      fatal 'StopShip'
  }
}

To avoid your unresolved buggy code not to hit production, just add the comment //STOPSHIP right in your codebase to fix the bug later.

And you are done!

At the time of building your app for playstore, If the lint finds out the comment in your codebase, it will break the build. So, You can go back to the code base, fix the known bug before publishing the app to production.

Release build will fail when lint finds STOPSHIP in code base
Release build will fail when lint finds STOPSHIP in code base

Lint will check the codebase during release build even if you are not running lint, as checkReleaseBuilds is by default true. There are about 42 user configurable lint fatal severities, STOPSHIP is one of those. You can go through each one of them, whichever suits your requirement you can implement it in your build.gradle.

If you like this article, you can buy me a coffee. Thanks!

Share on

Naveen T P
WRITTEN BY
Naveen T P
Mobile Developer | #Android | #iOS