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

Image for post
Image for post
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?

Image for post
Image for post

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.

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.

Image for post
Image for post
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 liked the article, don’t shy away from giving claps. It will motivate me to write more articles like this. Happy coding!

Written by

Android / iOS developer | Open source enthusiast | https://naveentp.github.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store