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

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?

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.

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!