How to achieve hard-code voilations with CodePro?

191 views Asked by At

I have to check some voilations like this

if(emp.companyName="MyCompany")

ie. Here there should not "MyComapany" hard-code in expression or condition checking.

which rule of CodePro do this.

1

There are 1 answers

0
Csuki On

PMD has a rule for similar problems that you described:

AvoidDuplicateLiterals - Code containing duplicate String literals can usually be improved by declaring the String as a constant field.