Why is the rule "Strings literals should be placed on the left side when checking for equality" inactive?

42 views
Skip to first unread message

Dominik Kaspar

unread,
Jun 6, 2018, 3:18:23 AM6/6/18
to SonarQube
Hi,

We had quite some internal discussions about the rule "Strings literals should be placed on the left side when checking for equality".
Some think it's a valuable guard against potential NullPointerExceptions, others think constructs like "xyz".equals(str) are bad 'yoda-style' notation.

Is anyone able to tell me about the reasons why this rule was disabled in the built-in "Sonar way" Java profile?

Cheers,
Dominik

Nicolas Peru

unread,
Jun 6, 2018, 3:29:21 AM6/6/18
to Dominik Kaspar, SonarQube
Hi, 

The very fact that this rule leads to controversy ("some think... others think") was enough to not make it part of default Sonar Way profile.

Cheers, 

--
Important: this SonarQube Google Group will close on June 11th, 2018, in order to move to a new forum to power even more community discussions. See details in this post: https://groups.google.com/d/msg/sonarqube/BbSZz-JnhVM/DavhMueEAAAJ
---
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/8782b176-e221-42be-863d-e9cf1b0a5072%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource
Reply all
Reply to author
Forward
0 new messages