rhesa has asked for the wisdom of the Perl Monks concerning the following question:
The first step I took was to run everything through perltidy, so that I have consistent formatting throughout.
The second step was running Perl::Metrics::Simple on our code, which already reveals a lot of refactoring targets. The largest subs and the ones with the highest complexity will be first on my list.
The third step is the one I could use help with. The idea is to find duplicated code resulting from old-fashioned copy/paste-programming. What I think I need for this, is the inverse of a diff tool: something that finds blocks of code that are identical.
Do tools exist, that can find blocks of code occurring more than once in a batch of files?
As you can see, we're using the BSD/Allman brace style.+----------------------------+-------+ | loc | refs | +----------------------------+-------+ | | 11381 | | } | 4358 | | { | 4121 | | ); | 746 | | else | 475 | | 1; | 404 | +----------------------------+-------+
If anyone is interested, I can show my data model, crossreferencing script, and the web-based browser I have made for this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Refactoring tools for copy/paste jobs
by Corion (Patriarch) on Oct 09, 2006 at 13:29 UTC | |
by rhesa (Vicar) on Oct 09, 2006 at 14:00 UTC | |
|
Re: Refactoring tools for copy/paste jobs
by philcrow (Priest) on Oct 09, 2006 at 14:31 UTC | |
|
Re: Refactoring tools for copy/paste jobs
by jbert (Priest) on Oct 09, 2006 at 15:10 UTC | |
by planetscape (Chancellor) on Oct 09, 2006 at 19:08 UTC | |
by rhesa (Vicar) on Oct 09, 2006 at 15:55 UTC | |
by jbert (Priest) on Oct 09, 2006 at 16:14 UTC |