This directory contains helper scripts written in bash and python for code clone analysis.
- The python script
generate_clone_pairs.py
aggregates the clone pair data in theFortranAS.sqlite3
database. - The bash script
explore_clones.py
automates diffing of the clone pairs with any diff tool such as meld..
Before running these tools a FortranAS.sqlite3
database is required. Run
FortranAS -c or --calculate-code-clones
flag before running these tools.
There is a python script provided in this directory called
generate_clone_pairs.py
that reads the FortranAS.sqlite3
database and
generates clone pair files in the output directory (output/clones
). This
script also generates a clone database called clones.sqlite3
in the same
output directory (output/clones/clones.sqlite3
).
To run clone pair generation first run FortranAS
on your FORTRAN source code
to generate a FortranAS.sqlite3
database. Once you have a database you can run
this script with:
python3 generate_clone_pairs.py
The output clone pair directory containing a reference and candidate can be diffed using and diff tool such as meld.
Open the directories output/clones/references
and output/clones/candidates
using a directory comparison using a diff tool.
Alternately, you can use the provided shell script to do an automated iterated
diff over all clone pairs in output/clones
using the provided shell script (explore_clones.sh
).
In the following example meld is used
- Set the
DIFFTOOL
environmental variable:
export DIFFTOOL=meld
- Run the
explore_clones.sh
shell script:
bash explore_clones.sh