Improvements | String Literals on the left on comparisons (SonarQube)#1077
Improvements | String Literals on the left on comparisons (SonarQube)#1077ulvii merged 1 commit intomicrosoft:devfrom dvmarcilio:string_literal_left_on_comparisons
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1077 +/- ##
============================================
- Coverage 53.24% 53.22% -0.02%
+ Complexity 3190 3187 -3
============================================
Files 119 119
Lines 28118 28118
Branches 4694 4694
============================================
- Hits 14971 14967 -4
+ Misses 10933 10928 -5
- Partials 2214 2223 +9
Continue to review full report at Codecov.
|
|
Hi @dvmarcilio There are more occurrences of such comparisons that you may wanna fix altogether for this rule. |
|
I'm covering all occurrences that showed up in Sonar. Unfortunately, the building is failing, and the error message does not provide much information:
Is that on my end? Any directions? Thanks! |
|
Nevermind the previous comment. The building is passing now. |
|
hi @dvmarcilio, |
|
Hi @lilgreenbird. I resolved the conflicts. I think the build error is not on my end. |
|
Thanks for the contribution, @dvmarcilio 👍. |
Transforming from
someString.equals("string")to"string".equals(someString). This avoids checking fornulland also preventsNullPointerExceptionbeing thrown.These fixes multiple SonarQube violations of the rule: Strings literals should be placed on the left side when checking for equality