-1

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.

Sun
  • 3,444
  • 7
  • 53
  • 83

1 Answers1

1

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.

Csuki
  • 1,297
  • 8
  • 21