Top-rated recipes tagged "similarity"http://code.activestate.com/recipes/tags/similarity/top/2012-07-12T14:59:11-07:00ActiveState Code RecipesPython code clone detector (Don't Repeat Yourself) (Python) 2012-07-12T14:59:11-07:00frahttp://code.activestate.com/recipes/users/4182629/http://code.activestate.com/recipes/578206-python-code-clone-detector-dont-repeat-yourself/ <p style="color: grey"> Python recipe 578206 by <a href="/recipes/users/4182629/">fra</a> (<a href="/recipes/tags/analysis/">analysis</a>, <a href="/recipes/tags/clone/">clone</a>, <a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/dry/">dry</a>, <a href="/recipes/tags/duplication/">duplication</a>, <a href="/recipes/tags/parse/">parse</a>, <a href="/recipes/tags/similarity/">similarity</a>, <a href="/recipes/tags/static/">static</a>, <a href="/recipes/tags/syntax/">syntax</a>). Revision 2. </p> <p>Find duplicate code in Python 2/3 source files. Write a nice report about it.</p> <p>Works at the Abstract Syntax Tree level, which is a robust way to detect clones. See this <a href="http://francois.boutines.free.fr/python-3.2-report.html">code duplicated in the Python 3.2 standard library</a>.</p> <p><strong>Update</strong>: I cleaned the code a little bit, made it Python 2.7 compatible and faster.</p>