Customer Story | CleverTap reaches a high standard of code quality with SonarQube

the code quality challenge

CleverTap is an All-In-One customer engagement platform that unifies interactions between people, processes, and technology. CleverTap powers over 10,000 apps globally and helps customers retain their users. The platform enables the high-volume targeting and delivery of user messaging through various channels, powered by user behavioral analysis and segmentation, delivering in-moment experiences designed and optimized for scale in real-time.

Several industry-leading engineering innovations have gone into making this internet scale of real-time marketing automation and user engagement possible. A prime example is CleverTap’s proprietary TesseractDB™, a pioneering database specifically engineered for speed, scale, and depth in user data processing. With 11 product/technology patents pending, this unique technology enables brands to attain unparalleled depth and granularity in user analytics, offering a comprehensive 360-degree view of the customer.

CleverTap wanted to codify their tribal knowledge when it came to code quality, testing, and hygiene. This was to ensure that when they hired new engineers, there were enough guardrails set. They were looking for a tool to measure their test coverage and establish a code quality standard for their engineers across all the languages they use, including Java, JavaScript, Vue.JS, Objective-C, and Swift. 

the code quality solution

CleverTap decided to adopt static code analysis into their development process to improve the overall quality of their code. They were using Bitbucket as their code repository and IntelliJ as their IDE. After evaluating their options, they selected SonarQube as their tool of choice.

“At the time, we really needed a tool with support for Bitbucket, and SonarQube was one of the few code quality tools that allowed us to integrate with it. Looking back, we kind of love it. It’s been exactly what we need. We were able to enforce good practices. I remember a time before using SonarQube when a lot of my code reviews used to be too time consuming, pointing out trivial code smells all over the place. SonarQube does all that for us, and it has greatly reduced the work to handle these basic necessities of life that we take for granted as engineers. It allows our interns and new developers, especially those new to coding in Java, to develop in a safe way with guardrails in place. We trust SonarQube to do this for us and to make sure we code cleanly.

Jude Pereira – Principal Architect

CleverTap has since moved to GitHub from Bitbucket, and their transition was seamless. SonarQube’s integration with Maven, their primary build tool, was used to manage and monitor code test coverage. This is an essential aspect of the Clean as You Code approach, which they were searching for to set the desired code quality standard. 

“All in all, we found value in it right away, from a code standards and quality perspective. A lot of things that were caught manually during a code review went away, and we could focus more on the business logic vs. looking at minor and common issues that SonarQube now handles for us. We saw that one less PR review cycle was required for each merge since Sonar took care of all the major code related issues.”

Jude Pereira – Principal Architect

the code quality results

The value CleverTap sees in SonarQube is to enforce code quality levels with quality gates in the CI pipeline and ensure a desired level of code coverage. SonarQube provides an invaluable concise report of how clean their code is in the languages they use with a unified view across all their projects.

“The value we get out of SonarQube is massive. I’ve not seen any other tool that comes close to it or does anything similar. If we term each review cycle on an average to consume about 20 minutes of a reviewer’s time, with 50 PRs being merged a week, we’ve saved 16.6 hours per week using SonarQube.”

Jude Pereira – Principal Architect

Pull request (PR) decoration has been the most important to them, especially having migrated their projects from Bitbucket to GitHub. CleverTap uses SonarQube’s test code coverage integration with Maven & Jacoco to determine their baseline coverage, and monitor their progress while trying to reach their coverage goals.

“When we started using Sonar, code coverage stood at 40%. Today, we’ve covered over 70% of our code after using SonarQube for about four years. To drive this even higher, our quality gate is set to 85%.”

Jude Pereira – Principal Architect

CleverTap realized an additional unexpected benefit from using SonarQube over time. Their engineers became better at avoiding issues and quickly learned new advances in the languages and libraries they use. They found increased developer happiness with the Learn as You Code capability in SonarQube.

“SonarQube helps developers produce code with fewer errors in their code over time. Engineers who have been with us for a long time know how to proactively fix issues in their code because SonarQube teaches us. It has helped us pick up shorter and concise ways of expressing code in Java, by using lambdas and streaming operations where applicable. Since SonarQube keeps up to date with all the latest Java versions, it tells us when we’re not doing something right or that there’s a better technique and even tells us what’s preferred and what’s not. SonarQube has helped our engineers discover and learn new language capabilities over time.”

Jude Pereira – Principal Architect