From dc759f4030a5650710ff1e042d5a5724847e4a25 Mon Sep 17 00:00:00 2001 From: uditgoel475 <52441008+uditgoel475@users.noreply.github.com> Date: Mon, 17 Aug 2020 16:25:54 +0530 Subject: [PATCH] Update LocalVarsShouldComplyWithNamingConvention.java Removal of i++ as by default it should pickup the char next to '_' and convert it uppercase. But with i++ it skips the given char next to '_' and treats the 2nd next char in uppercase concatenation. eg: 'employee_code' is getting converted to employeeOde instead of employeeCode. --- .../visitors/LocalVarsShouldComplyWithNamingConvention.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/walkmod/sonar/visitors/LocalVarsShouldComplyWithNamingConvention.java b/src/main/java/org/walkmod/sonar/visitors/LocalVarsShouldComplyWithNamingConvention.java index 1710c9a..9290f15 100644 --- a/src/main/java/org/walkmod/sonar/visitors/LocalVarsShouldComplyWithNamingConvention.java +++ b/src/main/java/org/walkmod/sonar/visitors/LocalVarsShouldComplyWithNamingConvention.java @@ -55,8 +55,7 @@ private String getValidNewName(String name) { String result = ""; boolean toUpperCase = false; for (int i = 0; i < letters.length; i++) { - if (letters[i] == '$' || letters[i] == '_') { - i++; + if (letters[i] == '$' || letters[i] == '_') { toUpperCase = true; } else { if (toUpperCase) {