Reputation: 20384
A popular attempt to bypass Salesforce Apex code coverage rules are code busters where one statement is used in thousands of repeating lines.
We have found variations like i=1;
or a++;
or a=b;
with endless variations for the variable name. All have in common that two (or more) consecutive lines (excluding empty or comments) are identical.
How can I discover those in PMD?
Upvotes: 1
Views: 311
Reputation: 1910
This sound more like a use case for the copy paste detector. This is a separate tool also available from PMD: https://pmd.github.io/pmd-6.12.0/pmd_userdocs_cpd.html
However, CPD is focused on finding duplicated code between different files, whereas you seem to be looking for duplicated code within one file.
Upvotes: 1