Small code clone detection tool. It implements an algorithm from SourcererCC with adaptive prefix filtering optimizations and displays its results as HTML.
It works with JavaScript, Python, Java, Go, C++, PHP, C#, C, Swift, Kotlin and Haskell.
Supported platforms
potator supports Linux and macOS. It is possible to use potator on Windows under WSL
Installation
Using pip
potator can be installed using pip
pip install potator
Using installation script
git clone https://github.com/otzhora/potator
cd potator
./install.sh
Usage
Using potator as a standalone cli application
potator [-h] [-d {Naive,Filtering}] [--depth DEPTH] [-t THRESHOLD] [-g GRANULARITY] [-o OUT] directory
Options
- You can choose one of two detectors:
NaiveandFiltering.Naive detectorcompares every possible combination of source code fragments and calculates Jaccard similarity between them.Filtering detectorimplements algorithm fromSourcererCCpaper with anadaptive prefix filteringoptimizations. depthparameters specify the maximum depth of adaptive prefix.depth=2is recommended. Since it offers the optimal balance between costs of building index and querying it.thresholdis the minimum score that two code fragments should have to be considered clones.granularityspecifies granularity of code blocks. Options arefunctionsandclasses.functionsis recommended.outspecifies the name of the resulting htmldirectoryis the directory with files on which to perform search.
You can also do export DEBUG=1 before the search, then profiling information will be printed out.
Using potator as python package
You can import detectors or entities extractor from potator and use them to work with source code.
>>> from potator.detectors import FilteringDetector
>>> detector = FilteringDetector()
>>> detector.detect(directory, thershold, granularity)
>>> from potator.extractors import EntitiesExtractor
>>> EntitiesExtractor.extract_data_from_directory(directory, granularity)
Metadata
Release files for potator 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| potator-0.1.4.tar.gz | 9.8 kB | Without provenance | Details for potator-0.1.4.tar.gz |
Release files / potator-0.1.4.tar.gz
| Download URL | potator-0.1.4.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
803608b200a31bda785c4d97277d7c98955ee088bc29c429437f32194dbc1a84
|
|
BLAKE2b-256 checksum How to use checksums |
4956fa3f903a8555464bcd34b55708be044e9a089f209f7ef19282a2608d266a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Security for potator 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.