Writing Custom Rules for Java Regarding HardCoded Source Code

Hello @denny1995v6,

Sorry for the late reply. I missed your answer back then. Did you managed to write your rule targeting string literals?

Easiest way would have been to go for Tree.Kind.VARIABLE, and check if the initializer is a Tree.Kind.STRING_LITERAL. Please don’t ask me how, everything is described in the tutorial.

Now, I’m afraid that if writing custom rules (after following the tutorial) is difficult to you, writing specific custom rules is going to be huge challenge. You better first getting familiar with java, maven, concepts of static analysis (google?) and the SonarJava static analyzer code source and rules before jumping into custom rules.

Regards,
Michael