Skip to main content

No project description provided

Project description

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: Naive and Filtering. Naive detector compares every possible combination of source code fragments and calculates Jaccard similarity between them. Filtering detector implements algorithm from SourcererCC paper with an adaptive prefix filtering optimizations.
  • depth parameters specify the maximum depth of adaptive prefix. depth=2 is recommended. Since it offers the optimal balance between costs of building index and querying it.
  • threshold is the minimum score that two code fragments should have to be considered clones.
  • granularity specifies granularity of code blocks. Options are functions and classes. functions is recommended.
  • out specifies the name of the resulting html
  • directory is 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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

potator-0.1.4.tar.gz (9.8 kB view details)

Uploaded Source

File details

Details for the file potator-0.1.4.tar.gz.

File metadata

  • Download URL: potator-0.1.4.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for potator-0.1.4.tar.gz
Algorithm Hash digest
SHA256 803608b200a31bda785c4d97277d7c98955ee088bc29c429437f32194dbc1a84
MD5 88927d2bb7ec2272cdac5ee675f6db41
BLAKE2b-256 4956fa3f903a8555464bcd34b55708be044e9a089f209f7ef19282a2608d266a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page