It Finally Happened

So the SonarQube quality gate failed on our build. Eyes rolled. We looked at the report, expecting yet another piece of low-value pedantry.

The code it didn’t like was (in Java):

if (value == "method1") {
   ...
}

Wait… that’s not right. That’s reference equals on String, which may work if the source string was compiled at the same time, and everything was interned… but actually, it’s an actual bug!

Most likely, this bug wouldn’t be noticed during unit tests, where string literals are compiled and interned!

It’s an easy fix.

The point here is that you should not operate without these tools, and you should go into their reports expecting to learn something. Because sometimes there really are mistakes, and these tools can save your ass!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s