Thursday, June 24, 2010

Python duplicate code detection with clonedigger

The python tool clonedigger can be used to examine your source code for duplication. It can be installed with easy_install clonedigger. Here is how to run it:
user1@deby:~/devenv/trunk$ ../bin/clonedigger src/
Parsing  src/greatings/helloworld.py ... done
Parsing  src/greatings/__init__.py ... done
Parsing  src/greatings/tests/__init__.py ... done
Parsing  src/greatings/tests/test_helloworld.py ... done
3 sequences
average sequence length: 2.666667
maximum sequence length: 3
Number of statements:  8
Calculating size for each statement... done
Building statement hash... done
Number of different hash values:  5
Building patterns... 6 patterns were discovered
Choosing pattern for each statement... done
Finding similar sequences of statements... 0  sequences were found
Refining candidates... 0 clones were found
Removing dominated clones... 0 clones were removed
Read more about clonedigger here.

No comments :

Post a Comment