Help on I18N support for sonar-java

java

(doituself) #1

Hello All,
I’m new to SonarQube but do like it very much, and I’m trying to find some rules related to I18N inspect for Java, but fail to find any existing one.

Any ideas or suggest to get sonar-java I18N inspection rules added? We’d like to first focus on the Hard Code check.

Thank you All


(doituself) #2

could any one help please, thanks?


(Alexandre Gigleux) #4

Hello,

SonarQube, more precisely SonarJava Analyzer, is having no rule helping to detect I18N problems. At SonarSource, we have no plan to add such rules, it doesn’t mean we cannot implement some if we have the specifications and if they are valuable for all.
The best is such situation is to describe the pattern you would like to catch (Noncompliant Code) and how to fix it (Compliant Solution).
If you want to participate and do this specification effort, you are welcome. In that case, we expect one entry per rule you will suggest in the “Suggest new features” > “New rules” section where I moved this post.

Regards


(doituself) #5

Hello,

Thank you for the reply, we’d like to add a rule to identify possible hard code strings like below: (later other I18N rules like Date/Numbers could come in)

String str = “this is good”;
ClassA.set(“this is bad”);

kind of things like below, but exclude some explicit numbers etc patterns.

Possible fix could be ignored at first, later could auto add ResourceBundle to move the hardcode strings in.

This feature would be helpful as more companies are pushing globalized products.

Any more details are needed please kindly let me know.

Thank you


(Elena Vilchik) #6

Hi @doituself,

Sorry but I fail to understand your rule idea. Please elaborate more about noncompliant example, why is it noncompliant, which practice you try to force. Also think what’s the code pattern you want to detect, describe it (“set” method call with string argument?).