Subject: | Policy suggestion : identify similar/duplicate code for refactoring |
A hallmark of bad code is duplicated, or nearly duplicated blocks of code in a single distribution
- when you inherit a huge swathe of horrible code to maintain, this can be a significant
problem. A policy that would be akin to the CPD (http://pmd.sourceforge.net/cpd.html) to find
duplicated code, or even better, could somehow compare PPI representations of arbitrary
chunks of code both within and across files in a distribution, ignoring the actual variable names
and values, but able to detect duplicated logic, would be hugely valuable. It could then suggest
possible ways in which the code could be re-factored.