From: "gene.tani@..." Date: 2006-04-29T00:26:44+09:00 Subject: Re: Ruby Drops Jake McArthur wrote: > > How will it find similar code? One simple issue is that people will > > name their variables and methods differently, so you'll want to > > somehow see the structure of a section of code and ignore a lot of > > details. But you can't ignore the details too much. Maybe (trivial > > example) someone wrote a "max" function and someone else in-lined > > it, and otherwise their code blocks are the same. > > I've already been working on this. Right now, I'm making a simple > algorithm that works on arbitrary text and returns a number > reflecting how similar two strings are. Even this alone has been > giving fairly good results on code, even code that was written rather > differently, but my plan is to use this algorithm to compare symbols > and literals. A similar algorithm, working on a slightly larger > scale, would compare entire lines of code for similar syntax, > augmented by data from the first algorithm. > > I'm still thinking about this. Suggestions, anybody? > (my 1st ruby-talk post not from Google groups ) cyclomatic complexity may have some value as another input http://saikuro.rubyforge.org/ also look at gonzui and doing some kind of vector space-LSI modelling based on ruby keywords, core and std lib methodnames, etc.