An interactive tool to eliminate code clones in Java applications
- Analyze any Java application and detect its duplicated source code
- Either input a local project or any that is available via a public Git repository
- Receive an advanced visualization of your code clones
- Explore your application and its code clones to interactively eliminate them
As part of a course in university, Núria and me had to do a clone detection application.
We very much enjoyed this assignment and eventually built it into this application.
While the core of Doppelgänger is using AST parsing and hashing to detect source code clones,
the output can be explored visually:
The tool consists of a back-end written in Kotlin as well as front-end built with Vue.js.
The entirety of the application is bundled into Docker images and can be executed with docker-compose
.
After having it installed, while in the root project directory, just run docker-compose up -d
.
Instead of cloning (no pun intended) the entire repository, you can also just create this docker-compose.yml
anywhere and run docker-compose up -d
:
version: "3"
services:
frontend:
image: loehnertz/doppelgaenger-frontend
ports:
- 8016:80 # Change the port in front of the colon as you wish
depends_on:
- backend
backend:
image: loehnertz/doppelgaenger-backend
ports:
- 8888:8888 # Do not change these ports
volumes:
- /:/app/projects/
environment:
PROJECT_ROOT: "/app/projects/"
- Select if you want to supply a local, or a Git-hosted project via the first dropdown input.
- Either put in a path on your local file system or a Git repository URI into the second input.
- Local project example:
/home/username/projects/my-app/
- Git project example:
[email protected]:username/my-app.git
- Local project example:
- Optionally specify the base path to your source code files in the third input.
- Example:
/src/main/java/
- Example:
- Select the clone type to use for the analysis.
- Type One: exact copy, ignoring whitespace and comments
- Type Two: syntical copy, changes allowed in variable, type, and function identifiers
- Type Three: copy with changed, added, or deleted statements
- Choose a similarity threshold for the analysis.
- This value determines how similar source code fragments have to be, to be flagged as clones.
- Choose a mass threshold for the analysis.
- This value determines how precise the analysis will be. Generally speaking, a low value will improve accuracy while decreasing the speed.
- Click the
Analyze
button and start exploring the detected clones.
Follows soon
This project is licensed under the MIT license.