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.

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.3.tar.gz (9.5 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: potator-0.1.3.tar.gz
  • Upload date:
  • Size: 9.5 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.3.tar.gz
Algorithm Hash digest
SHA256 1a5fc7ae1f0aea78fbbbcca6f58ec96e4e3d615ceeb6c1dedf0a0875736e329c
MD5 cd9d24214b85642c72361a74118519fc
BLAKE2b-256 85c02e18053dd6b3387465f3c2f907eadcd4af6efb80c8b6fdef911730850812

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