Hi dev community.
I just released a new tool that can be helpful for you.
It's called "codesim" (on github: https://github.com/aclarembeau/codesim).
It's a utility that can help you to find duplicated parts of code in your sources.
You can get it calling:
wget --no-cache https://raw.githubusercontent.com/aclarembeau/codesim/master/main.py -O /usr/local/bin/codesim ; chmod +x /usr/local/bin/codesim
And use it with the following params:
usage: codesim [-h] [--exclude EXCLUDE] [--ratio RATIO] [--min-lines MIN_LINES] dir positional arguments: dir Directory containing all the source files optional arguments: -h, --help show this help message and exit --exclude EXCLUDE Exclude files matching the given pattern (ex: node_modules) --ratio RATIO Minimum percentage of common code (default: 0.9) --min-lines MIN_LINES Minimum number of common lines (default: 10)
It produces a table of all the duplicated parts of your code and can be really helpful, for instance, when doing web projects.
== Results == changes ratio lines a lines b 6.00 0.92 37 37 ./projects/hook_logs/_index.html.haml -> ./admin/hook_logs/_index.html.haml
If you like it, don't hesitate to leave me a star on Github :)