Affects Version/s: 1.12
Fix Version/s: 2.11
Environment:Sonar runs on Red Hat Linux, connects to Oracle database, fetches code from CVS repository in a GForge installation.
Number of attachments :
We set up the "Settings -> CPD Plugin -> Ignore Literals" to be "true".
Sonar correctly detected this code to be copy/paste (code paraphrased):
List peopleList = new ArrayList();
peopleList.add("some other name");
was a copy of
List houseList = new ArrayList();
houseList.add("some other house");
For reasons beyond the scope of this bug, we need the strings to be in the code. So we changed the code into:
String  people = new String
String  houses = new String
The string arrays are also detected as duplicates. Although I technically understand why this is happening, I think this prevents developers from creating multiple large arrays with strings in any part of the code.
Is this the desired effect and if so, how do the people who wrote the CPD plugin suggest this is solved, given that the strings can not be externalized (the need to be part of the code, per requirement of the customer).