Clone Finder Docker image
Supported tags: 2021.1-eap
, latest
(points to 2021.1-eap
)
We provide a Docker image for the Clone Finder linter to support different usage scenarios:
Running the analysis on a regular basis as part of your continuous integration (CI-based execution)
Single-shot analysis (for example, performed locally).
Quick start
Run analysis locally
Pull the image from Docker Hub (necessary to use the
latest
version):docker pull jetbrains/qodana-clone-finderRun the following command:
docker run --rm -it -p 8080:8080 \ -v <queried-project-directory>/:/data/project/ \ -v <reference-projects-directory>/:/data/versus/ \ -v <output-directory>/:/data/results/ \ jetbrains/qodana-clone-finder --show-report
where <queried-project-directory>
, <reference-projects-directory>
, and <output-directory>
are full local paths to the directories that contain, respectively, the project source code, one or more projects to compare against, and the analysis results.
Example of project structure:
This command runs the analysis on your source code and starts the web server to provide a convenient view of the results. Open http://localhost:8080
in your browser to examine the found problems and performed checks. Here, you can also reconfigure the analysis. See the UI section of this guide for details. When done, you can stop the web server by pressing Ctrl-C
in the Docker console.
In case you don't need the user interface and prefer to study raw data, use the following command:
The <output-directory>
will contain all the necessary results. You can further tune the command as described in the technical guide.
If you run the analysis several times in a row, make sure you've cleaned the results directory before using it in docker run
again.
By default, Qodana Clone Finder searches clones in all supported languages but you can explicitly specify languages to search. See technical guide for details.
If reference projects are not located under the same root directory, you can use the following options to map them inside the container: -v "<local path to project for comparison>/<project name>:/data/versus/<project name>"
Example:
Run analysis in CI
Run the following command as a task in a generic Shell executor:
docker run --rm -it \ -v <queried-project-directory>/:/data/project/ \ -v <reference-projects-directory>/:/data/versus/ \ -v <output-directory>/:/data/results/ \ jetbrains/qodana-clone-finder
where <queried-project-directory>
, <reference-projects-directory>
, and <output-directory>
are full paths to the directories that contain, respectively, the project source code, one or more projects to compare against, and the analysis results.
The content of <output-directory>
is described in Clone Finder Output. Consider using fail-threshold to make the build fail on reaching a certain number of problems. Running as non-root is also supported.
Example for GitHub Workflow (
.github/workflows/clone-finder-qodana.yml
):
Usage statistics
According to the JetBrains EAP user agreement, we can use third-party services to analyze the usage of our features to further improve the user experience. All data will be collected anonymously. You can disable the reporting of usage statistics by adjusting the options of the Docker command you use. Refer to the technical guide for details.
License
By using Qodana Clone Finder Docker image, you agree to the JetBrains EAP user agreement and JetBrains privacy policy.