2 comments

Hi !

This plugin is created in order to ease detecting duplications in source
code.


I think that it would be an excellent feature for IDEA. We could
discuss rules for duplicates searching and similarity calculation
and IDEA developers could implement the feature on the base of
already parsed and structured sources.

I suggest that the duplicate code searching could be more flexible
then a simple strings comparison (maybe without spaces). For example,
the following pices could be idenntical:

--
var1 = Class1.meth1( param1 );
if(var1 == var2)
Class2.meth3( var2 - var1 );
--
var3 = Class1.meth1( param6 );
if(var3 == var2)
Class2.meth3( var2 - var3 );
--

I just tried to show that the pices may differ just in parameter/variable
names. However,
the simple string comparison may skip such pices because these parameters
are long named and not similar.

In addition, IDEA could provide some existing/new refactorings for duplicate
pices.

What do you think guys ?

It is available at http://www.intellij.org/twiki/bin/view/Main/SamePlugin.

>

It is based on open source tools for finding duplications same
<http://www.sf.net/projects/same> by Marnix Klooster
(marnix@users.sourceforge.net).

>

Usage - select "Find Duplications" under "Code inspection".
After some time the pane with tabs "Statistics", "Tree of matches" and
"Table of matches" will appear.
In tree of matches you can browse files, that has duplications,
Table of matches provides alternative view, describing characteristics
of duplications - length, frequency and maximum possible gain from
removing a duplication. You can perform sorting by this characteristics,
from popup menu on header of table.

>

In order to run plugin on bigger projects, it is recommended to increase
memory from default idea settings.

>

Enjoy.

>

Sergey Yevtushenko

>


0

What I'd love to see along these lines is a tie in with the "pull methods
up" refactoring. Sometimes there is a method on all the derived classes
(through code evolution and/or a not-so-smart developer on the team ;), and
you'd like to pull all of them up to the common base class. It'd be nice to
be able to detect that there is a method with the "same" implementation in
all derived classes, and refactor it up. Similarly, if I move one of the
methods up, it'd be nice for IDEA to be able to notice that the other
simplementations that over-ride are the "same", and give me the option of
automatically eliminating them in the same step. That sort of thing.


"Egor Samarkhanov" <slash@actimind.com> wrote in message
news:b3nf2q$smb$1@is.intellij.net...

Hi !

>

This plugin is created in order to ease detecting duplications in source
code.

>

I think that it would be an excellent feature for IDEA. We could
discuss rules for duplicates searching and similarity calculation
and IDEA developers could implement the feature on the base of
already parsed and structured sources.

>

I suggest that the duplicate code searching could be more flexible
then a simple strings comparison (maybe without spaces). For example,
the following pices could be idenntical:

>

--
var1 = Class1.meth1( param1 );
if(var1 == var2)
Class2.meth3( var2 - var1 );
--
var3 = Class1.meth1( param6 );
if(var3 == var2)
Class2.meth3( var2 - var3 );
--

>

I just tried to show that the pices may differ just in parameter/variable
names. However,
the simple string comparison may skip such pices because these parameters
are long named and not similar.

>

In addition, IDEA could provide some existing/new refactorings for

duplicate

pices.

>

What do you think guys ?

>

It is available at

http://www.intellij.org/twiki/bin/view/Main/SamePlugin.

>

It is based on open source tools for finding duplications same
<http://www.sf.net/projects/same> by Marnix Klooster
(marnix@users.sourceforge.net).

>

Usage - select "Find Duplications" under "Code inspection".
After some time the pane with tabs "Statistics", "Tree of matches" and
"Table of matches" will appear.
In tree of matches you can browse files, that has duplications,
Table of matches provides alternative view, describing characteristics
of duplications - length, frequency and maximum possible gain from
removing a duplication. You can perform sorting by this characteristics,
from popup menu on header of table.

>

In order to run plugin on bigger projects, it is recommended to increase
memory from default idea settings.

>

Enjoy.

>

Sergey Yevtushenko

>

>
>


0

Please sign in to leave a comment.